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 541 by mmeineke, Fri May 30 20:19:44 2003 UTC vs.
Revision 645 by tim, Tue Jul 22 19:54:52 2003 UTC

# Line 2 | Line 2
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"
# Line 9 | Line 10 | class Integrator : public BaseIntegrator {
10   #include "Thermo.hpp"
11   #include "ReadWrite.hpp"
12  
13 < class Integrator : public BaseIntegrator {
13 > const double kB = 8.31451e-7;// boltzmann constant amu*Ang^2*fs^-2/K
14 > const double eConvert = 4.184e-4; // converts kcal/mol -> amu*A^2/fs^2
15 > const double p_convert = 1.63882576e8; //converts amu*fs^-2*Ang^-1 -> atm
16 > const int maxIteration = 300;
17 > const double tol = 1.0e-6;
18  
19 +
20 + template<typename T = BaseIntegrator> class Integrator : public T {
21 +
22   public:
23 <  Symplectic( SimInfo &theInfo, ForceFields* the_ff );
24 <  virtual ~Symplectic();
23 >  Integrator( SimInfo *theInfo, ForceFields* the_ff );
24 >  virtual ~Integrator();
25    void integrate( void );
26  
27  
28   protected:
21
29    
30    virtual void integrateStep( int calcPot, int calcStress );
31 +  virtual void preMove( void );
32    virtual void moveA( void );
33    virtual void moveB( void );
34    virtual void constrainA( void );
35    virtual void constrainB( void );
36 +  virtual int  readyCheck( void ) { return 1; }
37    
29  
38    void checkConstraints( void );
39    void rotate( int axes1, int axes2, double angle, double j[3],
40                 double A[3][3] );
# Line 36 | Line 44 | class Integrator : public BaseIntegrator { (protected)
44  
45    SimInfo *info; // all the info we'll ever need
46    int nAtoms;  /* the number of atoms */
47 +  int oldAtoms;
48    Atom **atoms; /* array of atom pointers */
49    Molecule* molecules;
50    int nMols;
51  
52 <  int isConstrained; /*boolean to know whether the systems contains
53 <                       constraints. */
54 <  int nConstrained; /*counter for number of constraints */
55 <  int *constrainedI; /* the i of a constraint pair */
56 <  int *constrainedJ; /* the j of a constraint pair */
57 <  double *constrainedDsqr; /* the square of the constraint distance */
52 >  int isConstrained; // boolean to know whether the systems contains
53 >                     // constraints.
54 >  int nConstrained;  // counter for number of constraints
55 >  int *constrainedA; // the i of a constraint pair
56 >  int *constrainedB; // the j of a constraint pair
57 >  double *constrainedDsqr; // the square of the constraint distance
58 >  
59 >  int* moving; // tells whether we are moving atom i
60 >  int* moved;  // tells whether we have moved atom i
61 >  double* oldPos; // pre constrained positions
62 >
63    short isFirst; /*boolean for the first time integrate is called */
64    
65    double dt;
66    double dt2;
53  const double eConvert;
67  
55  
56  double* pos;
57  double* vel;
58  double* frc;
59  double* trq;
60  double* Amat;
61  
62
63
68    Thermo *tStats;
69    StatWriter*  statOut;
70    DumpWriter*  dumpOut;
71    
72   };
73  
74 + typedef Integrator<BaseIntegrator> RealIntegrator;
75  
76 < class NVT : public Integrator{
76 > template<typename T> class NVE : public T {
77  
78 <  NVT ( void );
79 <  virtual ~NVT();
78 > public:
79 >  NVE ( SimInfo *theInfo, ForceFields* the_ff ):
80 >    T( theInfo, the_ff ){}
81 >  virtual ~NVE(){}  
82 > };
83  
84 +
85 + template<typename T> class NVT : public T {
86 +
87 + public:
88 +
89 +  NVT ( SimInfo *theInfo, ForceFields* the_ff);
90 +  virtual ~NVT() {}
91 +
92 +  void setTauThermostat(double tt) {tauThermostat = tt; have_tau_thermostat=1;}
93 +  void setTargetTemp(double tt) {targetTemp = tt; have_target_temp = 1;}
94 +
95   protected:
77  virtual moveA( void );
78  virtual moveB( void );
96  
97 < };
97 >  virtual void moveA( void );
98 >  virtual void moveB( void );
99  
100 +  virtual int readyCheck();
101 +
102 +  // chi is a propagated degree of freedom.
103 +
104 +  double chi;
105 +
106 +  // targetTemp must be set.  tauThermostat must also be set;
107 +
108 +  double targetTemp;
109 +  double tauThermostat;
110    
111 +  short int have_tau_thermostat, have_target_temp;
112  
113 + };
114  
115 +
116 +
117 + template<typename T> class NPTi : public T{
118 +
119 + public:
120 +
121 +  NPTi ( SimInfo *theInfo, ForceFields* the_ff);
122 +  virtual ~NPTi() {};
123 +
124 +  virtual void integrateStep( int calcPot, int calcStress ){
125 +    calcStress = 1;
126 +    T::integrateStep( calcPot, calcStress );
127 +  }
128 +
129 +  void setTauThermostat(double tt) {tauThermostat = tt; have_tau_thermostat=1;}
130 +  void setTauBarostat(double tb) {tauBarostat = tb; have_tau_barostat=1;}
131 +  void setTargetTemp(double tt) {targetTemp = tt; have_target_temp = 1;}
132 +  void setTargetPressure(double tp) {targetPressure = tp; have_target_pressure = 1;}
133 +
134 + protected:
135 +
136 +  virtual void  moveA( void );
137 +  virtual void moveB( void );
138 +
139 +  virtual int readyCheck();
140 +
141 +  // chi and eta are the propagated degrees of freedom
142 +
143 +  double chi;
144 +  double eta;
145 +  double NkBT;
146 +
147 +  // targetTemp, targetPressure, and tauBarostat must be set.  
148 +  // One of qmass or tauThermostat must be set;
149 +
150 +  double targetTemp;
151 +  double targetPressure;
152 +  double tauThermostat;
153 +  double tauBarostat;
154 +
155 +  short int have_tau_thermostat, have_tau_barostat, have_target_temp;
156 +  short int have_target_pressure;
157 +
158 + };
159 +
160 + template<typename T> class NPTim : public T{
161 +
162 + public:
163 +
164 +  NPTim ( SimInfo *theInfo, ForceFields* the_ff);
165 +  virtual ~NPTim() {};
166 +
167 +  virtual void integrateStep( int calcPot, int calcStress ){
168 +    calcStress = 1;
169 +    T::integrateStep( calcPot, calcStress );
170 +  }
171 +
172 +  void setTauThermostat(double tt) {tauThermostat = tt; have_tau_thermostat=1;}
173 +  void setTauBarostat(double tb) {tauBarostat = tb; have_tau_barostat=1;}
174 +  void setTargetTemp(double tt) {targetTemp = tt; have_target_temp = 1;}
175 +  void setTargetPressure(double tp) {targetPressure = tp; have_target_pressure = 1;}
176 +
177 + protected:
178 +
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;
190 +  double eta;
191 +  double NkBT;
192 +
193 +  // targetTemp, targetPressure, and tauBarostat must be set.  
194 +  // One of qmass or tauThermostat must be set;
195 +
196 +  double targetTemp;
197 +  double targetPressure;
198 +  double tauThermostat;
199 +  double tauBarostat;
200 +
201 +  short int have_tau_thermostat, have_tau_barostat, have_target_temp;
202 +  short int have_target_pressure;
203 +
204 + };
205 +
206 + template<typename T> class NPTf : public T{
207 +
208 + public:
209 +
210 +  NPTf ( SimInfo *theInfo, ForceFields* the_ff);
211 +  virtual ~NPTf() {};
212 +
213 +  virtual void integrateStep( int calcPot, int calcStress ){
214 +    calcStress = 1;
215 +    T::integrateStep( calcPot, calcStress );
216 +  }
217 +
218 +  void setTauThermostat(double tt) {tauThermostat = tt; have_tau_thermostat=1;}
219 +  void setTauBarostat(double tb) {tauBarostat = tb; have_tau_barostat=1;}
220 +  void setTargetTemp(double tt) {targetTemp = tt; have_target_temp = 1;}
221 +  void setTargetPressure(double tp) {targetPressure = tp; have_target_pressure = 1;}
222 +
223 + protected:
224 +
225 +  virtual void  moveA( void );
226 +  virtual void moveB( void );
227 +
228 +  virtual int readyCheck();
229 +
230 +  // chi and eta are the propagated degrees of freedom
231 +
232 +  double chi;
233 +  double eta[3][3];
234 +  double NkBT;
235 +
236 +  // targetTemp, targetPressure, and tauBarostat must be set.  
237 +  // One of qmass or tauThermostat must be set;
238 +
239 +  double targetTemp;
240 +  double targetPressure;
241 +  double tauThermostat;
242 +  double tauBarostat;
243 +
244 +  short int have_tau_thermostat, have_tau_barostat, have_target_temp;
245 +  short int have_target_pressure;
246 +
247 + };
248 +
249 + template<typename T> class NPTfm : public T{
250 +
251 + public:
252 +
253 +  NPTfm ( SimInfo *theInfo, ForceFields* the_ff);
254 +  virtual ~NPTfm() {};
255 +
256 +  virtual void integrateStep( int calcPot, int calcStress ){
257 +    calcStress = 1;
258 +    T::integrateStep( calcPot, calcStress );
259 +  }
260 +
261 +  void setTauThermostat(double tt) {tauThermostat = tt; have_tau_thermostat=1;}
262 +  void setTauBarostat(double tb) {tauBarostat = tb; have_tau_barostat=1;}
263 +  void setTargetTemp(double tt) {targetTemp = tt; have_target_temp = 1;}
264 +  void setTargetPressure(double tp) {targetPressure = tp; have_target_pressure = 1;}
265 +
266 + protected:
267 +
268 +  virtual void  moveA( void );
269 +  virtual void moveB( void );
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;
279 +  double eta[3][3];
280 +  double NkBT;
281 +
282 +  // targetTemp, targetPressure, and tauBarostat must be set.  
283 +  // One of qmass or tauThermostat must be set;
284 +
285 +  double targetTemp;
286 +  double targetPressure;
287 +  double tauThermostat;
288 +  double tauBarostat;
289 +
290 +  short int have_tau_thermostat, have_tau_barostat, have_target_temp;
291 +  short int have_target_pressure;
292 +
293 + };
294 +
295   #endif

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines