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