well, no more segfaults -> now its getting hard to debug ...
[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         /* 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,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
84         /* set temperature */
85         printf("[sic] setting temperature\n");
86         set_temperature(&md,0.0);
87         
88         /* initial thermal fluctuations of particles */
89         printf("[sic] thermal init\n");
90         thermal_init(&md);
91
92         /* create the simulation schedule */
93         printf("[sic] adding schedule\n");
94         moldyn_add_schedule(&md,1000,1.0e-15);
95
96         /* activate logging */
97         printf("[sic] activate logging\n");
98         moldyn_set_log(&md,LOG_TOTAL_ENERGY,"saves/test-energy",100);
99         moldyn_set_log(&md,VISUAL_STEP,"saves/test-visual",50);
100
101         /*
102          * let's do the actual md algorithm now
103          *
104          * integration of newtons equations
105          */
106
107         printf("[sic] integration start, go get a coffee ...\n");
108         moldyn_integrate(&md);
109
110         /* close */
111
112         printf("[sic] shutdown\n");
113         moldyn_shutdown(&md);
114         
115         return 0;
116 }
117