new linked list system, still a pain inthe ...
[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
12 #include "posic.h"
13
14 int main(int argc,char **argv) {
15         /* main moldyn structure */
16         t_moldyn md;
17
18         /* potential parameters */
19         t_lj_params lj;
20         t_ho_params ho;
21         t_tersoff_mult_params tp;
22
23         /* misc parameters */
24         double tau;
25
26         /* testing location & velocity vector */
27         t_3dvec r,v;
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_potential2b_post(&md,tersoff_mult_post_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         /*
63          * tersoff mult potential parameters for SiC
64          */
65         tp.S[0]=TM_S_SI;
66         tp.R[0]=TM_R_SI;
67         tp.A[0]=TM_A_SI;
68         tp.B[0]=TM_B_SI;
69         tp.lambda[0]=TM_LAMBDA_SI;
70         tp.mu[0]=TM_MU_SI;
71         tp.beta[0]=TM_BETA_SI;
72         tp.n[0]=TM_N_SI;
73         tp.c[0]=TM_C_SI;
74         tp.d[0]=TM_D_SI;
75         tp.h[0]=TM_H_SI;
76
77         tp.S[1]=TM_S_C;
78         tp.R[1]=TM_R_C;
79         tp.A[1]=TM_A_C;
80         tp.B[1]=TM_B_C;
81         tp.lambda[1]=TM_LAMBDA_C;
82         tp.mu[1]=TM_MU_C;
83         tp.beta[1]=TM_BETA_C;
84         tp.n[1]=TM_N_C;
85         tp.c[1]=TM_C_C;
86         tp.d[1]=TM_D_C;
87         tp.h[1]=TM_H_C;
88
89         tp.chi=TM_CHI_SIC;
90
91         tersoff_mult_complete_params(&tp);
92
93         /* cutoff radius */
94         printf("[sic] setting cutoff radius\n");
95         set_cutoff(&md,TM_S_SI);
96         //set_cutoff(&md,2*LC_SI);
97
98         /* set (initial) dimensions of simulation volume */
99         printf("[sic] setting dimensions\n");
100         set_dim(&md,5*LC_SI,5*LC_SI,5*LC_SI,TRUE);
101
102         /* set periodic boundary conditions in all directions */
103         printf("[sic] setting periodic boundary conditions\n");
104         set_pbc(&md,TRUE,TRUE,TRUE);
105
106         /* create the lattice / place atoms */
107         printf("[sic] creating atoms\n");
108         create_lattice(&md,DIAMOND,LC_SI,SI,M_SI,
109                        ATOM_ATTR_1BP|ATOM_ATTR_2BP|ATOM_ATTR_3BP|ATOM_ATTR_HB,
110                        0,5,5,5);
111         moldyn_bc_check(&md);
112
113         /* testing configuration */
114         //r.x=2.45/2;   v.x=0;
115         //r.y=0;                v.y=0;
116         //r.z=0;                v.z=0;
117         //add_atom(&md,SI,M_SI,0,
118         //           ATOM_ATTR_1BP|ATOM_ATTR_2BP|ATOM_ATTR_3BP|ATOM_ATTR_HB,
119         //           &r,&v);
120         //r.x=-2.45/2;  v.x=0;
121         //r.y=0;                v.y=0;
122         //r.z=0;                v.z=0;
123         //add_atom(&md,SI,M_SI,0,
124         //           ATOM_ATTR_1BP|ATOM_ATTR_2BP|ATOM_ATTR_3BP|ATOM_ATTR_HB,
125         //           &r,&v);
126
127         /* setting a nearest neighbour distance for the moldyn checks */
128         set_nn_dist(&md,0.25*sqrt(3.0)*LC_SI); /* diamond ! */
129
130         /* set temperature */
131         printf("[sic] setting temperature\n");
132         set_temperature(&md,273.0+1410.0);
133         //set_temperature(&md,273.0+450.0);
134         //set_temperature(&md,273.0);
135         //set_temperature(&md,1.0);
136         //set_temperature(&md,0.0);
137
138         /* set pressure */
139         printf("[sic] setting pressure\n");
140         set_pressure(&md,ATM);
141
142         /* set p/t scaling */
143         printf("[sic] set p/t scaling\n");
144         //set_pt_scale(&md,P_SCALE_BERENDSEN,100.0,
145         //                 T_SCALE_BERENDSEN,100.0);
146         
147         /* initial thermal fluctuations of particles (in equilibrium) */
148         printf("[sic] thermal init\n");
149         thermal_init(&md,TRUE);
150
151         /* create the simulation schedule */
152         printf("[sic] adding schedule\n");
153         moldyn_add_schedule(&md,100001,1.0);
154
155         /* activate logging */
156         printf("[sic] activate logging\n");
157         moldyn_set_log_dir(&md,"saves/si_melting_point");
158         moldyn_set_log(&md,LOG_TOTAL_ENERGY,200);
159         moldyn_set_log(&md,VISUAL_STEP,200);
160
161         /*
162          * let's do the actual md algorithm now
163          *
164          * integration of newtons equations
165          */
166
167         printf("[sic] integration start, go get a coffee ...\n");
168         moldyn_integrate(&md);
169
170         /* close */
171
172         printf("[sic] shutdown\n");
173         moldyn_shutdown(&md);
174         
175         return 0;
176 }
177