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"
28 int a_count; /* atom count */
29 u8 quit; /* quit mark */
34 int hook(void *moldyn,void *hook_params) {
51 /* switch on t scaling */
52 if(md->schedule.count==0)
53 set_pt_scale(md,0,0,T_SCALE_BERENDSEN,100.0);
55 /* last schedule add if there is enough carbon inside */
56 if(hp->a_count==(INJECT*NR_ATOMS)) {
58 moldyn_add_schedule(md,10000,1.0);
62 /* more relaxing time for too high temperatures */
63 if(md->t-md->t_ref>TC) {
64 moldyn_add_schedule(md,100,1.0);
68 /* inject carbon atoms */
69 printf("injecting another 10 carbon atoms ...\n");
70 for(j=0;j<NR_ATOMS;j++) {
73 r.x=rand_get_double(&(md->random))*md->dim.x*0.37;
74 r.y=rand_get_double(&(md->random))*md->dim.y*0.37;
75 r.z=rand_get_double(&(md->random))*md->dim.z*0.37;
76 for(i=0;i<md->count;i++) {
78 v3_sub(&dist,&(atom->r),&r);
79 d=v3_absolute_square(&dist);
86 ATOM_ATTR_1BP|ATOM_ATTR_2BP|ATOM_ATTR_3BP|ATOM_ATTR_HB,
89 hp->a_count+=NR_ATOMS;
91 /* add schedule for simulating injected atoms ;) */
92 moldyn_add_schedule(md,100,1.0);
97 int main(int argc,char **argv) {
101 printf("[sic] usage: %s <logdir> <temperatur>\n",argv[0]);
105 /* main moldyn structure */
108 /* hook parameter structure */
111 /* potential parameters */
112 t_tersoff_mult_params tp;
113 t_albe_mult_params ap;
115 /* atom injection counter */
118 /* testing location & velocity vector */
120 memset(&r,0,sizeof(t_3dvec));
121 memset(&v,0,sizeof(t_3dvec));
123 /* initialize moldyn */
124 moldyn_init(&md,argc,argv);
126 /* choose integration algorithm */
127 set_int_alg(&md,MOLDYN_INTEGRATE_VERLET);
129 /* choose potential */
131 set_potential3b_j1(&md,albe_mult_3bp_j1);
132 set_potential3b_k1(&md,albe_mult_3bp_k1);
133 set_potential3b_j2(&md,albe_mult_3bp_j2);
134 set_potential3b_k2(&md,albe_mult_3bp_k2);
136 set_potential1b(&md,tersoff_mult_1bp);
137 set_potential3b_j1(&md,tersoff_mult_3bp_j1);
138 set_potential3b_k1(&md,tersoff_mult_3bp_k1);
139 set_potential3b_j2(&md,tersoff_mult_3bp_j2);
140 set_potential3b_k2(&md,tersoff_mult_3bp_k2);
144 set_potential_params(&md,&ap);
146 set_potential_params(&md,&tp);
151 set_cutoff(&md,ALBE_S_SI);
153 set_cutoff(&md,TM_S_SI);
157 * potential parameters
161 * tersoff mult potential parameters for SiC
167 tp.lambda[0]=TM_LAMBDA_SI;
169 tp.beta[0]=TM_BETA_SI;
179 tp.lambda[1]=TM_LAMBDA_C;
181 tp.beta[1]=TM_BETA_C;
189 tersoff_mult_complete_params(&tp);
192 * albe mult potential parameters for SiC
199 ap.lambda[0]=ALBE_LAMBDA_SI;
201 ap.gamma[0]=ALBE_GAMMA_SI;
211 ap.lambda[1]=ALBE_LAMBDA_C;
213 ap.gamma[1]=ALBE_GAMMA_C;
218 ap.Smixed=ALBE_S_SIC;
219 ap.Rmixed=ALBE_R_SIC;
220 ap.Amixed=ALBE_A_SIC;
221 ap.Bmixed=ALBE_B_SIC;
222 ap.r0_mixed=ALBE_R0_SIC;
223 ap.lambda_m=ALBE_LAMBDA_SIC;
225 ap.gamma_m=ALBE_GAMMA_SIC;
226 ap.c_mixed=ALBE_C_SIC;
227 ap.d_mixed=ALBE_D_SIC;
228 ap.h_mixed=ALBE_H_SIC;
230 albe_mult_complete_params(&ap);
232 /* set (initial) dimensions of simulation volume */
234 set_dim(&md,20*ALBE_LC_SI,20*ALBE_LC_SI,20*ALBE_LC_SI,TRUE);
235 //set_dim(&md,8*ALBE_LC_C,8*ALBE_LC_C,8*ALBE_LC_C,TRUE);
236 //set_dim(&md,8*ALBE_LC_SIC,8*ALBE_LC_SIC,8*ALBE_LC_SIC,TRUE);
238 //set_dim(&md,8*LC_SI,8*LC_SI,8*LC_SI,TRUE);
239 //set_dim(&md,8*LC_C,8*LC_C,8*LC_C,TRUE);
240 set_dim(&md,8*TM_LC_SIC,8*TM_LC_SIC,8*TM_LC_SIC,TRUE);
243 /* set periodic boundary conditions in all directions */
244 set_pbc(&md,TRUE,TRUE,TRUE);
246 /* create the lattice / place atoms */
248 create_lattice(&md,DIAMOND,ALBE_LC_SI,SI,M_SI,
249 //create_lattice(&md,DIAMOND,ALBE_LC_C,C,M_C,
251 //create_lattice(&md,DIAMOND,LC_SI,SI,M_SI,
253 ATOM_ATTR_1BP|ATOM_ATTR_2BP|ATOM_ATTR_3BP|ATOM_ATTR_HB,
254 // ATOM_ATTR_2BP|ATOM_ATTR_HB,
258 /* create zinkblende structure */
261 r.x=0.5*0.25*ALBE_LC_SIC; r.y=r.x; r.z=r.x;
262 create_lattice(&md,FCC,ALBE_LC_SIC,SI,M_SI,
263 ATOM_ATTR_1BP|ATOM_ATTR_2BP|ATOM_ATTR_3BP|ATOM_ATTR_HB,
265 r.x+=0.25*ALBE_LC_SIC; r.y=r.x; r.z=r.x;
266 create_lattice(&md,FCC,ALBE_LC_SIC,C,M_C,
267 ATOM_ATTR_1BP|ATOM_ATTR_2BP|ATOM_ATTR_3BP|ATOM_ATTR_HB,
270 r.x=0.5*0.25*TM_LC_SIC; r.y=r.x; r.z=r.x;
271 create_lattice(&md,FCC,TM_LC_SIC,SI,M_SI,
272 ATOM_ATTR_1BP|ATOM_ATTR_2BP|ATOM_ATTR_3BP|ATOM_ATTR_HB,
274 r.x+=0.25*TM_LC_SIC; r.y=r.x; r.z=r.x;
275 create_lattice(&md,FCC,TM_LC_SIC,C,M_C,
276 ATOM_ATTR_1BP|ATOM_ATTR_2BP|ATOM_ATTR_3BP|ATOM_ATTR_HB,
281 /* check for right atom placing */
282 moldyn_bc_check(&md);
284 /* testing configuration */
285 //r.x=0.27*sqrt(3.0)*LC_SI/2.0; v.x=0;
286 //r.x=(TM_S_SI+TM_R_SI)/4.0; v.x=0;
289 //add_atom(&md,SI,M_SI,0,
290 // ATOM_ATTR_1BP|ATOM_ATTR_2BP|ATOM_ATTR_3BP|ATOM_ATTR_HB,
291 // ATOM_ATTR_2BP|ATOM_ATTR_HB,
293 //r.x=-r.x; v.x=-v.x;
296 //add_atom(&md,SI,M_SI,0,
297 // ATOM_ATTR_1BP|ATOM_ATTR_2BP|ATOM_ATTR_3BP|ATOM_ATTR_HB,
298 // ATOM_ATTR_2BP|ATOM_ATTR_HB,
300 //r.z=0.27*sqrt(3.0)*LC_SI/2.0; v.z=0;
301 //r.x=(TM_S_SI+TM_R_SI)/4.0; v.x=0;
304 //add_atom(&md,SI,M_SI,0,
305 // ATOM_ATTR_1BP|ATOM_ATTR_2BP|ATOM_ATTR_3BP|ATOM_ATTR_HB,
306 // ATOM_ATTR_2BP|ATOM_ATTR_HB,
308 //r.z=-r.z; v.z=-v.z;
311 //add_atom(&md,SI,M_SI,0,
312 // ATOM_ATTR_1BP|ATOM_ATTR_2BP|ATOM_ATTR_3BP|ATOM_ATTR_HB,
313 // ATOM_ATTR_2BP|ATOM_ATTR_HB,
316 /* set temperature & pressure */
317 set_temperature(&md,atof(argv[2])+273.0);
318 set_pressure(&md,BAR);
320 /* set amount of steps to skip before average calc */
321 set_avg_skip(&md,500);
323 /* set p/t scaling */
324 //set_pt_scale(&md,0,0,T_SCALE_BERENDSEN,100.0);
325 //set_pt_scale(&md,P_SCALE_BERENDSEN,0.001,
326 // T_SCALE_BERENDSEN,100.0);
327 //set_pt_scale(&md,0,0,T_SCALE_DIRECT,1.0);
328 //set_pt_scale(&md,P_SCALE_BERENDSEN,0.001,0,0);
330 /* initial thermal fluctuations of particles (in equilibrium) */
331 thermal_init(&md,TRUE);
333 /* create the simulation schedule */
334 moldyn_add_schedule(&md,1000,1.0);
335 //moldyn_add_schedule(&md,1000,1.0);
336 //moldyn_add_schedule(&md,1000,1.0);
337 //moldyn_add_schedule(&md,1000,1.0);
338 //moldyn_add_schedule(&md,1000,1.0);
339 //moldyn_add_schedule(&md,1000,1.0);
341 //for(inject=0;inject<INJECT;inject++) {
342 // /* injecting atoms */
343 // moldyn_add_schedule(&md,10,1.0);
346 /* schedule hook function */
347 memset(&hookparam,0,sizeof(t_hp));
348 moldyn_set_schedule_hook(&md,&hook,&hookparam);
350 /* activate logging */
351 moldyn_set_log_dir(&md,argv[1]);
352 moldyn_set_report(&md,"Frank Zirkelbach","Test 1");
353 moldyn_set_log(&md,LOG_TOTAL_ENERGY,1);
354 moldyn_set_log(&md,LOG_TEMPERATURE,1);
355 moldyn_set_log(&md,LOG_PRESSURE,1);
356 moldyn_set_log(&md,VISUAL_STEP,100);
357 moldyn_set_log(&md,SAVE_STEP,100);
358 moldyn_set_log(&md,CREATE_REPORT,0);
361 * let's do the actual md algorithm now
363 * integration of newtons equations
365 moldyn_integrate(&md);
371 * post processing the data
375 moldyn_shutdown(&md);