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