2 * posic.c - precipitation process of silicon carbide in silicon
4 * author: Frank Zirkelbach <frank.zirkelbach@physik.uni-augsburg.de>
11 #include "math/math.h"
12 #include "init/init.h"
13 #include "visual/visual.h"
17 int main(int argc,char **argv) {
34 a=moldyn_parse_argv(&md,argc,argv);
38 moldyn_log_init(&md,&vis);
39 rand_init(&random,NULL,1);
40 random.status|=RAND_STAT_VERBOSE;
42 /* testing random numbers */
43 //for(a=0;a<1000000;a++)
44 // printf("%f %f\n",rand_get_gauss(&random),
45 // rand_get_gauss(&random));
51 /* set for 'bounding atoms' */
57 printf("placing silicon atoms ... ");
58 count=create_lattice(DIAMOND,SI,M_SI,LC_SI,a,b,c,&si);
59 printf("(%d) ok!\n",count);
62 si=malloc(2*sizeof(t_atom));
63 si[0].r.x=0.23*sqrt(3.0)*LC_SI/2.0;
75 /* moldyn init (now si is a valid address) */
78 md.potential=potential_lennard_jones;
79 md.force=force_lennard_jones;
80 //md.potential=potential_harmonic_oscillator;
81 //md.force=force_harmonic_oscillator;
83 md.cutoff_square=(R_CUTOFF*R_CUTOFF);
86 md.integrate=velocity_verlet;
92 printf("setting thermal fluctuations (T=%f K)\n",md.t);
93 thermal_init(&md,&random,count);
94 //for(a=0;a<count;a++) v3_zero(&(si[0].v));
96 /* check kinetic energy */
98 e=get_e_kin(si,count);
99 printf("kinetic energy: %.40f [J]\n",e);
100 printf("3/2 N k T = %.40f [J]\n",1.5*count*K_BOLTZMANN*md.t);
102 /* check total momentum */
103 p=get_total_p(si,count);
104 printf("total momentum: %.30f [Ns]\n",v3_norm(&p));
106 /* check potential energy */
107 lj.sigma6=LJ_SIGMA_SI*LJ_SIGMA_SI;
108 help=lj.sigma6*lj.sigma6;
110 lj.sigma12=lj.sigma6*lj.sigma6;
111 lj.epsilon4=4.0*LJ_EPSILON_SI;
113 ho.equilibrium_distance=0.25*sqrt(3.0)*LC_SI;
114 ho.spring_constant=4.0*LJ_EPSILON_SI;
118 printf("potential energy: %.40f [J]\n",u);
119 printf("total energy (1): %.40f [J]\n",e+u);
120 printf("total energy (2): %.40f [J]\n",get_total_energy(&md));
126 printf("estimated accurate time step: %.30f [s]\n",
127 estimate_time_step(&md,3.0,md.t));
131 * let's do the actual md algorithm now
133 * integration of newtons equations
136 moldyn_integrate(&md);
138 printf("total energy (after integration): %.40f [J]\n",
139 get_total_energy(&md));
145 moldyn_shutdown(&md);