#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:");
puts("-S <file> \t save to file");
puts("-R <file> \t read from random file");
puts("-P <file> \t specify implantation profile file");
+ printf("-H <value> \t collisions per ion in simulation window (default %d)\n",CPI);
return 1;
}
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;
{
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;
}
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++)
{
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];
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;
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;
strcpy(r_file,"");
mode=0;
- amorph_count=0;
- cryst_count=0;
-
for(i=1;i<argc;i++)
{
if(argv[i][0]=='-')
my_info.z_diff=1;
break;
case 'i':
- c_diff=0;
+ my_info.c_diff=0;
my_info.dr_cc=0;
break;
case 's':
strcpy(l_file,argv[++i]);
if(i<argc-1) if(argv[i+1][0]!='-') c_step=atoi(argv[++i]);
break;
+ case 'H':
+ my_info.cpi=atoi(argv[++i]);
+ break;
default:
usage();
return -1;
sprintf(cd_txt,"a_cd: %.3f b_cd: %.3f",my_info.a_cd,my_info.b_cd);
sprintf(cp_txt,"a_cp: %.4f",my_info.a_cp);
sprintf(dr_ac_txt,"a/c diffusion rate: %.4f",my_info.dr_ac);
- if(my_info.dr_cc!=0) sprintf(dr_cc_txt,"c/c diffusion rate: %.4f",my_info.dr_cc);
+ if(my_info.c_diff!=0) sprintf(dr_cc_txt,"c/c diffusion rate: %.4f",my_info.dr_cc);
else sprintf(dr_cc_txt,"c/c diffusion rate: none");
sprintf(zdiff_txt,"diffusion in z direction: %c",my_info.z_diff?'y':'n');
sprintf(diff_txt,"diffusion every %d steps",my_info.diff_rate);
i=(c_step?c_step:0);
while((i<my_info.steps) && (quit==0) && (escape==0))
{
- 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);
+ for(j=0;j<my_info.cpi;j++)
+ {
+ 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);
+ process_cell(&d3_l,x_c,y_c,z_c,&my_info);
+ }
distrib_c(&d3_l,&my_info,i,c_ratio);
- process_cell(&d3_l,x_c,y_c,z_c,&my_info);
#ifdef USE_DFB_API
if(i%refresh==0)
{
sprintf(xyz_txt,"x: %d y: %d z: %d",x+1,y+1,z+1);
sprintf(status_txt,"status: %c",(*(d3_l.status+x+y*d3_l.max_x+z*d3_l.max_x*d3_l.max_y)&AMORPH)?'a':'c');
sprintf(conc_txt,"conc: %d",*(d3_l.extra+x+y*d3_l.max_x+z*d3_l.max_x*d3_l.max_y));
- sprintf(steps_txt,"step: %d a_count: %d",i,amorph_count);
- sprintf(cc_txt,"total c: %d c_count: %d",my_info.cc,cryst_count);
+ sprintf(steps_txt,"step: %d",i);
+ sprintf(cc_txt,"total c: %d",my_info.cc);
d3_lattice_draw(&d3_l,x,y,z,25,arg_v,mode,0);
}
#endif