added sic example code
[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         moldyn_init(&md,argc,argv);
35
36         /* choose integration algorithm */
37         set_int_alg(&md,MOLDYN_INTEGRATE_VERLET);
38
39         /* choose potential */
40         //set_potential(&md,MOLDYN_1BP,tersoff_mult_1bp,&tp);
41         //set_potential(&md,MOLDYN_2BP,tersoff_mult_2bp,&tp);
42         //set_potential(&md,MOLDYN_3BP,tersoff_mult_3bp,&tp);
43         set_potential(&md,MOLDYN_2BP,lennard_jones,&lj);
44
45         /*
46          * potential parameters
47          */
48
49         /* lennard jones */
50         lj.sigma6=LJ_SIGMA_SI*LJ_SIGMA_SI*LJ_SIGMA;
51         lj.sigma6*=lj.sigma6;
52         lj.sigma12=lj.sigma6*lj.sigma6;
53         lj.epsilon4=4.0*LJ_EPSILON_SI;
54
55         /* harmonic oscillator */
56         ho.equilibrium_distance=0.25*sqrt(3.0)*LC_SI;
57         ho.spring_constant=1;
58
59         /* cutoff radius */
60         set_cutoff(&md,LC_SI);
61
62         /* set (initial) dimensions of simulation volume */
63         set_dim(&md,10*LC_SI,10*LC_SI,10*LC_SI,TRUE);
64
65         /* set periodic boundary conditions in all directions */
66         set_pbc(&md,TRUE,TRUE,TRUE);
67
68         /* create the lattice / place atoms */
69         memset(&v,0,sizeof(t_3dvec));
70         r.y=0;
71         r.z=0;
72         r.x=0.23*sqrt(3.0)*LC_SI/2.0;
73         add_atom(&md,SI,M_SI,0,ATOM_ATTR_2BP,&r,&v);
74         r.x=-r.x;
75         add_atom(&md,SI,M_SI,0,ATOM_ATTR_2BP,&r,&v);
76
77         /* set temperature */
78         set_temperature(&md,0.0);
79         
80         /* initial thermal fluctuations of particles */
81         thermal_init(&md);
82
83         /* create the simulation schedule */
84         moldyn_add_schedule(&md,10000,1.0e-15);
85
86         /*
87          * let's do the actual md algorithm now
88          *
89          * integration of newtons equations
90          */
91
92         moldyn_integrate(&md);
93
94         /* close */
95
96         link_cell_shutdown(&md);
97
98         moldyn_shutdown(&md);
99         
100         return 0;
101 }
102