some checkins
[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
58 typedef struct s_mdrun {
59         char cfile[128];                        // config file
60
61         char continue_file[128];                // moldyn save file to continue
62
63         u8 intalgo;                             // integration algorithm
64         double timestep;                        // timestep
65
66         u8 potential;                           // potential
67         double cutoff;                          // cutoff radius
68         double nnd;                             // next neighbour distance
69
70         t_3dvec dim;                            // simulation volume
71         u8 pbcx;                                // periodic boundary conditions
72         u8 pbcy;
73         u8 pbcz;
74
75         int element1;                           // element 1
76         int element2;                           // element 2
77
78         double lc;                              // lattice constant
79         u8 lattice;                             // type of lattice
80
81         u8 sattr;                               // system attributes
82         double temperature;                     // temperature
83         double pressure;                        // pressure
84         double dp;
85         double dt;
86         int relax_steps;                        // amount of relaxation steps
87
88         int prerun;                             // amount of loops in first run
89
90         int elog;                               // logging
91         int tlog;
92         int plog;
93         int vlog;
94         int save;
95         int visualize;
96         u8 vis;
97         int avgskip;                            // average skip
98         char sdir[128];                         // save root
99
100         t_list stage;                           // stages
101         int s_cnt;                              // stage counter
102 } t_mdrun;
103
104 #define SATTR_PRELAX                            0x01
105 #define SATTR_TRELAX                            0x02
106 #define SATTR_AVGRST                            0x04
107
108 typedef struct s_displace_atom_params {
109         int nr;
110         double dx,dy,dz;
111 } t_displace_atom_params;
112
113 typedef struct s_del_atoms_params {
114         double r;
115         t_3dvec o;
116 } t_del_atoms_params;
117
118 typedef struct s_modify_aoms_params {
119         u8 type;
120         int tag;
121         t_3dvec ekin;
122 } t_modify_atoms_params;
123
124 typedef struct s_insert_atoms_params {
125         u8 type;
126         double x0,y0,z0,x1,y1,z1;
127         double cr;
128         int ins_steps;
129         int cnt_steps;
130         int ins_atoms;
131         int element;
132         u8 brand;
133         u8 attr;
134 } t_insert_atoms_params;
135
136 typedef struct s_insert_mixed_atoms_params {
137         int element1;
138         int element2;
139         int amount1;
140         int amount2;
141         u8 brand1;
142         u8 brand2;
143         u8 attr1;
144         u8 attr2;
145         double crmin;
146         double crmax;
147 } t_insert_mixed_atoms_params;
148
149 #define INS_TOTAL                               0x01
150 #define INS_RECT                                0x02
151 #define INS_SPHERE                              0x03
152 #define INS_POS                                 0x04
153 #define INS_RELPOS                              0x05
154
155 typedef struct s_continue_params {
156         int runs;
157 } t_continue_params;
158
159 typedef struct s_anneal_params {
160         int runs;
161         int count;
162         double dt;
163         int interval;
164 } t_anneal_params;
165
166 typedef struct s_chaattr_params {
167         u8 type;
168         double x0,y0,z0;
169         double x1,y1,z1;
170         int element;
171         u8 attr;
172 } t_chaattr_params;
173
174 #define CHAATTR_TOTALV                          0x01
175 #define CHAATTR_REGION                          0x02
176 #define CHAATTR_ELEMENT                         0x04
177 #define CHAATTR_NUMBER                          0x08
178
179 typedef struct s_chsattr_params {
180         u8 type;
181         double ttau;
182         double ptau;
183         double dt;
184         double dp;
185         int rsteps;
186         u8 avgrst;
187 } t_chsattr_params;
188
189 #define CHSATTR_PCTRL                           0x01
190 #define CHSATTR_TCTRL                           0x02
191 #define CHSATTR_PRELAX                          0x04
192 #define CHSATTR_TRELAX                          0x08
193 #define CHSATTR_AVGRST                          0x10
194 #define CHSATTR_RSTEPS                          0x20
195
196 typedef struct s_set_temp_params {
197         u8 type;
198         double val;
199 } t_set_temp_params;
200
201 #define SET_TEMP_CURRENT                        0x01
202 #define SET_TEMP_VALUE                          0x02
203
204 typedef struct s_set_timestep_params {
205         double tau;
206 } t_set_timestep_params;
207
208 typedef struct s_fill_params {
209         double lc;                              // lattice constant
210         int lx;                                 // amount of lc units
211         int ly;
212         int lz;
213         u8 lattice;
214         int fill_element;
215         u8 fill_brand;
216         t_part_params p_params;
217         t_defect_params d_params;
218         t_offset_params o_params;
219 } t_fill_params;
220
221 /*
222  * function prototypes
223  */
224
225 #endif