6 |
|
#include "AbstractClasses.hpp" |
7 |
|
#include "SimInfo.hpp" |
8 |
|
#include "ForceFields.hpp" |
9 |
< |
#include "ExtendedSystem.hpp" |
9 |
> |
#include "Thermo.hpp" |
10 |
> |
#include "ReadWrite.hpp" |
11 |
|
|
12 |
< |
class Verlet : public Integrator { |
12 |
> |
const double kB = 8.31451e-7;// boltzmann constant amu*Ang^2*fs^-2/K |
13 |
> |
const double eConvert = 4.184e-4; // converts kcal/mol -> amu*A^2/fs^2 |
14 |
> |
const double p_convert = 1.63882576e8; //converts amu*fs^-2*Ang^-1 -> atm |
15 |
> |
const int maxIteration = 300; |
16 |
> |
const double tol = 1.0e-6; |
17 |
|
|
18 |
+ |
class Integrator : public BaseIntegrator { |
19 |
+ |
|
20 |
|
public: |
21 |
< |
Verlet( SimInfo &info, ForceFields* the_ff, ExtendedSystem* the_es ); |
22 |
< |
~Verlet(); |
21 |
> |
Integrator( SimInfo *theInfo, ForceFields* the_ff ); |
22 |
> |
virtual ~Integrator(); |
23 |
|
void integrate( void ); |
24 |
|
|
25 |
< |
private: |
25 |
> |
|
26 |
> |
protected: |
27 |
|
|
28 |
< |
void move_a( double dt ); |
29 |
< |
void move_b( double dt ); |
28 |
> |
virtual void integrateStep( int calcPot, int calcStress ); |
29 |
> |
virtual void preMove( void ); |
30 |
> |
virtual void moveA( void ); |
31 |
> |
virtual void moveB( void ); |
32 |
> |
virtual void constrainA( void ); |
33 |
> |
virtual void constrainB( void ); |
34 |
> |
virtual int readyCheck( void ) { return 1; } |
35 |
> |
|
36 |
> |
void checkConstraints( void ); |
37 |
> |
void rotate( int axes1, int axes2, double angle, double j[3], |
38 |
> |
double A[9] ); |
39 |
|
|
40 |
+ |
|
41 |
|
ForceFields* myFF; |
24 |
– |
ExtendedSystem* myES; |
42 |
|
|
43 |
< |
SimInfo *entry_plug; // all the info we'll ever need |
44 |
< |
int c_natoms; /* the number of atoms */ |
45 |
< |
Atom **c_atoms; /* array of atom pointers */ |
43 |
> |
SimInfo *info; // all the info we'll ever need |
44 |
> |
int nAtoms; /* the number of atoms */ |
45 |
> |
int oldAtoms; |
46 |
> |
Atom **atoms; /* array of atom pointers */ |
47 |
|
Molecule* molecules; |
48 |
|
int nMols; |
49 |
|
|
50 |
< |
int c_is_constrained; /*boolean to know whether the systems contains |
51 |
< |
constraints. */ |
52 |
< |
int c_n_constrained; /*counter for number of constraints */ |
53 |
< |
int *c_constrained_i; /* the i of a constraint pair */ |
54 |
< |
int *c_constrained_j; /* the j of a constraint pair */ |
55 |
< |
double *c_constrained_dsqr; /* the square of the constraint distance */ |
56 |
< |
double *c_mass; /* the array of masses */ |
57 |
< |
short is_first; /*boolean for the first time integrate is called */ |
58 |
< |
double c_box_x; |
59 |
< |
double c_box_y; |
42 |
< |
double c_box_z; |
43 |
< |
}; |
50 |
> |
int isConstrained; // boolean to know whether the systems contains |
51 |
> |
// constraints. |
52 |
> |
int nConstrained; // counter for number of constraints |
53 |
> |
int *constrainedA; // the i of a constraint pair |
54 |
> |
int *constrainedB; // the j of a constraint pair |
55 |
> |
double *constrainedDsqr; // the square of the constraint distance |
56 |
> |
|
57 |
> |
int* moving; // tells whether we are moving atom i |
58 |
> |
int* moved; // tells whether we have moved atom i |
59 |
> |
double* oldPos; // pre constrained positions |
60 |
|
|
61 |
< |
class Symplectic : public Integrator { |
61 |
> |
short isFirst; /*boolean for the first time integrate is called */ |
62 |
|
|
63 |
+ |
double dt; |
64 |
+ |
double dt2; |
65 |
+ |
|
66 |
+ |
double* pos; |
67 |
+ |
double* vel; |
68 |
+ |
double* frc; |
69 |
+ |
double* trq; |
70 |
+ |
double* Amat; |
71 |
+ |
|
72 |
+ |
Thermo *tStats; |
73 |
+ |
StatWriter* statOut; |
74 |
+ |
DumpWriter* dumpOut; |
75 |
+ |
|
76 |
+ |
}; |
77 |
+ |
|
78 |
+ |
class NVE : public Integrator{ |
79 |
+ |
|
80 |
|
public: |
81 |
< |
Symplectic( SimInfo* the_entry_plug, |
82 |
< |
ForceFields* the_ff, |
83 |
< |
ExtendedSystem* the_es); |
84 |
< |
~Symplectic(); |
81 |
> |
NVE ( SimInfo *theInfo, ForceFields* the_ff ): |
82 |
> |
Integrator( theInfo, the_ff ){} |
83 |
> |
virtual ~NVE(){} |
84 |
> |
|
85 |
|
|
53 |
– |
void integrate( void ); |
86 |
|
|
87 |
< |
private: |
87 |
> |
}; |
88 |
|
|
89 |
< |
void rotate( int axes1, int axes2, double angle, double j[3], |
58 |
< |
double A[3][3] ); |
89 |
> |
class NVT : public Integrator{ |
90 |
|
|
91 |
< |
SimInfo* entry_plug; |
61 |
< |
ForceFields* myFF; |
62 |
< |
ExtendedSystem* myES; |
91 |
> |
public: |
92 |
|
|
93 |
< |
Molecule* molecules; |
94 |
< |
int nMols; |
93 |
> |
NVT ( SimInfo *theInfo, ForceFields* the_ff); |
94 |
> |
virtual ~NVT() {} |
95 |
|
|
96 |
< |
int is_constrained; /*boolean to know whether the systems contains |
97 |
< |
constraints. */ |
69 |
< |
int n_constrained; /*counter for number of constraints */ |
70 |
< |
int *constrained_i; /* the i of a constraint pair */ |
71 |
< |
int *constrained_j; /* the j of a constraint pair */ |
72 |
< |
double *constrained_dsqr; /* the square of the constraint distance */ |
73 |
< |
double *mass; /* the array of masses */ |
96 |
> |
void setTauThermostat(double tt) {tauThermostat = tt; have_tau_thermostat=1;} |
97 |
> |
void setTargetTemp(double tt) {targetTemp = tt; have_target_temp = 1;} |
98 |
|
|
99 |
< |
short int isFirst; |
99 |
> |
protected: |
100 |
|
|
101 |
< |
SRI **srInteractions; /* array of SRI pointers */ |
102 |
< |
int nSRI; /* the number of short range interactions */ |
101 |
> |
virtual void moveA( void ); |
102 |
> |
virtual void moveB( void ); |
103 |
> |
|
104 |
> |
virtual int readyCheck(); |
105 |
> |
|
106 |
> |
// chi is a propagated degree of freedom. |
107 |
> |
|
108 |
> |
double chi; |
109 |
> |
|
110 |
> |
// targetTemp must be set. tauThermostat must also be set; |
111 |
> |
|
112 |
> |
double targetTemp; |
113 |
> |
double tauThermostat; |
114 |
|
|
115 |
+ |
short int have_tau_thermostat, have_target_temp; |
116 |
+ |
|
117 |
|
}; |
118 |
|
|
119 |
+ |
|
120 |
+ |
class NPTi : public Integrator{ |
121 |
+ |
|
122 |
+ |
public: |
123 |
+ |
|
124 |
+ |
NPTi ( SimInfo *theInfo, ForceFields* the_ff); |
125 |
+ |
virtual ~NPTi() {}; |
126 |
+ |
|
127 |
+ |
void setTauThermostat(double tt) {tauThermostat = tt; have_tau_thermostat=1;} |
128 |
+ |
void setTauBarostat(double tb) {tauBarostat = tb; have_tau_barostat=1;} |
129 |
+ |
void setTargetTemp(double tt) {targetTemp = tt; have_target_temp = 1;} |
130 |
+ |
void setTargetPressure(double tp) {targetPressure = tp; have_target_pressure = 1;} |
131 |
+ |
|
132 |
+ |
protected: |
133 |
+ |
|
134 |
+ |
virtual void moveA( void ); |
135 |
+ |
virtual void moveB( void ); |
136 |
+ |
|
137 |
+ |
virtual int readyCheck(); |
138 |
+ |
|
139 |
+ |
// chi and eta are the propagated degrees of freedom |
140 |
+ |
|
141 |
+ |
double chi; |
142 |
+ |
double eta; |
143 |
+ |
double NkBT; |
144 |
+ |
|
145 |
+ |
// targetTemp, targetPressure, and tauBarostat must be set. |
146 |
+ |
// One of qmass or tauThermostat must be set; |
147 |
+ |
|
148 |
+ |
double targetTemp; |
149 |
+ |
double targetPressure; |
150 |
+ |
double tauThermostat; |
151 |
+ |
double tauBarostat; |
152 |
+ |
|
153 |
+ |
short int have_tau_thermostat, have_tau_barostat, have_target_temp; |
154 |
+ |
short int have_target_pressure; |
155 |
+ |
|
156 |
+ |
}; |
157 |
+ |
|
158 |
+ |
class NPTf : public Integrator{ |
159 |
+ |
|
160 |
+ |
public: |
161 |
+ |
|
162 |
+ |
NPTf ( SimInfo *theInfo, ForceFields* the_ff); |
163 |
+ |
virtual ~NPTf() {}; |
164 |
+ |
|
165 |
+ |
void setTauThermostat(double tt) {tauThermostat = tt; have_tau_thermostat=1;} |
166 |
+ |
void setTauBarostat(double tb) {tauBarostat = tb; have_tau_barostat=1;} |
167 |
+ |
void setTargetTemp(double tt) {targetTemp = tt; have_target_temp = 1;} |
168 |
+ |
void setTargetPressure(double tp) {targetPressure = tp; have_target_pressure = 1;} |
169 |
+ |
|
170 |
+ |
protected: |
171 |
+ |
|
172 |
+ |
virtual void moveA( void ); |
173 |
+ |
virtual void moveB( void ); |
174 |
+ |
|
175 |
+ |
virtual int readyCheck(); |
176 |
+ |
|
177 |
+ |
// chi and eta are the propagated degrees of freedom |
178 |
+ |
|
179 |
+ |
double chi; |
180 |
+ |
double eta[9]; |
181 |
+ |
double NkBT; |
182 |
+ |
|
183 |
+ |
// targetTemp, targetPressure, and tauBarostat must be set. |
184 |
+ |
// One of qmass or tauThermostat must be set; |
185 |
+ |
|
186 |
+ |
double targetTemp; |
187 |
+ |
double targetPressure; |
188 |
+ |
double tauThermostat; |
189 |
+ |
double tauBarostat; |
190 |
+ |
|
191 |
+ |
short int have_tau_thermostat, have_tau_barostat, have_target_temp; |
192 |
+ |
short int have_target_pressure; |
193 |
+ |
|
194 |
+ |
}; |
195 |
+ |
|
196 |
|
#endif |