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