actually just bullshit ... (added unique tag -> maybe symmetry)
[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
16         /* check argv */
17         if(argc!=2) {
18                 printf("[sic] error: arg1 (vis/log/save location) ");
19                 printf("must be given!\n");
20                 return -1;
21         }
22
23         /* main moldyn structure */
24         t_moldyn md;
25
26         /* potential parameters */
27         t_lj_params lj;
28         t_ho_params ho;
29         t_tersoff_mult_params tp;
30
31         /* misc parameters */
32         double tau;
33
34         /* testing location & velocity vector */
35         //t_3dvec r,v;
36
37         /* values */
38         tau=1.0e-15;    /* delta t = 1 fs */
39
40         /* initialize moldyn */
41         printf("[sic] moldyn init\n");
42         moldyn_init(&md,argc,argv);
43
44         /* choose integration algorithm */
45         printf("[sic] setting integration algorithm\n");
46         set_int_alg(&md,MOLDYN_INTEGRATE_VERLET);
47
48         /* choose potential */
49         printf("[sic] selecting potential\n");
50         set_potential1b(&md,tersoff_mult_1bp,&tp);
51         set_potential2b(&md,tersoff_mult_2bp,&tp);
52         set_potential2b_post(&md,tersoff_mult_post_2bp,&tp);
53         set_potential3b(&md,tersoff_mult_3bp,&tp);
54         //set_potential2b(&md,lennard_jones,&lj);
55
56         /*
57          * potential parameters
58          */
59
60         /* lennard jones */
61         lj.sigma6=LJ_SIGMA_SI*LJ_SIGMA_SI*LJ_SIGMA_SI;
62         lj.sigma6*=lj.sigma6;
63         lj.sigma12=lj.sigma6*lj.sigma6;
64         lj.epsilon4=4.0*LJ_EPSILON_SI;
65
66         /* harmonic oscillator */
67         ho.equilibrium_distance=0.25*sqrt(3.0)*LC_SI;
68         ho.spring_constant=1;
69
70         /*
71          * tersoff mult potential parameters for SiC
72          */
73         tp.S[0]=TM_S_SI;
74         tp.R[0]=TM_R_SI;
75         tp.A[0]=TM_A_SI;
76         tp.B[0]=TM_B_SI;
77         tp.lambda[0]=TM_LAMBDA_SI;
78         tp.mu[0]=TM_MU_SI;
79         tp.beta[0]=TM_BETA_SI;
80         tp.n[0]=TM_N_SI;
81         tp.c[0]=TM_C_SI;
82         tp.d[0]=TM_D_SI;
83         tp.h[0]=TM_H_SI;
84
85         tp.S[1]=TM_S_C;
86         tp.R[1]=TM_R_C;
87         tp.A[1]=TM_A_C;
88         tp.B[1]=TM_B_C;
89         tp.lambda[1]=TM_LAMBDA_C;
90         tp.mu[1]=TM_MU_C;
91         tp.beta[1]=TM_BETA_C;
92         tp.n[1]=TM_N_C;
93         tp.c[1]=TM_C_C;
94         tp.d[1]=TM_D_C;
95         tp.h[1]=TM_H_C;
96
97         tp.chi=TM_CHI_SIC;
98
99         tersoff_mult_complete_params(&tp);
100
101         /* cutoff radius */
102         printf("[sic] setting cutoff radius\n");
103         set_cutoff(&md,TM_S_SI);
104         //set_cutoff(&md,2*LC_SI);
105
106         /* set (initial) dimensions of simulation volume */
107         printf("[sic] setting dimensions\n");
108         set_dim(&md,5*LC_SI,5*LC_SI,5*LC_SI,TRUE);
109
110         /* set periodic boundary conditions in all directions */
111         printf("[sic] setting periodic boundary conditions\n");
112         set_pbc(&md,TRUE,TRUE,TRUE);
113
114         /* create the lattice / place atoms */
115         printf("[sic] creating atoms\n");
116         create_lattice(&md,DIAMOND,LC_SI,SI,M_SI,
117                        ATOM_ATTR_1BP|ATOM_ATTR_2BP|ATOM_ATTR_3BP|ATOM_ATTR_HB,
118                        0,5,5,5);
119         moldyn_bc_check(&md);
120
121         /* testing configuration */
122         //r.x=2.45/2;   v.x=0;
123         //r.y=0;                v.y=0;
124         //r.z=0;                v.z=0;
125         //add_atom(&md,SI,M_SI,0,
126         //           ATOM_ATTR_1BP|ATOM_ATTR_2BP|ATOM_ATTR_3BP|ATOM_ATTR_HB,
127         //           &r,&v);
128         //r.x=-2.45/2;  v.x=0;
129         //r.y=0;                v.y=0;
130         //r.z=0;                v.z=0;
131         //add_atom(&md,SI,M_SI,0,
132         //           ATOM_ATTR_1BP|ATOM_ATTR_2BP|ATOM_ATTR_3BP|ATOM_ATTR_HB,
133         //           &r,&v);
134
135         /* setting a nearest neighbour distance for the moldyn checks */
136         set_nn_dist(&md,0.25*sqrt(3.0)*LC_SI); /* diamond ! */
137
138         /* set temperature */
139         printf("[sic] setting temperature\n");
140         //set_temperature(&md,273.0+1410.0);
141         set_temperature(&md,273.0+450.0);
142         //set_temperature(&md,273.0);
143         //set_temperature(&md,1.0);
144         //set_temperature(&md,0.0);
145
146         /* set pressure */
147         printf("[sic] setting pressure\n");
148         set_pressure(&md,ATM);
149
150         /* set p/t scaling */
151         printf("[sic] set p/t scaling\n");
152         //set_pt_scale(&md,P_SCALE_BERENDSEN,100.0,
153         //                 T_SCALE_BERENDSEN,100.0);
154         set_pt_scale(&md,0,0,T_SCALE_BERENDSEN,100.0);
155         
156         /* initial thermal fluctuations of particles (in equilibrium) */
157         printf("[sic] thermal init\n");
158         thermal_init(&md,TRUE);
159
160         /* create the simulation schedule */
161         printf("[sic] adding schedule\n");
162         moldyn_add_schedule(&md,20001,1.0);
163
164         /* activate logging */
165         printf("[sic] activate logging\n");
166         moldyn_set_log_dir(&md,argv[1]);
167         moldyn_set_log(&md,LOG_TOTAL_ENERGY,200);
168         moldyn_set_log(&md,VISUAL_STEP,200);
169
170         /*
171          * let's do the actual md algorithm now
172          *
173          * integration of newtons equations
174          */
175
176         printf("[sic] integration start, go get a coffee ...\n");
177         moldyn_integrate(&md);
178
179         /* close */
180
181         printf("[sic] shutdown\n");
182         moldyn_shutdown(&md);
183         
184         return 0;
185 }
186