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