1 |
#ifndef _INTEGRATOR_H_ |
2 |
#define _INTEGRATOR_H_ |
3 |
|
4 |
#include "Atom.hpp" |
5 |
#include "SRI.hpp" |
6 |
#include "AbstractClasses.hpp" |
7 |
#include "SimInfo.hpp" |
8 |
#include "ForceFields.hpp" |
9 |
#include "Thermo.hpp" |
10 |
#include "ReadWrite.hpp" |
11 |
|
12 |
class Integrator : public BaseIntegrator { |
13 |
|
14 |
public: |
15 |
Integrator( SimInfo &theInfo, ForceFields* the_ff ); |
16 |
virtual ~Integrator(); |
17 |
void integrate( void ); |
18 |
|
19 |
|
20 |
protected: |
21 |
|
22 |
virtual void integrateStep( int calcPot, int calcStress ); |
23 |
virtual void preMove( void ); |
24 |
virtual void moveA( void ); |
25 |
virtual void moveB( void ); |
26 |
virtual void constrainA( void ); |
27 |
virtual void constrainB( void ); |
28 |
virtual int readyCheck( void ) { return 1; } |
29 |
|
30 |
void checkConstraints( void ); |
31 |
void rotate( int axes1, int axes2, double angle, double j[3], |
32 |
double A[3][3] ); |
33 |
|
34 |
|
35 |
ForceFields* myFF; |
36 |
|
37 |
SimInfo *info; // all the info we'll ever need |
38 |
int nAtoms; /* the number of atoms */ |
39 |
int oldAtoms; |
40 |
Atom **atoms; /* array of atom pointers */ |
41 |
Molecule* molecules; |
42 |
int nMols; |
43 |
|
44 |
int isConstrained; // boolean to know whether the systems contains |
45 |
// constraints. |
46 |
int nConstrained; // counter for number of constraints |
47 |
int *constrainedA; // the i of a constraint pair |
48 |
int *constrainedB; // the j of a constraint pair |
49 |
double *constrainedDsqr; // the square of the constraint distance |
50 |
|
51 |
int* moving; // tells whether we are moving atom i |
52 |
int* moved; // tells whether we have moved atom i |
53 |
double* prePos; // pre constrained positions |
54 |
|
55 |
short isFirst; /*boolean for the first time integrate is called */ |
56 |
|
57 |
double dt; |
58 |
double dt2; |
59 |
|
60 |
const double kB = 8.31451e-7; // boltzmann constant in amu*Ang^2*fs^-2/K |
61 |
const double eConvert = 4.184e-4; // converts kcal/mol -> amu*A^2/fs^2 |
62 |
const int maxIteration = 300; |
63 |
const double tol = 1.0e-6; |
64 |
|
65 |
double* pos; |
66 |
double* vel; |
67 |
double* frc; |
68 |
double* trq; |
69 |
double* Amat; |
70 |
|
71 |
Thermo *tStats; |
72 |
StatWriter* statOut; |
73 |
DumpWriter* dumpOut; |
74 |
|
75 |
}; |
76 |
|
77 |
class NVE : public Integrator{ |
78 |
|
79 |
NVE ( void ): |
80 |
Integrator( theInfo, the_ff ){} |
81 |
virtual ~NVE(){} |
82 |
|
83 |
|
84 |
|
85 |
}; |
86 |
|
87 |
class NVT : public Integrator{ |
88 |
|
89 |
public: |
90 |
|
91 |
NVT ( SimInfo &theInfo, ForceFields* the_ff) : |
92 |
Integrator( theInfo, the_ff ); |
93 |
virtual ~NVT(); |
94 |
|
95 |
void setQmass(double q) {qmass = q; have_qmass = 1;} |
96 |
void setTauThermostat(double tt) {tauThermostat = tt; have_tau_thermostat=1;} |
97 |
void setTargetTemp(double tt) {targetTemp = tt; have_target_temp = 1;} |
98 |
|
99 |
protected: |
100 |
|
101 |
virtual moveA( void ); |
102 |
virtual moveB( void ); |
103 |
|
104 |
int readyCheck(); |
105 |
|
106 |
Atom** atoms; |
107 |
|
108 |
// zeta is a propagated degree of freedom. |
109 |
|
110 |
double zeta; |
111 |
|
112 |
// targetTemp must be set. One of qmass or tauThermostat must be set; |
113 |
|
114 |
double qmass; |
115 |
double targetTemp; |
116 |
double tauThermostat; |
117 |
|
118 |
short int have_tau_thermostat, have_target_temp, have_qmass; |
119 |
|
120 |
}; |
121 |
|
122 |
|
123 |
class NPT : public Integrator{ |
124 |
|
125 |
public: |
126 |
|
127 |
NPT ( SimInfo &theInfo, ForceFields* the_ff) : |
128 |
Integrator( theInfo, the_ff ); |
129 |
virtual ~NPT(); |
130 |
|
131 |
void setQmass(double q) {qmass = q; have_qmass = 1;} |
132 |
void setTauThermostat(double tt) {tauThermostat = tt; have_tau_thermostat=1;} |
133 |
void setTauBarostat(double tb) {tauBarostat = tb; have_tau_barostat=1;} |
134 |
void setTargetTemp(double tt) {targetTemp = tt; have_target_temp = 1;} |
135 |
void setTargetPressure(double tp) {targetPressure = tp; have_target_pressure = 1;} |
136 |
|
137 |
protected: |
138 |
|
139 |
virtual moveA( void ); |
140 |
virtual moveB( void ); |
141 |
|
142 |
int readyCheck(); |
143 |
|
144 |
Atom** atoms; |
145 |
|
146 |
// zeta and epsilonDot are the propagated degrees of freedom. |
147 |
|
148 |
double zeta; |
149 |
double epsilonDot; |
150 |
|
151 |
// targetTemp, targetPressure, and tauBarostat must be set. |
152 |
// One of qmass or tauThermostat must be set; |
153 |
|
154 |
double qmass; |
155 |
double targetTemp; |
156 |
double targetPressure; |
157 |
double tauThermostat; |
158 |
double tauBarostat; |
159 |
|
160 |
short int have_tau_thermostat, have_tau_barostat, have_target_temp; |
161 |
short int have_target_pressure, have_qmass; |
162 |
|
163 |
}; |
164 |
|
165 |
#endif |