2 * sic.c - investigation of the sic precipitation process of silicon carbide
4 * author: Frank Zirkelbach <frank.zirkelbach@physik.uni-augsburg.de>
14 #include "potentials/harmonic_oscillator.h"
15 #include "potentials/lennard_jones.h"
16 #include "potentials/albe.h"
19 #include "potentials/tersoff_orig.h"
21 #include "potentials/tersoff.h"
29 //#define INJ_LENX (1*ALBE_LC_SIC)
30 //#define INJ_LENY (1*ALBE_LC_SIC)
31 //#define INJ_LENZ (1*ALBE_LC_SIC)
32 #define INJ_LENX (1*ALBE_LC_SI)
33 #define INJ_LENY (1*ALBE_LC_SI)
34 #define INJ_LENZ (1*ALBE_LC_SI)
35 #define INJ_TYPE_SILICON
36 //#define INJ_TYPE_CARBON
37 #define INJ_OFFSET (ALBE_LC_SI/8.0)
46 #define R_TITLE "Silicon self-interstitial"
54 int a_count; /* atom count */
55 u8 quit; /* quit mark */
56 int argc; /* arg count */
57 char **argv; /* args */
60 int hook(void *moldyn,void *hook_params) {
77 /* switch on t scaling */
78 if(md->schedule.count==0)
79 set_pt_scale(md,0,0,T_SCALE_BERENDSEN,100.0);
81 /* last schedule add if there is enough carbon inside */
82 if(hp->a_count==(INJECT*NR_ATOMS)) {
84 moldyn_add_schedule(md,POSTRUN,1.0);
88 /* more relaxing time for too high temperatures */
89 if(md->t-md->t_ref>T_C) {
90 moldyn_add_schedule(md,RELAX_S,1.0);
94 /* inject carbon atoms */
95 printf("injecting another %d atoms ... (-> %d / %d)\n",
96 NR_ATOMS,hp->a_count+NR_ATOMS,INJECT*NR_ATOMS);
97 for(j=0;j<NR_ATOMS;j++) {
100 r.x=(rand_get_double(&(md->random))-0.5)*INJ_LENX;
102 r.y=(rand_get_double(&(md->random))-0.5)*INJ_LENY;
104 r.z=(rand_get_double(&(md->random))-0.5)*INJ_LENZ;
106 /* assume valid coordinates */
108 for(i=0;i<md->count;i++) {
110 v3_sub(&dist,&(atom->r),&r);
111 d=v3_absolute_square(&dist);
112 /* reject coordinates */
120 #ifdef INJ_TYPE_CARBON
123 add_atom(md,SI,M_SI,0,
125 ATOM_ATTR_1BP|ATOM_ATTR_2BP|ATOM_ATTR_3BP|ATOM_ATTR_HB,
128 hp->a_count+=NR_ATOMS;
130 /* add schedule for simulating injected atoms ;) */
131 moldyn_add_schedule(md,RELAX_S,1.0);
136 int main(int argc,char **argv) {
140 // printf("[sic] usage: %s <logdir> <temperatur>\n",argv[0]);
144 /* main moldyn structure */
147 /* hook parameter structure */
150 /* potential parameters */
151 t_tersoff_mult_params tp;
152 t_albe_mult_params ap;
154 /* testing location & velocity vector */
156 memset(&r,0,sizeof(t_3dvec));
157 memset(&v,0,sizeof(t_3dvec));
159 /* initialize moldyn */
160 moldyn_init(&md,argc,argv);
162 /* choose integration algorithm */
163 set_int_alg(&md,MOLDYN_INTEGRATE_VERLET);
165 /* choose potential */
167 set_potential3b_j1(&md,albe_mult_3bp_j1);
168 set_potential3b_k1(&md,albe_mult_3bp_k1);
169 set_potential3b_j2(&md,albe_mult_3bp_j2);
170 set_potential3b_k2(&md,albe_mult_3bp_k2);
172 set_potential1b(&md,tersoff_mult_1bp);
173 set_potential3b_j1(&md,tersoff_mult_3bp_j1);
174 set_potential3b_k1(&md,tersoff_mult_3bp_k1);
175 set_potential3b_j2(&md,tersoff_mult_3bp_j2);
176 set_potential3b_k2(&md,tersoff_mult_3bp_k2);
180 set_potential_params(&md,&ap);
182 set_potential_params(&md,&tp);
187 set_cutoff(&md,ALBE_S_SI);
188 //set_cutoff(&md,ALBE_S_C);
190 set_cutoff(&md,TM_S_SI);
191 //set_cutoff(&md,TM_S_C);
195 * potential parameters
199 * tersoff mult potential parameters for SiC
205 tp.lambda[0]=TM_LAMBDA_SI;
207 tp.beta[0]=TM_BETA_SI;
217 tp.lambda[1]=TM_LAMBDA_C;
219 tp.beta[1]=TM_BETA_C;
227 tersoff_mult_complete_params(&tp);
230 * albe mult potential parameters for SiC
237 ap.lambda[0]=ALBE_LAMBDA_SI;
239 ap.gamma[0]=ALBE_GAMMA_SI;
249 ap.lambda[1]=ALBE_LAMBDA_C;
251 ap.gamma[1]=ALBE_GAMMA_C;
256 ap.Smixed=ALBE_S_SIC;
257 ap.Rmixed=ALBE_R_SIC;
258 ap.Amixed=ALBE_A_SIC;
259 ap.Bmixed=ALBE_B_SIC;
260 ap.r0_mixed=ALBE_R0_SIC;
261 ap.lambda_m=ALBE_LAMBDA_SIC;
263 ap.gamma_m=ALBE_GAMMA_SIC;
264 ap.c_mixed=ALBE_C_SIC;
265 ap.d_mixed=ALBE_D_SIC;
266 ap.h_mixed=ALBE_H_SIC;
268 albe_mult_complete_params(&ap);
270 /* set (initial) dimensions of simulation volume */
272 set_dim(&md,LCNTX*ALBE_LC_SI,LCNTY*ALBE_LC_SI,LCNTZ*ALBE_LC_SI,TRUE);
273 //set_dim(&md,LCNTX*ALBE_LC_C,LCNTY*ALBE_LC_C,LCNTZ*ALBE_LC_C,TRUE);
274 //set_dim(&md,LCNTX*ALBE_LC_SIC,LCNTY*ALBE_LC_SIC,LCNTZ*ALBE_LC_SIC,TRUE);
276 set_dim(&md,LCNTX*LC_SI,LCNTY*LC_SI,LCNTZ*LC_SI,TRUE);
277 //set_dim(&md,LCNTX*LC_C,LCNTY*LC_C,LCNTZ*LC_C,TRUE);
278 //set_dim(&md,LCNTX*TM_LC_SIC,LCNTY*TM_LC_SIC,LCNTZ*TM_LC_SIC,TRUE);
281 /* set periodic boundary conditions in all directions */
282 set_pbc(&md,TRUE,TRUE,TRUE);
284 /* create the lattice / place atoms */
286 create_lattice(&md,DIAMOND,ALBE_LC_SI,SI,M_SI,
287 //create_lattice(&md,DIAMOND,ALBE_LC_C,C,M_C,
289 create_lattice(&md,DIAMOND,LC_SI,SI,M_SI,
291 ATOM_ATTR_1BP|ATOM_ATTR_2BP|ATOM_ATTR_3BP|ATOM_ATTR_HB,
292 // ATOM_ATTR_2BP|ATOM_ATTR_HB,
293 0,LCNTX,LCNTY,LCNTZ,NULL);
294 // 1,LCNTX,LCNTY,LCNTZ,NULL);
296 /* create zinkblende structure */
299 r.x=0.5*0.25*ALBE_LC_SIC; r.y=r.x; r.z=r.x;
300 create_lattice(&md,FCC,ALBE_LC_SIC,SI,M_SI,
301 ATOM_ATTR_1BP|ATOM_ATTR_2BP|ATOM_ATTR_3BP|ATOM_ATTR_HB,
302 0,LCNTX,LCNTY,LCNTZ,&r);
303 r.x+=0.25*ALBE_LC_SIC; r.y=r.x; r.z=r.x;
304 create_lattice(&md,FCC,ALBE_LC_SIC,C,M_C,
305 ATOM_ATTR_1BP|ATOM_ATTR_2BP|ATOM_ATTR_3BP|ATOM_ATTR_HB,
306 1,LCNTX,LCNTY,LCNTZ,&r);
308 r.x=0.5*0.25*TM_LC_SIC; r.y=r.x; r.z=r.x;
309 create_lattice(&md,FCC,TM_LC_SIC,SI,M_SI,
310 ATOM_ATTR_1BP|ATOM_ATTR_2BP|ATOM_ATTR_3BP|ATOM_ATTR_HB,
311 0,LCNTX,LCNTY,LCNTZ,&r);
312 r.x+=0.25*TM_LC_SIC; r.y=r.x; r.z=r.x;
313 create_lattice(&md,FCC,TM_LC_SIC,C,M_C,
314 ATOM_ATTR_1BP|ATOM_ATTR_2BP|ATOM_ATTR_3BP|ATOM_ATTR_HB,
315 1,LCNTX,LCNTY,LCNTZ,&r);
319 /* check for right atom placing */
320 moldyn_bc_check(&md);
322 /* testing configuration */
323 //r.x=0.27*sqrt(3.0)*LC_SI/2.0; v.x=0;
324 //r.x=(TM_S_SI+TM_R_SI)/4.0; v.x=0;
327 //add_atom(&md,SI,M_SI,0,
328 // ATOM_ATTR_1BP|ATOM_ATTR_2BP|ATOM_ATTR_3BP|ATOM_ATTR_HB,
329 // ATOM_ATTR_2BP|ATOM_ATTR_HB,
331 //r.x=-r.x; v.x=-v.x;
334 //add_atom(&md,SI,M_SI,0,
335 // ATOM_ATTR_1BP|ATOM_ATTR_2BP|ATOM_ATTR_3BP|ATOM_ATTR_HB,
336 // ATOM_ATTR_2BP|ATOM_ATTR_HB,
338 //r.z=0.27*sqrt(3.0)*LC_SI/2.0; v.z=0;
339 //r.x=(TM_S_SI+TM_R_SI)/4.0; v.x=0;
342 //add_atom(&md,SI,M_SI,0,
343 // ATOM_ATTR_1BP|ATOM_ATTR_2BP|ATOM_ATTR_3BP|ATOM_ATTR_HB,
344 // ATOM_ATTR_2BP|ATOM_ATTR_HB,
346 //r.z=-r.z; v.z=-v.z;
349 //add_atom(&md,SI,M_SI,0,
350 // ATOM_ATTR_1BP|ATOM_ATTR_2BP|ATOM_ATTR_3BP|ATOM_ATTR_HB,
351 // ATOM_ATTR_2BP|ATOM_ATTR_HB,
354 /* set temperature & pressure */
355 set_temperature(&md,atof(argv[2])+273.0);
356 set_pressure(&md,BAR);
358 /* set amount of steps to skip before average calc */
359 set_avg_skip(&md,(8.0/10.0*PRERUN));
361 /* set p/t scaling */
362 //set_pt_scale(&md,0,0,T_SCALE_BERENDSEN,100.0);
363 //set_pt_scale(&md,P_SCALE_BERENDSEN,0.001,
364 // T_SCALE_BERENDSEN,100.0);
365 //set_pt_scale(&md,0,0,T_SCALE_DIRECT,1.0);
366 //set_pt_scale(&md,P_SCALE_BERENDSEN,0.001,0,0);
368 /* initial thermal fluctuations of particles (in equilibrium) */
369 thermal_init(&md,TRUE);
371 /* create the simulation schedule */
372 moldyn_add_schedule(&md,PRERUN,1.0);
374 /* schedule hook function */
375 memset(&hookparam,0,sizeof(t_hp));
378 moldyn_set_schedule_hook(&md,&hook,&hookparam);
380 /* activate logging */
381 moldyn_set_log_dir(&md,argv[1]);
382 moldyn_set_report(&md,"Frank Zirkelbach",R_TITLE);
383 moldyn_set_log(&md,LOG_TOTAL_ENERGY,LOG_E);
384 moldyn_set_log(&md,LOG_TEMPERATURE,LOG_T);
385 moldyn_set_log(&md,LOG_PRESSURE,LOG_P);
386 moldyn_set_log(&md,VISUAL_STEP,LOG_V);
387 moldyn_set_log(&md,SAVE_STEP,LOG_S);
388 moldyn_set_log(&md,CREATE_REPORT,0);
391 * let's do the actual md algorithm now
393 * integration of newtons equations
395 moldyn_integrate(&md);
401 * post processing the data
405 moldyn_shutdown(&md);