4 * this program tries helping to understand the amorphous depuration
5 * and recrystallization of SiCx while ion implanation. hopefully the program
6 * will simulate the stabilization of the selforganizing structure in the
10 * - J. K. N. Lindner. Habilationsschrift, Universitaet Augsburg.
11 * - Maik Haeberlen. Diplomarbeit, Universitaet Augsburg.
18 #include <sys/types.h>
28 #define MAKE_AMORPH(N) *(N)|=AMORPH
29 #define MAKE_CRYST(N) *(N)&=~AMORPH
35 puts("-n \t\t no user interaction");
36 printf("-a <value> \t slope of nuclear energy loss (default %f)\n",A_EL);
37 printf("-b <value> \t nuclear energy loss offset (default %f)\n",B_EL);
38 printf("-x <value> \t # x cells (default %d)\n",X);
39 printf("-y <value> \t # x cells (default %d)\n",Y);
40 printf("-z <value> \t # x cells (default %d)\n",Z);
41 printf("-X <value> \t display x (default %d)\n",X/2-1);
42 printf("-Y <value> \t display y (default %d)\n",Y/2-1);
43 printf("-Z <value> \t display z (default %d)\n",Z/2-1);
44 printf("-s <value> \t steps (default %d)\n",STEPS);
45 printf("-d <value> \t refresh display (default %d)\n",REFRESH);
46 printf("-r <value> \t amorphous influence range (default %d)\n",RANGE);
47 printf("-f <value> \t pressure = <value> * 1/distance^2 (default %f)\n",A_AP);
48 printf("-p <value> \t pressure offset (default %f)\n",B_AP);
49 printf("-A <value> \t slope of linear c distribution (default %f)\n",A_CD);
50 printf("-B <value> \t linear c distribution offset (default %f)\n",B_CD);
51 printf("-C <value> \t initial c concentration (default %d)\n",CC);
52 puts("-L <file> \t load from file");
53 puts("-S <file> \t save to file");
54 puts("-R <file> \t read from random file");
59 int process_cell(3d_lattice *3d_l,u32 x,u32 y,u32 z,int r,double a,double b,int *t_c)
66 thiz=3d_l->status+x+y*d3_l->max_x+z*d3_l->max_x*d3_l->max_y;
67 conc=3d_l->extra+x+y*d3_l->max_x+z*d3_l->max_x*d3_l->max_y;
75 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);
82 if(rand_get(URAND_MAX)<=p)
89 /* assume 1-p probability */
90 if(rand_get(URAND_MAX)>p)
100 int distrib_c(3d_lattice *3d_l,int t_c,double a,double b)
102 int i,j,k,total,area,sum;
107 area=d3_l->max_x*d3_l->max_y;
108 area_h=(int *)malloc(d3_l->max_z*sizeof(int));
112 for(i=0;i<d3_l->max_z;i++)
117 if(!(*(d3_l->status+(i*area)+j)&AMORPH))
124 for(i=0;i<d3_l->max_z;i++)
126 temp=((i+1)*a+b)*t_c/(sum+area_h[i]);
131 if(!(*(d3_l->status+(i*area)+j)&AMORPH))
133 *(d3_l->extra+(i*area)+j)=temp;
138 left=(((i+1)*a+b)*t_c/sum)%area_h[i];
141 x=get_rand(d3_l->max_x);
142 y=get_rand(d3_l->max_y);
143 if(!(*(d3_l->status+(i*area)+x+y*d3_l->max_x)&AMORPH))
145 *(d3_l->extra+(i*area)+x+y*d3_l->max_x)+=1;
153 x=get_rand(d3_l->max_x);
154 y=get_rand(d3_l->max_y);
155 z=get_rand_lgp(d3_l->max_z,a,b);
156 if(!(*(d3_l->status+x+y*d3_l->max_x+z*d3_l->max_x*d3_l->max_y)&AMORPH))
158 *(d3_l->extra+x+y*d3_l->max_x+z*d3_l->max_x*d3_l->max_y)+=1;
167 int main(int argc,char **argv)
169 u32 max_x,max_y,max_z,x,y,z,x_c,y_c,z_c;
170 int i,quit,escape,nowait;
171 double a_el,b_el,a_cd,b_cd,a_ap,b_ap;
172 int cc,steps,range,refresh;
173 char s_file[MAX_CHARS];
174 char l_file[MAX_CHARS];
175 char r_file[MAX_CHARS];
212 a_el=atof(argv[++i]);
215 b_el=atof(argv[++i]);
218 max_x=atoi(argv[++i]);
221 max_y=atoi(argv[++i]);
224 max_z=atoi(argv[++i]);
236 steps=atoi(argv[++i]);
239 refresh=atoi(argv[++i]);
242 range=atoi(argv[++i]);
245 a_ap=atof(argv[++i]);
248 b_ap=atof(argv[++i]);
251 a_cd=atof(argv[++i]);
254 b_cd=atof(argv[++i]);
260 strcpy(l_file,argv[++i]);
263 strcpy(s_file,argv[++i]);
266 strcpy(r_file,argv[++i]);