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