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