ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/OOPSE/libmdtools/Integrator.hpp
(Generate patch)

Comparing trunk/OOPSE/libmdtools/Integrator.hpp (file contents):
Revision 596 by gezelter, Mon Jul 14 15:04:55 2003 UTC vs.
Revision 658 by tim, Thu Jul 31 15:35:07 2003 UTC

# Line 1 | Line 1
1   #ifndef _INTEGRATOR_H_
2   #define _INTEGRATOR_H_
3  
4 + #include <string>
5 + #include <vector>
6   #include "Atom.hpp"
7 + #include "Molecule.hpp"
8   #include "SRI.hpp"
9   #include "AbstractClasses.hpp"
10   #include "SimInfo.hpp"
11   #include "ForceFields.hpp"
12   #include "Thermo.hpp"
13   #include "ReadWrite.hpp"
14 + #include "ZConsWriter.hpp"
15  
16 + using namespace std;
17   const double kB = 8.31451e-7;// boltzmann constant amu*Ang^2*fs^-2/K
18   const double eConvert = 4.184e-4; // converts kcal/mol -> amu*A^2/fs^2
19   const double p_convert = 1.63882576e8; //converts amu*fs^-2*Ang^-1 -> atm
20   const int maxIteration = 300;
21   const double tol = 1.0e-6;
22  
18 class Integrator : public BaseIntegrator {
23  
24 + template<typename T = BaseIntegrator> class Integrator : public T {
25 +
26   public:
27    Integrator( SimInfo *theInfo, ForceFields* the_ff );
28    virtual ~Integrator();
# Line 63 | Line 69 | class Integrator : public BaseIntegrator { (protected)
69    double dt;
70    double dt2;
71  
66  double* pos;
67  double* vel;
68  double* frc;
69  double* trq;
70  double* Amat;
71
72    Thermo *tStats;
73    StatWriter*  statOut;
74    DumpWriter*  dumpOut;
75    
76   };
77  
78 < class NVE : public Integrator{
78 > typedef Integrator<BaseIntegrator> RealIntegrator;
79  
80 + template<typename T> class NVE : public T {
81 +
82   public:
83    NVE ( SimInfo *theInfo, ForceFields* the_ff ):
84 <    Integrator( theInfo, the_ff ){}
85 <  virtual ~NVE(){}
84 <
85 <  
86 <
84 >    T( theInfo, the_ff ){}
85 >  virtual ~NVE(){}  
86   };
87  
88 < class NVT : public Integrator{
88 >
89 > template<typename T> class NVT : public T {
90  
91   public:
92  
# Line 117 | Line 117 | class NPTi : public Integrator{
117   };
118  
119  
120 class NPTi : public Integrator{
120  
121 + template<typename T> class NPTi : public T{
122 +
123   public:
124  
125    NPTi ( SimInfo *theInfo, ForceFields* the_ff);
# Line 126 | Line 127 | class NPTi : public Integrator{ (public)
127  
128    virtual void integrateStep( int calcPot, int calcStress ){
129      calcStress = 1;
130 <    Integrator::integrateStep( calcPot, calcStress );
130 >    T::integrateStep( calcPot, calcStress );
131    }
132  
133    void setTauThermostat(double tt) {tauThermostat = tt; have_tau_thermostat=1;}
# Line 160 | Line 161 | class NPTim : public Integrator{
161  
162   };
163  
164 < class NPTim : public Integrator{
164 > template<typename T> class NPTim : public T{
165  
166   public:
167  
# Line 169 | Line 170 | class NPTim : public Integrator{ (public)
170  
171    virtual void integrateStep( int calcPot, int calcStress ){
172      calcStress = 1;
173 <    Integrator::integrateStep( calcPot, calcStress );
173 >    T::integrateStep( calcPot, calcStress );
174    }
175  
176    void setTauThermostat(double tt) {tauThermostat = tt; have_tau_thermostat=1;}
# Line 179 | Line 180 | class NPTim : public Integrator{ (public)
180  
181   protected:
182  
183 <  virtual void  moveA( void );
183 >  virtual void moveA( void );
184    virtual void moveB( void );
185  
186    virtual int readyCheck();
187  
188 +  Molecule* myMolecules;
189 +  Atom** myAtoms;
190 +
191    // chi and eta are the propagated degrees of freedom
192  
193    double chi;
# Line 203 | Line 207 | class NPTf : public Integrator{
207  
208   };
209  
210 < class NPTf : public Integrator{
210 > template<typename T> class NPTf : public T{
211  
212   public:
213  
# Line 212 | Line 216 | class NPTf : public Integrator{ (public)
216  
217    virtual void integrateStep( int calcPot, int calcStress ){
218      calcStress = 1;
219 <    Integrator::integrateStep( calcPot, calcStress );
219 >    T::integrateStep( calcPot, calcStress );
220    }
221  
222    void setTauThermostat(double tt) {tauThermostat = tt; have_tau_thermostat=1;}
# Line 246 | Line 250 | class NPTfm : public Integrator{
250  
251   };
252  
253 < class NPTfm : public Integrator{
253 > template<typename T> class NPTfm : public T{
254  
255   public:
256  
# Line 255 | Line 259 | class NPTfm : public Integrator{ (public)
259  
260    virtual void integrateStep( int calcPot, int calcStress ){
261      calcStress = 1;
262 <    Integrator::integrateStep( calcPot, calcStress );
262 >    T::integrateStep( calcPot, calcStress );
263    }
264  
265    void setTauThermostat(double tt) {tauThermostat = tt; have_tau_thermostat=1;}
# Line 269 | Line 273 | class NPTfm : public Integrator{ (public)
273    virtual void moveB( void );
274  
275    virtual int readyCheck();
276 +
277 +  Molecule* myMolecules;
278 +  Atom** myAtoms;
279  
280    // chi and eta are the propagated degrees of freedom
281  
# Line 289 | Line 296 | class NPTfm : public Integrator{ (public)
296  
297   };
298  
299 + template<typename T> class ZConstraint : public T {
300 +
301 + public:
302 +
303 +  ZConstraint( SimInfo *theInfo, ForceFields* the_ff);
304 +  ~ZConstraint();
305 +
306 +  virtual void integrateStep( int calcPot, int calcStress );
307 +  
308 +  
309 +  void setZConsTime(double time)                  {this->zconsTime = time;}
310 +  void getZConsTime()                             {return zconsTime;}
311 +  
312 +  void setIndexOfAllZConsMols(vector<int> index)  {indexOfAllZConsMols = index;}
313 +  void getIndexOfAllZConsMols()                   {return indexOfAllZConsMols;}
314 +  
315 +  void setZConsOutput(const char * fileName)      {zconsOutput = fileName;}
316 +  string getZConsOutput()                         {return zconsOutput;}
317 +
318 + #ifdef IS_MPI
319 +  virtual void update(); //which is called to indicate the molecules' migration
320   #endif
321 +
322 + protected:
323 +
324 +  double zconsTime;
325 +  
326 +  void resetZ(void);
327 +  
328 +  vector<Molecule*> zconsMols;
329 +  vector<double> massOfZConsMols;
330 +  
331 +  vector<Molecule*> unconsMols;
332 +  vector<double> massOfUnconsMols;
333 +  double totalMassOfUncons;
334 +
335 +  vector<double> allRefZ;    
336 +  vector<double> refZ;
337 +  
338 +  vector<int> indexOfAllZConsMols;     //index of All Z-Constraint Molecuels
339 +  int* indexOfZConsMols;               //index of local Z-Constraint Molecules
340 +    
341 +  double* fz;
342 +  
343 + private:
344 +
345 +  int isZConstraintMol(Molecule* mol);
346 +  string zconsOutput;
347 +  ZConsWriter* fzOut;
348 + };
349 +
350 + #endif

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines