| 6 |
|
#include "AbstractClasses.hpp" |
| 7 |
|
#include "SimInfo.hpp" |
| 8 |
|
#include "ForceFields.hpp" |
| 9 |
+ |
#include "Thermo.hpp" |
| 10 |
+ |
#include "ReadWrite.hpp" |
| 11 |
|
|
| 12 |
< |
class Verlet : public Integrator { |
| 12 |
> |
class Integrator : public BaseIntegrator { |
| 13 |
|
|
| 14 |
|
public: |
| 15 |
< |
Verlet( SimInfo &info, ForceFields* the_ff ); |
| 16 |
< |
~Verlet(); |
| 15 |
> |
Integrator( SimInfo &theInfo, ForceFields* the_ff ); |
| 16 |
> |
virtual ~Integrator(); |
| 17 |
|
void integrate( void ); |
| 18 |
|
|
| 19 |
< |
private: |
| 19 |
> |
|
| 20 |
> |
protected: |
| 21 |
|
|
| 22 |
< |
void move_a( double dt ); |
| 23 |
< |
void move_b( double dt ); |
| 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 *entry_plug; // all the info we'll ever need |
| 38 |
< |
int c_natoms; /* the number of atoms */ |
| 39 |
< |
Atom **c_atoms; /* array of atom pointers */ |
| 40 |
< |
SRI **c_sr_interactions; /* array of SRI pointers */ |
| 41 |
< |
int c_n_SRI; /* the number of short range interactions */ |
| 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 c_is_constrained; /*boolean to know whether the systems contains |
| 45 |
< |
constraints. */ |
| 46 |
< |
int c_n_constrained; /*counter for number of constraints */ |
| 47 |
< |
int *c_constrained_i; /* the i of a constraint pair */ |
| 48 |
< |
int *c_constrained_j; /* the j of a constraint pair */ |
| 49 |
< |
double *c_constrained_dsqr; /* the square of the constraint distance */ |
| 50 |
< |
double *c_mass; /* the array of masses */ |
| 51 |
< |
short is_first; /*boolean for the first time integrate is called */ |
| 52 |
< |
double c_box_x; |
| 53 |
< |
double c_box_y; |
| 54 |
< |
double c_box_z; |
| 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 Symplectic : public Integrator { |
| 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: |
| 46 |
– |
Symplectic( SimInfo* the_entry_plug, ForceFields* the_ff ); |
| 47 |
– |
~Symplectic(); |
| 48 |
– |
|
| 49 |
– |
void integrate( void ); |
| 90 |
|
|
| 91 |
< |
private: |
| 91 |
> |
NVT ( SimInfo &theInfo, ForceFields* the_ff) : |
| 92 |
> |
Integrator( theInfo, the_ff ); |
| 93 |
> |
virtual ~NVT(); |
| 94 |
|
|
| 95 |
< |
void rotate( int axes1, int axes2, double angle, double j[3], |
| 96 |
< |
double A[3][3] ); |
| 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 |
< |
SimInfo* entry_plug; |
| 57 |
< |
ForceFields* myFF; |
| 99 |
> |
protected: |
| 100 |
|
|
| 101 |
< |
int is_constrained; /*boolean to know whether the systems contains |
| 102 |
< |
constraints. */ |
| 61 |
< |
int n_constrained; /*counter for number of constraints */ |
| 62 |
< |
int *constrained_i; /* the i of a constraint pair */ |
| 63 |
< |
int *constrained_j; /* the j of a constraint pair */ |
| 64 |
< |
double *constrained_dsqr; /* the square of the constraint distance */ |
| 65 |
< |
double *mass; /* the array of masses */ |
| 101 |
> |
virtual moveA( void ); |
| 102 |
> |
virtual moveB( void ); |
| 103 |
|
|
| 104 |
< |
short int isFirst; |
| 104 |
> |
int readyCheck(); |
| 105 |
|
|
| 106 |
< |
SRI **srInteractions; /* array of SRI pointers */ |
| 107 |
< |
int nSRI; /* the number of short range interactions */ |
| 108 |
< |
|
| 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 |