security checkin
[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         /* testing location & velocity vector */
30         t_3dvec r,v;
31
32         /* values */
33         tau=1.0e-15;    /* delta t = 1 fs */
34
35         /* initialize moldyn */
36         printf("[sic] moldyn init\n");
37         moldyn_init(&md,argc,argv);
38
39         /* choose integration algorithm */
40         printf("[sic] setting integration algorithm\n");
41         set_int_alg(&md,MOLDYN_INTEGRATE_VERLET);
42
43         /* choose potential */
44         printf("[sic] selecting potential\n");
45         set_potential1b(&md,tersoff_mult_1bp,&tp);
46         set_potential2b(&md,tersoff_mult_2bp,&tp);
47         set_potential2b_post(&md,tersoff_mult_post_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         /*
66          * tersoff mult potential parameters for SiC
67          */
68         tp.S[0]=TM_S_SI;
69         tp.R[0]=TM_R_SI;
70         tp.A[0]=TM_A_SI;
71         tp.B[0]=TM_B_SI;
72         tp.lambda[0]=TM_LAMBDA_SI;
73         tp.mu[0]=TM_MU_SI;
74         tp.beta[0]=TM_BETA_SI;
75         tp.n[0]=TM_N_SI;
76         tp.c[0]=TM_C_SI;
77         tp.d[0]=TM_D_SI;
78         tp.h[0]=TM_H_SI;
79
80         tp.S[1]=TM_S_C;
81         tp.R[1]=TM_R_C;
82         tp.A[1]=TM_A_C;
83         tp.B[1]=TM_B_C;
84         tp.lambda[1]=TM_LAMBDA_C;
85         tp.mu[1]=TM_MU_C;
86         tp.beta[1]=TM_BETA_C;
87         tp.n[1]=TM_N_C;
88         tp.c[1]=TM_C_C;
89         tp.d[1]=TM_D_C;
90         tp.h[1]=TM_H_C;
91
92         tp.chi=TM_CHI_SIC;
93
94         tersoff_mult_complete_params(&tp);
95
96         /* cutoff radius */
97         printf("[sic] setting cutoff radius\n");
98         set_cutoff(&md,TM_S_SI);
99         //set_cutoff(&md,2*LC_SI);
100
101         /* set (initial) dimensions of simulation volume */
102         printf("[sic] setting dimensions\n");
103         set_dim(&md,5*LC_SI,5*LC_SI,5*LC_SI,TRUE);
104
105         /* set periodic boundary conditions in all directions */
106         printf("[sic] setting periodic boundary conditions\n");
107         set_pbc(&md,TRUE,TRUE,TRUE);
108
109         /* create the lattice / place atoms */
110         printf("[sic] creating atoms\n");
111         //create_lattice(&md,DIAMOND,LC_SI,SI,M_SI,
112          //              ATOM_ATTR_1BP|ATOM_ATTR_2BP|ATOM_ATTR_3BP|ATOM_ATTR_HB,
113           //             //ATOM_ATTR_2BP|ATOM_ATTR_HB,
114            //            0,5,5,5);
115
116         /* testing configuration */
117         r.x=-0.55*0.25*sqrt(3.0)*LC_SI; v.x=0;
118         r.y=0;                  v.y=0;
119         r.z=0;                  v.z=0;
120         add_atom(&md,SI,M_SI,0,ATOM_ATTR_1BP|ATOM_ATTR_2BP|ATOM_ATTR_3BP|ATOM_ATTR_HB,&r,&v);
121         r.x=+0.55*0.25*sqrt(3.0)*LC_SI; v.x=0;
122         r.y=0;                  v.y=0;
123         r.z=0;                  v.z=0;
124         add_atom(&md,SI,M_SI,0,ATOM_ATTR_1BP|ATOM_ATTR_2BP|ATOM_ATTR_3BP|ATOM_ATTR_HB,&r,&v);
125
126         /* setting a nearest neighbour distance for the moldyn checks */
127         set_nn_dist(&md,0.25*sqrt(3.0)*LC_SI); /* diamond ! */
128
129         /* set temperature */
130         printf("[sic] setting temperature\n");
131         //set_temperature(&md,273.0+450.0);
132         set_temperature(&md,0.0);
133
134         /* set p/t scaling */
135         printf("[sic] set p/t scaling\n");
136         set_pt_scale(&md,0,0,T_SCALE_BERENDSEN,100*tau);
137         
138         /* initial thermal fluctuations of particles (in equilibrium) */
139         printf("[sic] thermal init\n");
140         thermal_init(&md,TRUE);
141
142         /* create the simulation schedule */
143         printf("[sic] adding schedule\n");
144         moldyn_add_schedule(&md,1000,1.0e-15);
145
146         /* activate logging */
147         printf("[sic] activate logging\n");
148         moldyn_set_log(&md,LOG_TOTAL_ENERGY,"saves/test-energy",10);
149         moldyn_set_log(&md,VISUAL_STEP,"saves/test-visual",10);
150
151         /*
152          * let's do the actual md algorithm now
153          *
154          * integration of newtons equations
155          */
156
157         printf("[sic] integration start, go get a coffee ...\n");
158         moldyn_integrate(&md);
159
160         /* close */
161
162         printf("[sic] shutdown\n");
163         moldyn_shutdown(&md);
164         
165         return 0;
166 }
167