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) {
35 char fb[32]="saves/lj_test";
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));
53 /* set for 'bounding atoms' */
60 printf("placing silicon atoms ... ");
61 count=create_lattice(DIAMOND,SI,M_SI,LC_SI,a,b,c,&si);
62 printf("(%d) ok!\n",count);
66 si=malloc(2*sizeof(t_atom));
79 printf("setting thermal fluctuations\n");
80 thermal_init(si,&random,count,t);
81 //v3_zero(&(si[0].v));
82 //v3_zero(&(si[1].v));
84 /* check kinetic energy */
86 e=get_e_kin(si,count);
87 printf("kinetic energy: %.40f [J]\n",e);
88 printf("3/2 N k T = %.40f [J]\n",1.5*count*K_BOLTZMANN*t);
90 /* check total momentum */
91 p=get_total_p(si,count);
92 printf("total momentum: %.30f [Ns]\n",v3_norm(&p));
94 /* check potential energy */
97 md.potential=potential_lennard_jones;
98 md.force=force_lennard_jones;
100 md.cutoff_square=(R_CUTOFF*R_CUTOFF);
102 md.integrate=velocity_verlet;
109 lj.sigma6=LJ_SIGMA_SI*LJ_SIGMA_SI;
110 help=lj.sigma6*lj.sigma6;
112 lj.sigma12=lj.sigma6*lj.sigma6;
113 lj.epsilon=LJ_EPSILON_SI;
117 printf("potential energy: %.40f [J]\n",u);
118 printf("total energy (1): %.40f [J]\n",e+u);
119 printf("total energy (2): %.40f [J]\n",get_total_energy(&md));
125 printf("estimated accurate time step: %.30f [s]\n",
126 estimate_time_step(&md,3.0,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));