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.13*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;
82 md.cutoff=R_CUTOFF*LC_SI;
83 md.cutoff_square=md.cutoff*md.cutoff;
86 md.integrate=velocity_verlet;
91 /* dimensions of the simulation cell */
96 /* verlet list init */
97 // later integrated in moldyn_init function!
98 verlet_list_init(&md);
100 printf("setting thermal fluctuations (T=%f K)\n",md.t);
101 thermal_init(&md,&random,count);
102 //for(a=0;a<count;a++) v3_zero(&(si[0].v));
104 /* check kinetic energy */
106 e=get_e_kin(si,count);
107 printf("kinetic energy: %.40f [J]\n",e);
108 printf("3/2 N k T = %.40f [J] (T=%f [K])\n",
109 1.5*count*K_BOLTZMANN*md.t,md.t);
111 /* check total momentum */
112 p=get_total_p(si,count);
113 printf("total momentum: %.30f [Ns]\n",v3_norm(&p));
115 /* potential paramters */
116 lj.sigma6=LJ_SIGMA_SI*LJ_SIGMA_SI;
117 help=lj.sigma6*lj.sigma6;
119 lj.sigma12=lj.sigma6*lj.sigma6;
120 lj.epsilon4=4.0*LJ_EPSILON_SI;
122 ho.equilibrium_distance=0.25*sqrt(3.0)*LC_SI;
123 ho.spring_constant=1.0;
125 printf("estimated accurate time step: %.30f [s]\n",
126 estimate_time_step(&md,3.0,md.t));
130 * let's do the actual md algorithm now
132 * integration of newtons equations
135 moldyn_integrate(&md);
137 printf("total energy (after integration): %.40f [J]\n",
138 get_total_energy(&md));
142 verlet_list_shutdown(&md);
146 moldyn_shutdown(&md);