| 2 |
|
#define _INTEGRATOR_H_ |
| 3 |
|
|
| 4 |
|
#include "Atom.hpp" |
| 5 |
+ |
#include "Molecule.hpp" |
| 6 |
|
#include "SRI.hpp" |
| 7 |
|
#include "AbstractClasses.hpp" |
| 8 |
|
#include "SimInfo.hpp" |
| 16 |
|
const int maxIteration = 300; |
| 17 |
|
const double tol = 1.0e-6; |
| 18 |
|
|
| 18 |
– |
class Integrator : public BaseIntegrator { |
| 19 |
|
|
| 20 |
+ |
template<typename T = BaseIntegrator> class Integrator : public T { |
| 21 |
+ |
|
| 22 |
|
public: |
| 23 |
|
Integrator( SimInfo *theInfo, ForceFields* the_ff ); |
| 24 |
|
virtual ~Integrator(); |
| 65 |
|
double dt; |
| 66 |
|
double dt2; |
| 67 |
|
|
| 66 |
– |
double* pos; |
| 67 |
– |
double* vel; |
| 68 |
– |
double* frc; |
| 69 |
– |
double* trq; |
| 70 |
– |
double* Amat; |
| 71 |
– |
|
| 68 |
|
Thermo *tStats; |
| 69 |
|
StatWriter* statOut; |
| 70 |
|
DumpWriter* dumpOut; |
| 71 |
|
|
| 72 |
|
}; |
| 73 |
|
|
| 74 |
< |
class NVE : public Integrator{ |
| 74 |
> |
typedef Integrator<BaseIntegrator> RealIntegrator; |
| 75 |
|
|
| 76 |
+ |
template<typename T> class NVE : public T { |
| 77 |
+ |
|
| 78 |
|
public: |
| 79 |
|
NVE ( SimInfo *theInfo, ForceFields* the_ff ): |
| 80 |
< |
Integrator( theInfo, the_ff ){} |
| 81 |
< |
virtual ~NVE(){} |
| 84 |
< |
|
| 85 |
< |
|
| 86 |
< |
|
| 80 |
> |
T( theInfo, the_ff ){} |
| 81 |
> |
virtual ~NVE(){} |
| 82 |
|
}; |
| 83 |
|
|
| 89 |
– |
class NVT : public Integrator{ |
| 84 |
|
|
| 85 |
+ |
template<typename T> class NVT : public T { |
| 86 |
+ |
|
| 87 |
|
public: |
| 88 |
|
|
| 89 |
|
NVT ( SimInfo *theInfo, ForceFields* the_ff); |
| 113 |
|
}; |
| 114 |
|
|
| 115 |
|
|
| 120 |
– |
class NPTi : public Integrator{ |
| 116 |
|
|
| 117 |
+ |
template<typename T> class NPTi : public T{ |
| 118 |
+ |
|
| 119 |
|
public: |
| 120 |
|
|
| 121 |
|
NPTi ( SimInfo *theInfo, ForceFields* the_ff); |
| 123 |
|
|
| 124 |
|
virtual void integrateStep( int calcPot, int calcStress ){ |
| 125 |
|
calcStress = 1; |
| 126 |
< |
Integrator::integrateStep( calcPot, calcStress ); |
| 126 |
> |
T::integrateStep( calcPot, calcStress ); |
| 127 |
|
} |
| 128 |
|
|
| 129 |
|
void setTauThermostat(double tt) {tauThermostat = tt; have_tau_thermostat=1;} |
| 157 |
|
|
| 158 |
|
}; |
| 159 |
|
|
| 160 |
< |
class NPTim : public Integrator{ |
| 160 |
> |
template<typename T> class NPTim : public T{ |
| 161 |
|
|
| 162 |
|
public: |
| 163 |
|
|
| 166 |
|
|
| 167 |
|
virtual void integrateStep( int calcPot, int calcStress ){ |
| 168 |
|
calcStress = 1; |
| 169 |
< |
Integrator::integrateStep( calcPot, calcStress ); |
| 169 |
> |
T::integrateStep( calcPot, calcStress ); |
| 170 |
|
} |
| 171 |
|
|
| 172 |
|
void setTauThermostat(double tt) {tauThermostat = tt; have_tau_thermostat=1;} |
| 176 |
|
|
| 177 |
|
protected: |
| 178 |
|
|
| 179 |
< |
virtual void moveA( void ); |
| 179 |
> |
virtual void moveA( void ); |
| 180 |
|
virtual void moveB( void ); |
| 181 |
|
|
| 182 |
|
virtual int readyCheck(); |
| 183 |
|
|
| 184 |
+ |
Molecule* myMolecules; |
| 185 |
+ |
Atom** myAtoms; |
| 186 |
+ |
|
| 187 |
|
// chi and eta are the propagated degrees of freedom |
| 188 |
|
|
| 189 |
|
double chi; |
| 203 |
|
|
| 204 |
|
}; |
| 205 |
|
|
| 206 |
< |
class NPTf : public Integrator{ |
| 206 |
> |
template<typename T> class NPTf : public T{ |
| 207 |
|
|
| 208 |
|
public: |
| 209 |
|
|
| 212 |
|
|
| 213 |
|
virtual void integrateStep( int calcPot, int calcStress ){ |
| 214 |
|
calcStress = 1; |
| 215 |
< |
Integrator::integrateStep( calcPot, calcStress ); |
| 215 |
> |
T::integrateStep( calcPot, calcStress ); |
| 216 |
|
} |
| 217 |
|
|
| 218 |
|
void setTauThermostat(double tt) {tauThermostat = tt; have_tau_thermostat=1;} |
| 246 |
|
|
| 247 |
|
}; |
| 248 |
|
|
| 249 |
< |
class NPTfm : public Integrator{ |
| 249 |
> |
template<typename T> class NPTfm : public T{ |
| 250 |
|
|
| 251 |
|
public: |
| 252 |
|
|
| 255 |
|
|
| 256 |
|
virtual void integrateStep( int calcPot, int calcStress ){ |
| 257 |
|
calcStress = 1; |
| 258 |
< |
Integrator::integrateStep( calcPot, calcStress ); |
| 258 |
> |
T::integrateStep( calcPot, calcStress ); |
| 259 |
|
} |
| 260 |
|
|
| 261 |
|
void setTauThermostat(double tt) {tauThermostat = tt; have_tau_thermostat=1;} |
| 270 |
|
|
| 271 |
|
virtual int readyCheck(); |
| 272 |
|
|
| 273 |
+ |
Molecule* myMolecules; |
| 274 |
+ |
Atom** myAtoms; |
| 275 |
+ |
|
| 276 |
|
// chi and eta are the propagated degrees of freedom |
| 277 |
|
|
| 278 |
|
double chi; |