added set_temp and set_timestep stages
[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
54 typedef struct s_mdrun {
55         char cfile[128];                        // config file
56
57         char continue_file[128];                // moldyn save file to continue
58
59         u8 intalgo;                             // integration algorithm
60         double timestep;                        // timestep
61
62         u8 potential;                           // potential
63         double cutoff;                          // cutoff radius
64         double nnd;                             // next neighbour distance
65
66         t_3dvec dim;                            // simulation volume
67         u8 pbcx;                                // periodic boundary conditions
68         u8 pbcy;
69         u8 pbcz;
70
71         int element1;                           // element 1
72         double m1;
73         int element2;                           // element 2
74         double m2;
75         double lc;                              // lattice constant
76         int lx;                                 // amount of lc units
77         int ly;
78         int lz;
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_insert_atoms_params {
114         u8 type;
115         double x0,y0,z0,x1,y1,z1;
116         double cr;
117         int ins_steps;
118         int cnt_steps;
119         int ins_atoms;
120         int element;
121         u8 brand;
122         u8 attr;
123 } t_insert_atoms_params;
124
125 typedef struct s_insert_mixed_atoms_params {
126         int element1;
127         int element2;
128         int amount1;
129         int amount2;
130         u8 brand1;
131         u8 brand2;
132         u8 attr1;
133         u8 attr2;
134         double crmin;
135         double crmax;
136 } t_insert_mixed_atoms_params;
137
138 #define INS_TOTAL                               0x01
139 #define INS_REGION                              0x02
140 #define INS_POS                                 0x03
141
142 typedef struct s_continue_params {
143         int runs;
144 } t_continue_params;
145
146 typedef struct s_anneal_params {
147         int runs;
148         int count;
149         double dt;
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 /*
194  * function prototypes
195  */
196
197
198 #endif