fixed create_lattice routine
[physik/posic.git] / sic.c
1 /*
2  * sic.c - investigation of the sic precipitation process of silicon carbide
3  *
4  * author: Frank Zirkelbach <frank.zirkelbach@physik.uni-augsburg.de>
5  *
6  */
7
8 #include <math.h>
9  
10 #include "moldyn.h"
11 #include "math/math.h"
12 #include "init/init.h"
13 #include "visual/visual.h"
14
15 #include "posic.h"
16
17 int main(int argc,char **argv) {
18
19         /* main moldyn structure */
20         t_moldyn md;
21
22         /* potential parameters */
23         t_lj_params lj;
24         t_ho_params ho;
25         t_tersoff_mult_params tp;
26
27         /* misc variables, mainly to initialize stuff */
28         t_3dvec r,v;
29
30         /* temperature */
31         double t;
32
33         /* initialize moldyn */
34         printf("[sic] moldyn init\n");
35         moldyn_init(&md,argc,argv);
36
37         /* choose integration algorithm */
38         printf("[sic] setting integration algorithm\n");
39         set_int_alg(&md,MOLDYN_INTEGRATE_VERLET);
40
41         /* choose potential */
42         printf("[sic] selecting potential\n");
43         //set_potential1b(&md,tersoff_mult_1bp,&tp);
44         //set_potential2b(&md,tersoff_mult_2bp,&tp);
45         //set_potential3b(&md,tersoff_mult_3bp,&tp);
46         set_potential2b(&md,lennard_jones,&lj);
47
48         /*
49          * potential parameters
50          */
51
52         /* lennard jones */
53         lj.sigma6=LJ_SIGMA_SI*LJ_SIGMA_SI*LJ_SIGMA_SI;
54         lj.sigma6*=lj.sigma6;
55         lj.sigma12=lj.sigma6*lj.sigma6;
56         lj.epsilon4=4.0*LJ_EPSILON_SI;
57
58         /* harmonic oscillator */
59         ho.equilibrium_distance=0.25*sqrt(3.0)*LC_SI;
60         ho.spring_constant=1;
61
62         /* cutoff radius */
63         printf("[sic] setting cutoff radius\n");
64         set_cutoff(&md,5*LC_SI);
65
66         /* set (initial) dimensions of simulation volume */
67         printf("[sic] setting dimensions\n");
68         set_dim(&md,10*LC_SI,10*LC_SI,10*LC_SI,TRUE);
69
70         /* set periodic boundary conditions in all directions */
71         printf("[sic] setting periodic boundary conditions\n");
72         set_pbc(&md,TRUE,TRUE,TRUE);
73
74         /* create the lattice / place atoms */
75         printf("[sic] creating atoms\n");
76         //memset(&v,0,sizeof(t_3dvec));
77         //r.y=0;
78         //r.z=0;
79         //r.x=0.23*sqrt(3.0)*LC_SI/2.0;
80         //add_atom(&md,SI,M_SI,0,ATOM_ATTR_2BP,&r,&v);
81         //r.x=-r.x;
82         //add_atom(&md,SI,M_SI,0,ATOM_ATTR_2BP,&r,&v);
83         create_lattice(&md,DIAMOND,LC_SI,SI,M_SI,ATOM_ATTR_2BP,0,10,10,10);
84
85         /* set temperature */
86         printf("[sic] setting temperature\n");
87         set_temperature(&md,0.0);
88         
89         /* initial thermal fluctuations of particles */
90         printf("[sic] thermal init\n");
91         thermal_init(&md);
92
93         /* create the simulation schedule */
94         printf("[sic] adding schedule\n");
95         moldyn_add_schedule(&md,10000,1.0e-15);
96
97         /* activate logging */
98         printf("[sic] activate logging\n");
99         moldyn_set_log(&md,LOG_TOTAL_ENERGY,"saves/test-energy",100);
100         moldyn_set_log(&md,VISUAL_STEP,"saves/test-visual",100);
101
102         /*
103          * let's do the actual md algorithm now
104          *
105          * integration of newtons equations
106          */
107
108         printf("[sic] integration start, go get a coffee ...\n");
109         moldyn_integrate(&md);
110
111         /* close */
112
113         printf("[sic] shutdown\n");
114         moldyn_shutdown(&md);
115         
116         return 0;
117 }
118