ready for tersoff 3bp debugging
[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         /* main moldyn structure */
19         t_moldyn md;
20
21         /* potential parameters */
22         t_lj_params lj;
23         t_ho_params ho;
24         t_tersoff_mult_params tp;
25
26         /* misc parameters */
27         double tau;
28
29         /* values */
30         tau=1.0e-15;    /* delta t = 1 fs */
31
32         /* initialize moldyn */
33         printf("[sic] moldyn init\n");
34         moldyn_init(&md,argc,argv);
35
36         /* choose integration algorithm */
37         printf("[sic] setting integration algorithm\n");
38         set_int_alg(&md,MOLDYN_INTEGRATE_VERLET);
39
40         /* choose potential */
41         printf("[sic] selecting potential\n");
42         set_potential1b(&md,tersoff_mult_1bp,&tp);
43         set_potential2b(&md,tersoff_mult_2bp,&tp);
44         set_potential3b(&md,tersoff_mult_3bp,&tp);
45         //set_potential2b(&md,lennard_jones,&lj);
46
47         /*
48          * potential parameters
49          */
50
51         /* lennard jones */
52         lj.sigma6=LJ_SIGMA_SI*LJ_SIGMA_SI*LJ_SIGMA_SI;
53         lj.sigma6*=lj.sigma6;
54         lj.sigma12=lj.sigma6*lj.sigma6;
55         lj.epsilon4=4.0*LJ_EPSILON_SI;
56
57         /* harmonic oscillator */
58         ho.equilibrium_distance=0.25*sqrt(3.0)*LC_SI;
59         ho.spring_constant=1;
60
61         /*
62          * tersoff mult potential parameters for SiC
63          */
64         tp.S[0]=TM_S_SI;
65         tp.R[0]=TM_R_SI;
66         tp.A[0]=TM_A_SI;
67         tp.B[0]=TM_B_SI;
68         tp.lambda[0]=TM_LAMBDA_SI;
69         tp.mu[0]=TM_MU_SI;
70         tp.beta[0]=TM_BETA_SI;
71         tp.n[0]=TM_N_SI;
72         tp.c[0]=TM_C_SI;
73         tp.d[0]=TM_D_SI;
74         tp.h[0]=TM_H_SI;
75
76         tp.S[1]=TM_S_C;
77         tp.R[1]=TM_R_C;
78         tp.A[1]=TM_A_C;
79         tp.B[1]=TM_B_C;
80         tp.lambda[1]=TM_LAMBDA_C;
81         tp.mu[1]=TM_MU_C;
82         tp.beta[1]=TM_BETA_C;
83         tp.n[1]=TM_N_C;
84         tp.c[1]=TM_C_C;
85         tp.d[1]=TM_D_C;
86
87         tp.chi=TM_CHI_SIC;
88
89         tersoff_mult_complete_params(&tp);
90
91         /* cutoff radius */
92         printf("[sic] setting cutoff radius\n");
93         set_cutoff(&md,TM_S_SI);
94
95         /* set (initial) dimensions of simulation volume */
96         printf("[sic] setting dimensions\n");
97         set_dim(&md,4*LC_SI,4*LC_SI,4*LC_SI,TRUE);
98
99         /* set periodic boundary conditions in all directions */
100         printf("[sic] setting periodic boundary conditions\n");
101         set_pbc(&md,TRUE,TRUE,TRUE);
102
103         /* create the lattice / place atoms */
104         printf("[sic] creating atoms\n");
105         create_lattice(&md,DIAMOND,LC_SI,SI,M_SI,
106                        ATOM_ATTR_1BP|ATOM_ATTR_2BP|ATOM_ATTR_3BP|ATOM_ATTR_HB,
107                        //ATOM_ATTR_2BP|ATOM_ATTR_HB,
108                        0,4,4,4);
109
110         /* setting a nearest neighbour distance for the moldyn checks */
111         set_nn_dist(&md,sqrt(3.0)*LC_SI/4.0); /* diamond ! */
112
113         /* set temperature */
114         printf("[sic] setting temperature\n");
115         set_temperature(&md,0.0);
116
117         /* set p/t scaling */
118         printf("[sic] set p/t scaling\n");
119         set_pt_scale(&md,0,0,T_SCALE_BERENDSEN,100*tau);
120         
121         /* initial thermal fluctuations of particles (in equilibrium) */
122         printf("[sic] thermal init\n");
123         thermal_init(&md,TRUE);
124
125         /* create the simulation schedule */
126         printf("[sic] adding schedule\n");
127         moldyn_add_schedule(&md,100,1.0e-15);
128
129         /* activate logging */
130         printf("[sic] activate logging\n");
131         moldyn_set_log(&md,LOG_TOTAL_ENERGY,"saves/test-energy",1);
132         moldyn_set_log(&md,VISUAL_STEP,"saves/test-visual",1);
133
134         /*
135          * let's do the actual md algorithm now
136          *
137          * integration of newtons equations
138          */
139
140         printf("[sic] integration start, go get a coffee ...\n");
141         moldyn_integrate(&md);
142
143         /* close */
144
145         printf("[sic] shutdown\n");
146         moldyn_shutdown(&md);
147         
148         return 0;
149 }
150