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.
17 #include <sys/types.h>
21 /* important defines */
24 /* function prototypes */
28 /* global variables */
30 int random_fd; /* /dev/urandom file descriptor */
36 puts("-a <value> \t slope of nuclear energy loss (default 1)");
37 puts("-c <value> \t nuclear enery loss at depths 0 (default 0)");
38 puts("-x <value> \t # x cells (default 50)");
39 puts("-y <value> \t # y cells (default 50)");
40 puts("-z <value> \t # z cells (default 100)");
41 puts("-s <value> \t # steps to calculate (default 5000)");
42 puts("-X <value> \t display area intercept point x (default # x celss / 2)");
43 puts("-Y <value> \t display area intercept point y (default # y cells / 2)");
44 puts("-Z <value> \t display area intercept point z (default # z cells / 2)");
45 puts("-d <value> \t refresh every <value> loops (default 100)");
46 puts("-r <value> \t pressure range from amorphous SiCx (default 2)");
47 puts("-f <value> \t faktor for pressure from amorphous SiCx (default 1)");
51 int make_amorph(u32 *cell)
57 int make_cryst(u32 *cell)
63 /* look at cell ... */
64 int process_cell(void *cell_p,u32 x,u32 y,u32 z,u32 x_max,u32 y_max,u32 z_max,int range,int faktor)
70 cell=(u32 *)(cell_p+x+y*(x_max-1)+z*(x_max-1)*(y_max-1));
72 for(i=-range;i<=range;i++)
73 for(j=-range;j<=range;j++)
74 for(k=-range;k<=range;k++)
75 if(!(i==0 && j==0 && k==0) && (x>=range && x<x_max-range) \
76 && (y>=range && y<y_max-range) && (z>=range && z<z_max-range))
77 if(*(u32 *)(cell_p+(x+i)+(y+j)*(x_max-1)+(z+k)*(x_max-1)*(y_max-1))&AMORPH)
78 // total+=range*range-
79 count+=0.01*faktor*1.0/(i*i+j*j+k*k);
80 /* count is propability of cell getting amorph */
81 /* for now assume 1 - ~ is propability of cell getting cryst if allready amorphous */
84 if((1-count)*URAND_2_MAX<=rand_get(URAND_2_MAX))
86 printfd("cell getting cryst. ...(%f)\n",(1-count));
91 if(count*URAND_2_MAX<=rand_get(URAND_2_MAX))
93 printfd("cell getting amorph ...(%f)\n",count);
100 int main(int argc,char **argv)
102 u32 x_cell,y_cell,z_cell; /* amount of segments */
103 u32 x,y,z; /* cells */
104 int i; /* for counting */
105 int slope_nel,start_nel; /* nuclear energy loss: slope, constant */
106 int a_p_range,a_p_faktor; /* pressure range and faktor from amorphous sic */
107 int steps; /* # steps */
109 struct __display display;
110 u32 display_x,display_y,display_z; /* intercept point of diplayed areas */
111 u32 display_refresh_rate; /* refresh rate for display */
114 x_cell=DEFAULT_X_SEG;
115 y_cell=DEFAULT_Y_SEG;
116 z_cell=DEFAULT_Z_SEG;
117 slope_nel=DEFAULT_SLOPE_NEL;
118 start_nel=DEFAULT_START_NEL;
119 a_p_range=DEFAULT_A_P_RANGE;
120 a_p_faktor=DEFAULT_A_P_FAKTOR;
125 display_refresh_rate=DEFAULT_DISPLAY_REF_RATE;
127 /* parse command args */
139 slope_nel=atoi(argv[++i]);
142 start_nel=atoi(argv[++i]);
145 x_cell=atoi(argv[++i]);
148 y_cell=atoi(argv[++i]);
151 z_cell=atoi(argv[++i]);
154 steps=atoi(argv[++i]);
157 display_x=atoi(argv[++i]);
160 display_y=atoi(argv[++i]);
163 display_z=atoi(argv[++i]);
166 display_refresh_rate=atoi(argv[++i]);
169 a_p_range=atoi(argv[++i]);
172 a_p_faktor=atoi(argv[++i]);
182 if((random_fd=open("/dev/urandom",O_RDONLY))<0)
184 puts("cannot open /dev/urandom\n");
188 /* calculate sum_z_cells one time! */
190 for(i=1;i<=z_cell;i++) sum_z_cells+=(start_nel+i*slope_nel);
191 printfd("debug: sum z cells -> %d\n",sum_z_cells);
197 printf("malloc will free %d bytes now ...\n",x_cell*y_cell*z_cell*sizeof(u32));
198 if((cell_p=malloc(x_cell*y_cell*z_cell*sizeof(u32)))==NULL)
200 puts("failed allocating memory for cells\n");
203 memset(cell_p,0,x_cell*y_cell*z_cell*sizeof(u32));
206 display_init(x_cell,y_cell,z_cell,&display,cell_p,&argc,argv);
213 z=rand_get_lgp(slope_nel,start_nel);
216 // distrib_c_conc(cell_p);
218 // process_cell((u32 *)(cell_p+x+y*(x_cell-1)+z*(x_cell-1)*(y_cell-1)));
219 process_cell(cell_p,x,y,z,x_cell,y_cell,z_cell,a_p_range,a_p_faktor);
222 if((i%display_refresh_rate)==0)
223 display_draw(&display,display_x,display_y,display_z);
226 /* display again and quit when button hit */
227 display_draw(&display,display_x,display_y,display_z);
228 puts("hit button to quit ...");
231 display_release(&display);