projects
/
physik
/
nlsop.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
added nuclear energy loss profile + new random calculation according to nel. default...
[physik/nlsop.git]
/
nlsop.c
diff --git
a/nlsop.c
b/nlsop.c
index
10a3f2f
..
da983b3
100644
(file)
--- a/
nlsop.c
+++ b/
nlsop.c
@@
-78,6
+78,7
@@
int usage(void)
puts("-S <file> \t save to file");
puts("-R <file> \t read from random file");
puts("-P <file> \t specify implantation profile file");
puts("-S <file> \t save to file");
puts("-R <file> \t read from random file");
puts("-P <file> \t specify implantation profile file");
+ puts("-N <file> \t specify nuclear energy loss profile file");
printf("-H <value> \t collisions per ion in simulation window (default %d)\n",CPI);
return 1;
printf("-H <value> \t collisions per ion in simulation window (default %d)\n",CPI);
return 1;
@@
-118,7
+119,7
@@
int process_cell(d3_lattice *d3_l,u32 x,u32 y,u32 z,info *my_info)
return 1;
}
return 1;
}
-int distrib_c(d3_lattice *d3_l,info *my_info,int step,double c_ratio)
+int distrib_c(d3_lattice *d3_l,info *my_info,int step,double c_ratio
,u32 rj_m,u32 *rj_g
)
{
u32 x,y,z;
int i,j,k,c;
{
u32 x,y,z;
int i,j,k,c;
@@
-131,8
+132,9
@@
int distrib_c(d3_lattice *d3_l,info *my_info,int step,double c_ratio)
x=get_rand(d3_l->max_x);
y=get_rand(d3_l->max_y);
// printf("nd: %d %d\n",x,y);
x=get_rand(d3_l->max_x);
y=get_rand(d3_l->max_y);
// printf("nd: %d %d\n",x,y);
- z=get_rand_lgp(d3_l->max_z,my_info->a_cd,my_info->b_cd);
- // printf("ld: %d\n",z);
+ // z=get_rand_lgp(d3_l->max_z,my_info->a_cd,my_info->b_cd);
+ z=get_rand_reject(d3_l->max_z,rj_m,rj_g);
+ // printf("%d\n",z);
*(d3_l->extra+x+y*d3_l->max_x+z*d3_l->max_x*d3_l->max_y)+=1;
(my_info->cc)++;
}
*(d3_l->extra+x+y*d3_l->max_x+z*d3_l->max_x*d3_l->max_y)+=1;
(my_info->cc)++;
}
@@
-747,13
+749,15
@@
u32 get_reject_graph(info *my_info,d3_lattice *d3_l,char *file,u32 *graph) {
j=i;
i++;
while(flag[i]==0&&i<d3_l->max_z) i++;
j=i;
i++;
while(flag[i]==0&&i<d3_l->max_z) i++;
- printf("debug: i = %d j = %d\n",i,j);
for(k=j+1;k<i;k++) graph[k]=(int)((k-j)*((int)graph[i]-(int)graph[j])/(i-j))+graph[j];
if(graph[i]>max) max=graph[i];
}
free(flag);
for(k=j+1;k<i;k++) graph[k]=(int)((k-j)*((int)graph[i]-(int)graph[j])/(i-j))+graph[j];
if(graph[i]>max) max=graph[i];
}
free(flag);
+ // printf("debug: (interpolated c profile)\n");
+ // for(i=0;i<d3_l->max_z;i++) printf("%d %d\n",i,graph[i]);
+
return max;
}
return max;
}
@@
-768,6
+772,7
@@
int main(int argc,char **argv)
char l_file[MAX_CHARS];
char c_file[MAX_CHARS];
char p_file[MAX_CHARS];
char l_file[MAX_CHARS];
char c_file[MAX_CHARS];
char p_file[MAX_CHARS];
+ char n_e_file[MAX_CHARS];
char convert;
char r_file[MAX_CHARS];
#ifdef USE_DFB_API
char convert;
char r_file[MAX_CHARS];
#ifdef USE_DFB_API
@@
-800,6
+805,7
@@
int main(int argc,char **argv)
#endif
u32 *c_profile;
u32 *n_e_loss;
#endif
u32 *c_profile;
u32 *n_e_loss;
+ u32 ne_max,ip_max;
d3_l.max_x=X;
d3_l.max_y=Y;
d3_l.max_x=X;
d3_l.max_y=Y;
@@
-831,10
+837,12
@@
int main(int argc,char **argv)
strcpy(l_file,"");
strcpy(c_file,"");
strcpy(p_file,IMP_PROFILE);
strcpy(l_file,"");
strcpy(c_file,"");
strcpy(p_file,IMP_PROFILE);
+ strcpy(n_e_file,NEL_PROFILE);
convert=0;
strcpy(r_file,"");
mode=0;
convert=0;
strcpy(r_file,"");
mode=0;
- u32 ne_max;
+ ne_max=0;
+ ip_max=0;
for(i=1;i<argc;i++)
{
for(i=1;i<argc;i++)
{
@@
-923,6
+931,9
@@
int main(int argc,char **argv)
case 'P':
strcpy(p_file,argv[++i]);
break;
case 'P':
strcpy(p_file,argv[++i]);
break;
+ case 'N':
+ strcpy(n_e_file,argv[++i]);
+ break;
case 'g':
strcpy(l_file,argv[++i]);
if(i<argc-1) if(argv[i+1][0]!='-') c_step=atoi(argv[++i]);
case 'g':
strcpy(l_file,argv[++i]);
if(i<argc-1) if(argv[i+1][0]!='-') c_step=atoi(argv[++i]);
@@
-1051,10
+1062,20
@@
int main(int argc,char **argv)
puts("failed allocating memory for nuclear energy loss graph");
return -1;
}
puts("failed allocating memory for nuclear energy loss graph");
return -1;
}
- ne_max=get_reject_graph(&my_info,&d3_l,p_file,c_profile);
+ ip_max=get_reject_graph(&my_info,&d3_l,p_file,c_profile);
+ ne_max=get_reject_graph(&my_info,&d3_l,n_e_file,n_e_loss);
- /* break here for testing ... */
- return 23;
+#ifdef DEBUG_RAND
+ while(1)
+ {
+#ifdef DEBUG_CP
+ printf("%d\n",get_rand_reject(d3_l.max_z,ip_max,c_profile));
+#endif
+#ifdef DEBUG_NEL
+ printf("%d\n",get_rand_reject(d3_l.max_z,ne_max,n_e_loss));
+#endif
+ }
+#endif
i=(c_step?c_step:0);
while((i<my_info.steps) && (quit==0) && (escape==0))
i=(c_step?c_step:0);
while((i<my_info.steps) && (quit==0) && (escape==0))
@@
-1063,10
+1084,11
@@
int main(int argc,char **argv)
{
x_c=get_rand(d3_l.max_x);
y_c=get_rand(d3_l.max_y);
{
x_c=get_rand(d3_l.max_x);
y_c=get_rand(d3_l.max_y);
- z_c=get_rand_lgp(d3_l.max_z,my_info.a_el,my_info.b_el);
+ // z_c=get_rand_lgp(d3_l.max_z,my_info.a_el,my_info.b_el);
+ z_c=get_rand_reject(d3_l.max_z,ne_max,n_e_loss);
process_cell(&d3_l,x_c,y_c,z_c,&my_info);
}
process_cell(&d3_l,x_c,y_c,z_c,&my_info);
}
- distrib_c(&d3_l,&my_info,i,c_ratio);
+ distrib_c(&d3_l,&my_info,i,c_ratio
,ip_max,c_profile
);
#ifdef USE_DFB_API
if(i%refresh==0)
{
#ifdef USE_DFB_API
if(i%refresh==0)
{