From: hackbard Date: Wed, 24 Mar 2004 10:44:34 +0000 (+0000) Subject: implemented "collisions per ion" variable. new defaults. bugfixed z-diff. X-Git-Url: https://hackdaworld.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c37428b4496d4854ee7bd43b45be36238625c965;p=physik%2Fnlsop.git implemented "collisions per ion" variable. new defaults. bugfixed z-diff. --- diff --git a/nlsop.c b/nlsop.c index 243cd92..9b9f803 100644 --- a/nlsop.c +++ b/nlsop.c @@ -48,11 +48,6 @@ #define MAKE_AMORPH(N) *(N)|=AMORPH #define MAKE_CRYST(N) *(N)&=~AMORPH -/* test globals - get removed or included in my_info struct later */ -int amorph_count; -int cryst_count; -unsigned char c_diff; - int usage(void) { puts("usage:"); @@ -83,6 +78,7 @@ int usage(void) puts("-S \t save to file"); puts("-R \t read from random file"); puts("-P \t specify implantation profile file"); + printf("-H \t collisions per ion in simulation window (default %d)\n",CPI); return 1; } @@ -112,19 +108,11 @@ int process_cell(d3_lattice *d3_l,u32 x,u32 y,u32 z,info *my_info) p+=*conc*my_info->a_cp*URAND_MAX; if(!(*thiz&AMORPH)) { - if(get_rand(URAND_MAX)<=p) - { - MAKE_AMORPH(thiz); - amorph_count++; - } + if(get_rand(URAND_MAX)<=p) MAKE_AMORPH(thiz); } else { /* assume 1-p probability */ - if(get_rand(URAND_MAX)>p) - { - MAKE_CRYST(thiz); - cryst_count++; - } + if(get_rand(URAND_MAX)>p) MAKE_CRYST(thiz); } return 1; @@ -180,7 +168,7 @@ int distrib_c(d3_lattice *d3_l,info *my_info,int step,double c_ratio) { off=i+((j+c+d3_l->max_y)%d3_l->max_y)*d3_l->max_x+k*d3_l->max_x*d3_l->max_y; carry=0; - if(!(*(d3_l->status+off)&AMORPH)) carry=(int)(my_info->dr_ac*(*(d3_l->extra+off))); + if(!(*(d3_l->status+off)&AMORPH)) carry=(int)(my_info->dr_ac*(*(d3_l->extra+off))); if(carry!=0) { *(d3_l->extra+offset)+=carry; @@ -190,27 +178,33 @@ int distrib_c(d3_lattice *d3_l,info *my_info,int step,double c_ratio) } if(my_info->z_diff) { - for(c=-1;c<=1;c++) + if(k!=0) { - if(c!=0) + off=i+j*d3_l->max_x+(k-1)*d3_l->max_x*d3_l->max_y; + carry=0; + if(!*(d3_l->status+off)&AMORPH) carry=(int)(my_info->dr_ac*(*(d3_l->extra+off))); + if(carry!=0) { - off=i+j*d3_l->max_x+((k+c+d3_l->max_z)%d3_l->max_z)*d3_l->max_x*d3_l->max_y; - carry=0; - if(!*(d3_l->status+off)&AMORPH) carry=(int)(my_info->dr_ac*(*(d3_l->extra+off))); - if(carry!=0) - { - *(d3_l->extra+off)-=carry; - *(d3_l->extra+offset)+=carry; - } + *(d3_l->extra+off)-=carry; + *(d3_l->extra+offset)+=carry; + } + } + if(k!=d3_l->max_z-1) + { + off=i+j*d3_l->max_x+(k+1)*d3_l->max_x*d3_l->max_y; + carry=0; + if(!*(d3_l->status+off)&AMORPH) carry=(int)(my_info->dr_ac*(*(d3_l->extra+off))); + if(carry!=0) + { + *(d3_l->extra+off)-=carry; + *(d3_l->extra+offset)+=carry; } } } } else /* case not amorph: cryst <-> cryst diffusion */ - - /* test ! */ - if(c_diff) { - /* */ + if(my_info->c_diff) { + /* if there is c diff, no diff in z-direction */ { for(c=-1;c<=1;c++) { @@ -664,7 +658,7 @@ int get_c_ratio(double *c_ratio,char *pfile,info *my_info,d3_lattice *d3_l) int main(int argc,char **argv) { u32 x,y,z,x_c,y_c,z_c; - int i,quit,escape,switchmode,nowait,bmp; + int i,j,quit,escape,switchmode,nowait,bmp; int refresh,resave; int c_step; char s_file[MAX_CHARS]; @@ -711,7 +705,7 @@ int main(int argc,char **argv) refresh=REFRESH; resave=RESAVE; my_info.z_diff=0; - c_diff=1; + my_info.c_diff=1; my_info.a_el=A_EL; my_info.b_el=B_EL; my_info.a_cd=A_CD; @@ -723,6 +717,7 @@ int main(int argc,char **argv) my_info.dr_ac=DR_AC; my_info.dr_cc=DR_CC; my_info.diff_rate=DIFF_RATE; + my_info.cpi=CPI; nowait=0; quit=0; escape=0; @@ -736,9 +731,6 @@ int main(int argc,char **argv) strcpy(r_file,""); mode=0; - amorph_count=0; - cryst_count=0; - for(i=1;i