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 int maxIteration = 300; |
15 |
> |
const double tol = 1.0e-6; |
16 |
|
|
17 |
+ |
class Integrator : public BaseIntegrator { |
18 |
+ |
|
19 |
|
public: |
20 |
< |
Verlet( SimInfo &info, ForceFields* the_ff, ExtendedSystem* the_es ); |
21 |
< |
~Verlet(); |
20 |
> |
Integrator( SimInfo *theInfo, ForceFields* the_ff ); |
21 |
> |
virtual ~Integrator(); |
22 |
|
void integrate( void ); |
23 |
|
|
24 |
< |
private: |
24 |
> |
|
25 |
> |
protected: |
26 |
|
|
27 |
< |
void move_a( double dt ); |
28 |
< |
void move_b( double dt ); |
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 |
> |
|
35 |
> |
void checkConstraints( void ); |
36 |
> |
void rotate( int axes1, int axes2, double angle, double j[3], |
37 |
> |
double A[9] ); |
38 |
|
|
39 |
+ |
|
40 |
|
ForceFields* myFF; |
24 |
– |
ExtendedSystem* myES; |
41 |
|
|
42 |
< |
SimInfo *entry_plug; // all the info we'll ever need |
43 |
< |
int c_natoms; /* the number of atoms */ |
44 |
< |
Atom **c_atoms; /* array of atom pointers */ |
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 c_is_constrained; /*boolean to know whether the systems contains |
50 |
< |
constraints. */ |
51 |
< |
int c_n_constrained; /*counter for number of constraints */ |
52 |
< |
int *c_constrained_i; /* the i of a constraint pair */ |
53 |
< |
int *c_constrained_j; /* the j of a constraint pair */ |
54 |
< |
double *c_constrained_dsqr; /* the square of the constraint distance */ |
55 |
< |
double *c_mass; /* the array of masses */ |
56 |
< |
short is_first; /*boolean for the first time integrate is called */ |
57 |
< |
double c_box_x; |
58 |
< |
double c_box_y; |
42 |
< |
double c_box_z; |
43 |
< |
}; |
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 |
< |
class Symplectic : public Integrator { |
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; |
73 |
+ |
DumpWriter* dumpOut; |
74 |
+ |
|
75 |
+ |
}; |
76 |
+ |
|
77 |
+ |
class NVE : public Integrator{ |
78 |
+ |
|
79 |
|
public: |
80 |
< |
Symplectic( SimInfo* the_entry_plug, |
81 |
< |
ForceFields* the_ff, |
82 |
< |
ExtendedSystem* the_es); |
83 |
< |
~Symplectic(); |
80 |
> |
NVE ( SimInfo *theInfo, ForceFields* the_ff ): |
81 |
> |
Integrator( theInfo, the_ff ){} |
82 |
> |
virtual ~NVE(){} |
83 |
> |
|
84 |
|
|
53 |
– |
void integrate( void ); |
85 |
|
|
86 |
< |
private: |
86 |
> |
}; |
87 |
|
|
88 |
< |
void rotate( int axes1, int axes2, double angle, double j[3], |
58 |
< |
double A[3][3] ); |
88 |
> |
class NVT : public Integrator{ |
89 |
|
|
90 |
< |
SimInfo* entry_plug; |
61 |
< |
ForceFields* myFF; |
62 |
< |
ExtendedSystem* myES; |
90 |
> |
public: |
91 |
|
|
92 |
< |
Molecule* molecules; |
93 |
< |
int nMols; |
92 |
> |
NVT ( SimInfo *theInfo, ForceFields* the_ff); |
93 |
> |
virtual ~NVT() {} |
94 |
|
|
95 |
< |
int is_constrained; /*boolean to know whether the systems contains |
96 |
< |
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 */ |
95 |
> |
void setTauThermostat(double tt) {tauThermostat = tt; have_tau_thermostat=1;} |
96 |
> |
void setTargetTemp(double tt) {targetTemp = tt; have_target_temp = 1;} |
97 |
|
|
98 |
< |
short int isFirst; |
98 |
> |
protected: |
99 |
|
|
100 |
< |
SRI **srInteractions; /* array of SRI pointers */ |
101 |
< |
int nSRI; /* the number of short range interactions */ |
100 |
> |
virtual void moveA( void ); |
101 |
> |
virtual void moveB( void ); |
102 |
> |
|
103 |
> |
virtual int readyCheck(); |
104 |
> |
|
105 |
> |
// chi is a propagated degree of freedom. |
106 |
> |
|
107 |
> |
double chi; |
108 |
> |
|
109 |
> |
// targetTemp must be set. tauThermostat must also be set; |
110 |
> |
|
111 |
> |
double targetTemp; |
112 |
> |
double tauThermostat; |
113 |
|
|
114 |
+ |
short int have_tau_thermostat, have_target_temp; |
115 |
+ |
|
116 |
|
}; |
117 |
|
|
118 |
+ |
|
119 |
+ |
class NPTi : public Integrator{ |
120 |
+ |
|
121 |
+ |
public: |
122 |
+ |
|
123 |
+ |
NPTi ( SimInfo *theInfo, ForceFields* the_ff); |
124 |
+ |
virtual ~NPTi() {}; |
125 |
+ |
|
126 |
+ |
void setTauThermostat(double tt) {tauThermostat = tt; have_tau_thermostat=1;} |
127 |
+ |
void setTauBarostat(double tb) {tauBarostat = tb; have_tau_barostat=1;} |
128 |
+ |
void setTargetTemp(double tt) {targetTemp = tt; have_target_temp = 1;} |
129 |
+ |
void setTargetPressure(double tp) {targetPressure = tp; have_target_pressure = 1;} |
130 |
+ |
|
131 |
+ |
protected: |
132 |
+ |
|
133 |
+ |
virtual void moveA( void ); |
134 |
+ |
virtual void moveB( void ); |
135 |
+ |
|
136 |
+ |
virtual int readyCheck(); |
137 |
+ |
|
138 |
+ |
// chi and eta are the propagated degrees of freedom |
139 |
+ |
|
140 |
+ |
double chi; |
141 |
+ |
double eta; |
142 |
+ |
double NkBT; |
143 |
+ |
|
144 |
+ |
// targetTemp, targetPressure, and tauBarostat must be set. |
145 |
+ |
// One of qmass or tauThermostat must be set; |
146 |
+ |
|
147 |
+ |
double targetTemp; |
148 |
+ |
double targetPressure; |
149 |
+ |
double tauThermostat; |
150 |
+ |
double tauBarostat; |
151 |
+ |
|
152 |
+ |
short int have_tau_thermostat, have_tau_barostat, have_target_temp; |
153 |
+ |
short int have_target_pressure; |
154 |
+ |
|
155 |
+ |
}; |
156 |
+ |
|
157 |
|
#endif |