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"
27 int hook(void *moldyn,void *hook_params) {
38 if(!(md->schedule.count%2)) {
39 /* add carbon at random place, and enable t scaling */
40 for(j=0;j<NR_ATOMS;j++) {
43 r.x=rand_get_double(&(md->random))*md->dim.x;
44 r.y=rand_get_double(&(md->random))*md->dim.y;
45 r.z=rand_get_double(&(md->random))*md->dim.z;
46 for(i=0;i<md->count;i++) {
48 v3_sub(&dist,&(atom->r),&r);
49 d=v3_absolute_square(&dist);
56 ATOM_ATTR_1BP|ATOM_ATTR_2BP|ATOM_ATTR_3BP|ATOM_ATTR_HB,
59 printf("adding atoms & enable t scaling\n");
60 set_pt_scale(md,0,0,T_SCALE_BERENDSEN,100.0);
63 /* disable t scaling */
64 printf("disabling t scaling\n");
65 set_pt_scale(md,0,0,0,0);
71 int main(int argc,char **argv) {
75 printf("[sic] usage: %s <logdir> <temperatur>\n",argv[0]);
79 /* main moldyn structure */
82 /* potential parameters */
83 t_tersoff_mult_params tp;
84 t_albe_mult_params ap;
86 /* atom injection counter */
89 /* testing location & velocity vector */
91 memset(&r,0,sizeof(t_3dvec));
92 memset(&v,0,sizeof(t_3dvec));
94 /* initialize moldyn */
95 moldyn_init(&md,argc,argv);
97 /* choose integration algorithm */
98 set_int_alg(&md,MOLDYN_INTEGRATE_VERLET);
100 /* choose potential */
102 set_potential3b_j1(&md,albe_mult_3bp_j1);
103 set_potential3b_k1(&md,albe_mult_3bp_k1);
104 set_potential3b_j2(&md,albe_mult_3bp_j2);
105 set_potential3b_k2(&md,albe_mult_3bp_k2);
107 set_potential1b(&md,tersoff_mult_1bp);
108 set_potential3b_j1(&md,tersoff_mult_3bp_j1);
109 set_potential3b_k1(&md,tersoff_mult_3bp_k1);
110 set_potential3b_j2(&md,tersoff_mult_3bp_j2);
111 set_potential3b_k2(&md,tersoff_mult_3bp_k2);
115 set_potential_params(&md,&ap);
117 set_potential_params(&md,&tp);
122 set_cutoff(&md,ALBE_S_SI);
124 set_cutoff(&md,TM_S_SI);
128 * potential parameters
132 * tersoff mult potential parameters for SiC
138 tp.lambda[0]=TM_LAMBDA_SI;
140 tp.beta[0]=TM_BETA_SI;
150 tp.lambda[1]=TM_LAMBDA_C;
152 tp.beta[1]=TM_BETA_C;
160 tersoff_mult_complete_params(&tp);
163 * albe mult potential parameters for SiC
170 ap.lambda[0]=ALBE_LAMBDA_SI;
172 ap.gamma[0]=ALBE_GAMMA_SI;
182 ap.lambda[1]=ALBE_LAMBDA_C;
184 ap.gamma[1]=ALBE_GAMMA_C;
189 ap.Smixed=ALBE_S_SIC;
190 ap.Rmixed=ALBE_R_SIC;
191 ap.Amixed=ALBE_A_SIC;
192 ap.Bmixed=ALBE_B_SIC;
193 ap.r0_mixed=ALBE_R0_SIC;
194 ap.lambda_m=ALBE_LAMBDA_SIC;
196 ap.gamma_m=ALBE_GAMMA_SIC;
197 ap.c_mixed=ALBE_C_SIC;
198 ap.d_mixed=ALBE_D_SIC;
199 ap.h_mixed=ALBE_H_SIC;
201 albe_mult_complete_params(&ap);
203 /* set (initial) dimensions of simulation volume */
205 //set_dim(&md,8*ALBE_LC_SI,8*ALBE_LC_SI,8*ALBE_LC_SI,TRUE);
206 //set_dim(&md,8*ALBE_LC_C,8*ALBE_LC_C,8*ALBE_LC_C,TRUE);
207 set_dim(&md,8*ALBE_LC_SIC,8*ALBE_LC_SIC,8*ALBE_LC_SIC,TRUE);
209 //set_dim(&md,8*LC_SI,8*LC_SI,8*LC_SI,TRUE);
210 //set_dim(&md,8*LC_C,8*LC_C,8*LC_C,TRUE);
211 set_dim(&md,8*TM_LC_SIC,8*TM_LC_SIC,8*TM_LC_SIC,TRUE);
214 /* set periodic boundary conditions in all directions */
215 set_pbc(&md,TRUE,TRUE,TRUE);
217 /* create the lattice / place atoms */
219 //create_lattice(&md,DIAMOND,ALBE_LC_SI,SI,M_SI,
220 //create_lattice(&md,DIAMOND,ALBE_LC_C,C,M_C,
222 //create_lattice(&md,DIAMOND,LC_SI,SI,M_SI,
224 // ATOM_ATTR_1BP|ATOM_ATTR_2BP|ATOM_ATTR_3BP|ATOM_ATTR_HB,
225 // ATOM_ATTR_2BP|ATOM_ATTR_HB,
229 /* create zinkblende structure */
232 r.x=0.5*0.25*ALBE_LC_SIC; r.y=r.x; r.z=r.x;
233 create_lattice(&md,FCC,ALBE_LC_SIC,SI,M_SI,
234 ATOM_ATTR_1BP|ATOM_ATTR_2BP|ATOM_ATTR_3BP|ATOM_ATTR_HB,
236 r.x+=0.25*ALBE_LC_SIC; r.y=r.x; r.z=r.x;
237 create_lattice(&md,FCC,ALBE_LC_SIC,C,M_C,
238 ATOM_ATTR_1BP|ATOM_ATTR_2BP|ATOM_ATTR_3BP|ATOM_ATTR_HB,
241 r.x=0.5*0.25*TM_LC_SIC; r.y=r.x; r.z=r.x;
242 create_lattice(&md,FCC,TM_LC_SIC,SI,M_SI,
243 ATOM_ATTR_1BP|ATOM_ATTR_2BP|ATOM_ATTR_3BP|ATOM_ATTR_HB,
245 r.x+=0.25*TM_LC_SIC; r.y=r.x; r.z=r.x;
246 create_lattice(&md,FCC,TM_LC_SIC,C,M_C,
247 ATOM_ATTR_1BP|ATOM_ATTR_2BP|ATOM_ATTR_3BP|ATOM_ATTR_HB,
252 /* check for right atom placing */
253 moldyn_bc_check(&md);
255 /* testing configuration */
256 //r.x=0.27*sqrt(3.0)*LC_SI/2.0; v.x=0;
257 //r.x=(TM_S_SI+TM_R_SI)/4.0; v.x=0;
260 //add_atom(&md,SI,M_SI,0,
261 // ATOM_ATTR_1BP|ATOM_ATTR_2BP|ATOM_ATTR_3BP|ATOM_ATTR_HB,
262 // ATOM_ATTR_2BP|ATOM_ATTR_HB,
264 //r.x=-r.x; v.x=-v.x;
267 //add_atom(&md,SI,M_SI,0,
268 // ATOM_ATTR_1BP|ATOM_ATTR_2BP|ATOM_ATTR_3BP|ATOM_ATTR_HB,
269 // ATOM_ATTR_2BP|ATOM_ATTR_HB,
271 //r.z=0.27*sqrt(3.0)*LC_SI/2.0; v.z=0;
272 //r.x=(TM_S_SI+TM_R_SI)/4.0; v.x=0;
275 //add_atom(&md,SI,M_SI,0,
276 // ATOM_ATTR_1BP|ATOM_ATTR_2BP|ATOM_ATTR_3BP|ATOM_ATTR_HB,
277 // ATOM_ATTR_2BP|ATOM_ATTR_HB,
279 //r.z=-r.z; v.z=-v.z;
282 //add_atom(&md,SI,M_SI,0,
283 // ATOM_ATTR_1BP|ATOM_ATTR_2BP|ATOM_ATTR_3BP|ATOM_ATTR_HB,
284 // ATOM_ATTR_2BP|ATOM_ATTR_HB,
287 /* set temperature & pressure */
288 set_temperature(&md,atof(argv[2])+273.0);
289 set_pressure(&md,BAR);
291 /* set amount of steps to skip before average calc */
292 set_avg_skip(&md,1000);
294 /* set p/t scaling */
295 //set_pt_scale(&md,0,0,T_SCALE_BERENDSEN,100.0);
296 //set_pt_scale(&md,P_SCALE_BERENDSEN,0.001,
297 // T_SCALE_BERENDSEN,100.0);
298 //set_pt_scale(&md,0,0,T_SCALE_dIRECT,1.0);
299 //set_pt_scale(&md,P_SCALE_BERENDSEN,0.001,0,0);
301 /* initial thermal fluctuations of particles (in equilibrium) */
302 thermal_init(&md,TRUE);
304 /* create the simulation schedule */
305 /* initial configuration */
306 moldyn_add_schedule(&md,10000,1.0);
307 //moldyn_add_schedule(&md,1000,1.0);
308 //moldyn_add_schedule(&md,1000,1.0);
309 //moldyn_add_schedule(&md,1000,1.0);
310 //moldyn_add_schedule(&md,1000,1.0);
311 //moldyn_add_schedule(&md,1000,1.0);
313 //for(inject=0;inject<INJECT;inject++) {
314 // /* injecting atom and run with enabled t scaling */
315 // moldyn_add_schedule(&md,900,1.0);
316 // /* continue running with disabled t scaling */
317 // moldyn_add_schedule(&md,1100,1.0);
321 /* schedule hook function */
322 moldyn_set_schedule_hook(&md,&hook,NULL);
324 /* activate logging */
325 moldyn_set_log_dir(&md,argv[1]);
326 moldyn_set_report(&md,"Frank Zirkelbach","Test 1");
327 moldyn_set_log(&md,LOG_TOTAL_ENERGY,1);
328 moldyn_set_log(&md,LOG_TEMPERATURE,1);
329 moldyn_set_log(&md,LOG_PRESSURE,1);
330 moldyn_set_log(&md,VISUAL_STEP,100);
331 moldyn_set_log(&md,SAVE_STEP,100);
332 moldyn_set_log(&md,CREATE_REPORT,0);
335 * let's do the actual md algorithm now
337 * integration of newtons equations
339 moldyn_integrate(&md);
345 * post processing the data
349 moldyn_shutdown(&md);