Merge branch 'leadoff'
[physik/posic.git] / mdrun.h
1 /*
2  * mdrun.h - mdrun header file
3  *
4  * author: Frank Zirkelbach <frank.zirkelbach@physik.uni-augsburg.de>
5  *
6  */
7
8 #ifndef MDRUN_H
9 #define MDRUN_H
10
11 #include <sys/types.h>
12 #include <sys/stat.h>
13 #include <fcntl.h>
14 #include <unistd.h>
15
16 #include <math.h>
17
18 /* main molecular dynamics api */
19 #include "moldyn.h"
20
21 /* list api */
22 #include "list/list.h"
23
24 /* potentials */
25 #include "potentials/harmonic_oscillator.h"
26 #include "potentials/lennard_jones.h"
27 #include "potentials/albe.h"
28 #ifdef TERSOFF_ORIG
29 #include "potentials/tersoff_orig.h"
30 #else
31 #include "potentials/tersoff.h"
32 #endif
33
34 /*
35  * datatypes & definitions
36  */
37
38 typedef struct s_stage {
39         u8 type;
40         void *params;
41         u8 executed;
42 } t_stage;
43
44 #define STAGE_DISPLACE_ATOM                     0x00
45 #define STAGE_INSERT_ATOMS                      0x01
46 #define STAGE_INSERT_MIXED_ATOMS                0x02
47 #define STAGE_CONTINUE                          0x03
48 #define STAGE_ANNEAL                            0x04
49 #define STAGE_CHAATTR                           0x05
50 #define STAGE_CHSATTR                           0x06
51 #define STAGE_SET_TEMP                          0x07
52 #define STAGE_SET_TIMESTEP                      0x08
53 #define STAGE_FILL                              0x09
54 #define STAGE_THERMAL_INIT                      0x10
55 #define STAGE_DEL_ATOMS                         0x11
56 #define STAGE_MODIFY_ATOMS                      0x12
57 #define STAGE_CRT                               0x13
58
59 typedef struct s_mdrun {
60         char cfile[128];                        // config file
61
62         char continue_file[128];                // moldyn save file to continue
63
64         u8 intalgo;                             // integration algorithm
65         double timestep;                        // timestep
66
67         u8 potential;                           // potential
68         double cutoff;                          // cutoff radius
69         double nnd;                             // next neighbour distance
70
71         t_3dvec dim;                            // simulation volume
72         u8 pbcx;                                // periodic boundary conditions
73         u8 pbcy;
74         u8 pbcz;
75
76         int element1;                           // element 1
77         int element2;                           // element 2
78
79         double lc;                              // lattice constant
80         u8 lattice;                             // type of lattice
81
82         u8 sattr;                               // system attributes
83         double temperature;                     // temperature
84         double pressure;                        // pressure
85         double dp;
86         double dt;
87         int relax_steps;                        // amount of relaxation steps
88
89         int prerun;                             // amount of loops in first run
90
91         int elog;                               // logging
92         int tlog;
93         int plog;
94         int vlog;
95         int save;
96         int visualize;
97         u8 vis;
98         int avgskip;                            // average skip
99         char sdir[128];                         // save root
100
101         t_list stage;                           // stages
102         int s_cnt;                              // stage counter
103 } t_mdrun;
104
105 #define SATTR_PRELAX                            0x01
106 #define SATTR_TRELAX                            0x02
107 #define SATTR_AVGRST                            0x04
108
109 typedef struct s_displace_atom_params {
110         int nr;
111         double dx,dy,dz;
112 } t_displace_atom_params;
113
114 typedef struct s_del_atoms_params {
115         double r;
116         t_3dvec o;
117 } t_del_atoms_params;
118
119 typedef struct s_modify_aoms_params {
120         u8 type;
121         int tag;
122         t_3dvec ekin;
123 } t_modify_atoms_params;
124
125 typedef struct s_insert_atoms_params {
126         u8 type;
127         double x0,y0,z0,x1,y1,z1;
128         double cr;
129         int ins_steps;
130         int cnt_steps;
131         int ins_atoms;
132         int element;
133         u8 brand;
134         u8 attr;
135 } t_insert_atoms_params;
136
137 typedef struct s_insert_mixed_atoms_params {
138         int element1;
139         int element2;
140         int amount1;
141         int amount2;
142         u8 brand1;
143         u8 brand2;
144         u8 attr1;
145         u8 attr2;
146         double crmin;
147         double crmax;
148 } t_insert_mixed_atoms_params;
149
150 #define INS_TOTAL                               0x01
151 #define INS_RECT                                0x02
152 #define INS_SPHERE                              0x03
153 #define INS_POS                                 0x04
154 #define INS_RELPOS                              0x05
155
156 typedef struct s_continue_params {
157         int runs;
158 } t_continue_params;
159
160 typedef struct s_anneal_params {
161         int runs;
162         int count;
163         double dt;
164         int interval;
165 } t_anneal_params;
166
167 typedef struct s_chaattr_params {
168         u8 type;
169         double x0,y0,z0;
170         double x1,y1,z1;
171         int element;
172         u8 attr;
173 } t_chaattr_params;
174
175 #define CHAATTR_TOTALV                          0x01
176 #define CHAATTR_REGION                          0x02
177 #define CHAATTR_ELEMENT                         0x04
178 #define CHAATTR_NUMBER                          0x08
179
180 typedef struct s_chsattr_params {
181         u8 type;
182         double ttau;
183         double ptau;
184         double dt;
185         double dp;
186         int rsteps;
187         u8 avgrst;
188 } t_chsattr_params;
189
190 #define CHSATTR_PCTRL                           0x01
191 #define CHSATTR_TCTRL                           0x02
192 #define CHSATTR_PRELAX                          0x04
193 #define CHSATTR_TRELAX                          0x08
194 #define CHSATTR_AVGRST                          0x10
195 #define CHSATTR_RSTEPS                          0x20
196
197 typedef struct s_set_temp_params {
198         u8 type;
199         double val;
200 } t_set_temp_params;
201
202 #define SET_TEMP_CURRENT                        0x01
203 #define SET_TEMP_VALUE                          0x02
204
205 typedef struct s_set_timestep_params {
206         double tau;
207 } t_set_timestep_params;
208
209 typedef struct s_fill_params {
210         double lc;                              // lattice constant
211         int lx;                                 // amount of lc units
212         int ly;
213         int lz;
214         u8 lattice;
215         int fill_element;
216         u8 fill_brand;
217         t_part_params p_params;
218         t_defect_params d_params;
219         t_offset_params o_params;
220 } t_fill_params;
221
222 typedef struct s_crt_params {
223         u8 type;
224         char file[128];
225         t_3dvec *r_fin;
226         u8 *constraints;
227         int steps;
228         int count;
229 } t_crt_params;
230
231 /*
232  * extern variables
233  */
234
235 // constraint relaxation technique
236 extern u8 crtt;
237 extern u8 *constraints;
238 extern double *trafo_angle;
239
240 /*
241  * function prototypes
242  */
243
244 #endif