* nlsop.c
*
* this program tries helping to understand the amorphous depuration
- * and recrystallization of SiCx while ion implanation. hopefully the program
- * will simulate the stabilization of the selforganizing structure in the
- * observed behaviour.
+ * and recrystallization of SiCx while ion implantation at temperatures
+ * below 400 degree celsius.
+ * hopefully the program will simulate the stabilization of the
+ * selforganizing lamella structure in the observed behaviour.
*
* refs:
* - J. K. N. Lindner. Habilationsschrift, Universitaet Augsburg.
printf("-a <value> \t slope of nuclear energy loss (default %f)\n",A_EL);
printf("-b <value> \t nuclear energy loss offset (default %f)\n",B_EL);
printf("-x <value> \t # x cells (default %d)\n",X);
- printf("-y <value> \t # x cells (default %d)\n",Y);
- printf("-z <value> \t # x cells (default %d)\n",Z);
+ printf("-y <value> \t # y cells (default %d)\n",Y);
+ printf("-z <value> \t # z cells (default %d)\n",Z);
/*
printf("-X <value> \t display x (default %d)\n",X/2-1);
printf("-Y <value> \t display y (default %d)\n",Y/2-1);
printf("-C <value> \t initial c concentration (default %d)\n",CC);
*/
printf("-D <value> \t diffusion rate from cryst to amorph cells (default %f)\n",D_R);
+ printf("-W <value> \t write every <value> steps to save file (default %d)\n",RESAVE);
+ puts("-C <file> \t convert file to gnuplot format");
puts("-L <file> \t load from file");
puts("-S <file> \t save to file");
puts("-R <file> \t read from random file");
unsigned char *thiz;
int *conc;
int i,j;
+ int off;
double p;
thiz=d3_l->status+x+y*d3_l->max_x+z*d3_l->max_x*d3_l->max_y;
{
if(!(i==0 && j==0))
{
- if(*(d3_l->status+((x+d3_l->max_x+i)%d3_l->max_x)+((y+d3_l->max_y+j)%d3_l->max_x)*d3_l->max_x+z*d3_l->max_x*d3_l->max_y)&AMORPH) p+=a*URAND_MAX/(i*i+j*j);
+ off=((x+d3_l->max_x+i)%d3_l->max_x)+((y+d3_l->max_y+j)%d3_l->max_x)*d3_l->max_x+z*d3_l->max_x*d3_l->max_y;
+ if(*(d3_l->status+off)&AMORPH) p+=a*(*(d3_l->extra+off))*URAND_MAX/(i*i+j*j);
}
}
}
+ // printf("debug: p = %f\n",p);
if(!(*thiz&AMORPH))
{
- if(get_rand(URAND_MAX)<=p)
- {
- MAKE_AMORPH(thiz);
- // *t_c=*t_c+1-*conc;
- } // else *t_c+=1;
+ if(get_rand(URAND_MAX)<=p) MAKE_AMORPH(thiz);
} else
{
/* assume 1-p probability */
- if(get_rand(URAND_MAX)>p)
- {
- MAKE_CRYST(thiz);
- // *t_c=*t_c+1+*conc;
- } // else *t_c+=1;
+ if(get_rand(URAND_MAX)>p) MAKE_CRYST(thiz);
}
*t_c+=1;
if(c!=0)
{
off=((i+d3_l->max_x+c)%d3_l->max_x)+j*d3_l->max_x+k*d3_l->max_x*d3_l->max_y;
+ carry=0;
/* case neighbour not amorph */
if(!(*(d3_l->status+off)&AMORPH)) carry=(int)(d_r*(*(d3_l->extra+off)));
/* case neighbour amorph */
+ /*
+ * no diffusion between amorphous cells
+ *
else carry=(*(d3_l->extra+off)-*(d3_l->extra+offset))/2;
+ */
if(carry!=0)
{
*(d3_l->extra+offset)+=carry;
if(c!=0)
{
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;
/* case neighbour not amorph */
if(!(*(d3_l->status+off)&AMORPH)) carry=(int)(d_r*(*(d3_l->extra+off)));
/* case neighbour amorph */
+ /*
+ *
+ * no diffusion between amorphous cells
+ *
else carry=(*(d3_l->extra+off)-*(d3_l->extra+offset))/2;
+ */
if(carry!=0)
{
*(d3_l->extra+offset)+=carry;
if(c!=0)
{
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;
/* case neighbour not amorph */
if(!(*(d3_l->status+off)&AMORPH))
{
return 1;
}
+int convert_file(char *cf,d3_lattice *d3_l)
+{
+ int x,y,z;
+ int c_fd;
+
+ if((c_fd=open(cf,O_WRONLY|O_CREAT))<0)
+ {
+ puts("cannot open convert file");
+ return -1;
+ }
+ dprintf(c_fd,"# created by nlsop (gnuplot format)\n");
+ for(x=0;x<d3_l->max_x;x++)
+ {
+ for(y=0;y<d3_l->max_y;y++)
+ {
+ for(z=0;z<d3_l->max_z;z++)
+ {
+ if(*(d3_l->status+x+y*d3_l->max_x+z*d3_l->max_x*d3_l->max_y)&AMORPH) dprintf(c_fd,"%d %d %d\n",x,y,z);
+ }
+ }
+ }
+ close(c_fd);
+
+ return 1;
+}
+
int main(int argc,char **argv)
{
u32 max_x,max_y,max_z,x,y,z,x_c,y_c,z_c;
int i,quit,escape,nowait;
- int refresh;
+ int refresh,resave;
char s_file[MAX_CHARS];
+ char s_file_tmp[MAX_CHARS];
char l_file[MAX_CHARS];
+ char c_file[MAX_CHARS];
+ char convert;
char r_file[MAX_CHARS];
char x_txt[MAX_TXT];
char y_txt[MAX_TXT];
my_info.steps=STEPS;
my_info.range=RANGE;
refresh=REFRESH;
+ resave=RESAVE;
my_info.a_el=A_EL;
my_info.b_el=B_EL;
my_info.a_cd=A_CD;
escape=0;
strcpy(s_file,"");
strcpy(l_file,"");
+ strcpy(c_file,"");
+ convert=0;
strcpy(r_file,"");
for(i=1;i<argc;i++)
my_info.cc=atoi(argv[++i]);
break;
*/
+ case 'W':
+ resave=atoi(argv[++i]);
+ break;
+ case 'C':
+ strcpy(l_file,argv[++i]);
+ if(i<argc-1) if(argv[i+1][0]!='-') strcpy(c_file,argv[++i]);
+ convert=1;
+ break;
case 'D':
my_info.d_r=atof(argv[++i]);
break;
} else
{
load_from_file(l_file,&d3_l,&my_info);
- d3_lattice_init(&argc,argv,&d3_l,d3_l.max_x,d3_l.max_y,d3_l.max_z);
+ if(convert)
+ {
+ if(!strcmp(c_file,"")) sprintf(c_file,"%s_gnuplot",l_file);
+ printf("converting file %s to %s\n",l_file,c_file);
+ convert_file(c_file,&d3_l);
+ puts("done");
+ return 1;
+ } else d3_lattice_init(&argc,argv,&d3_l,d3_l.max_x,d3_l.max_y,d3_l.max_z);
}
-
+
d3_event_init(&d3_l);
strcpy(a_txt,"args:");
d3_lattice_draw(&d3_l,x,y,z,24,arg_v);
// scan_event(&d3_l,&x,&y,&z,&quit,&escape);
}
+ if(i%resave==0 && strcmp(s_file,"") && resave!=0)
+ {
+ sprintf(s_file_tmp,"%s_%d_of_%d",s_file,i,my_info.steps);
+ save_to_file(s_file_tmp,&d3_l,&my_info);
+ }
i++;
}
}