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

Comparing trunk/OOPSE/libmdtools/NPTim.cpp (file contents):
Revision 611 by gezelter, Tue Jul 15 17:10:50 2003 UTC vs.
Revision 763 by tim, Mon Sep 15 16:52:02 2003 UTC

# Line 24 | Line 24
24   //  The NPTim variant scales the molecular center-of-mass coordinates
25   //  instead of the atomic coordinates
26  
27 < NPTim::NPTim ( SimInfo *theInfo, ForceFields* the_ff):
28 <  Integrator( theInfo, the_ff )
27 > template<typename T> NPTim<T>::NPTim ( SimInfo *theInfo, ForceFields* the_ff):
28 >  T( theInfo, the_ff )
29   {
30    chi = 0.0;
31    eta = 0.0;
32 +  integralOfChidt = 0.0;
33    have_tau_thermostat = 0;
34    have_tau_barostat = 0;
35    have_target_temp = 0;
36    have_target_pressure = 0;
37   }
38  
39 < void NPTim::moveA() {
39 > template<typename T> void NPTim<T>::moveA() {
40    
41    int i, j, k;
42    DirectionalAtom* dAtom;
# Line 164 | Line 165 | void NPTim::moveA() {
165    }
166   }
167  
168 < void NPTim::moveB( void ){
168 > template<typename T> void NPTim<T>::moveB( void ){
169    int i, j;
170    DirectionalAtom* dAtom;
171    double Tb[3], ji[3];
# Line 219 | Line 220 | void NPTim::moveB( void ){
220    }
221   }
222  
223 < int NPTim::readyCheck() {
223 > template<typename T> void NPTim<T>::resetIntegrator() {
224 >  chi = 0.0;
225 >  eta = 0.0;
226 > }
227 >
228 > template<typename T> int NPTim<T>::readyCheck() {
229 >
230 >  //check parent's readyCheck() first
231 >  if (T::readyCheck() == -1)
232 >    return -1;
233  
234    // First check to see if we have a target temperature.
235    // Not having one is fatal.
# Line 271 | Line 281 | int NPTim::readyCheck() {
281    NkBT = (double)info->ndf * kB * targetTemp;
282  
283    return 1;
284 + }
285 +
286 + template<typename T> double NPTim<T>::getConservedQuantity(void){
287 +
288 +  double conservedQuantity;
289 +  double tb2;
290 +  double eta2;  
291 +
292 +
293 +  //HNVE
294 +  conservedQuantity = tStats->getTotalE();
295 +
296 +  //HNVT
297 +  conservedQuantity += (info->getNDF() * kB * targetTemp *
298 +                        (integralOfChidt + tauThermostat * tauThermostat * chi * chi /2))/ eConvert ;
299 +
300 +  //HNPT
301 +  tb2 = tauBarostat *tauBarostat;
302 +  eta2 = eta * eta;
303 +  
304 +  conservedQuantity += (targetPressure * tStats->getVolume() / p_convert +
305 +                        3*NkBT/2 * tb2 * eta2) / eConvert;
306 +  
307 +  return conservedQuantity;
308   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines