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

Comparing trunk/OOPSE/libmdtools/NPTi.cpp (file contents):
Revision 768 by mmeineke, Wed Sep 17 14:22:15 2003 UTC vs.
Revision 769 by tim, Fri Sep 19 14:22:29 2003 UTC

# Line 389 | Line 389 | template<typename T> double NPTi<T>::getConservedQuant
389   template<typename T> double NPTi<T>::getConservedQuantity(void){
390  
391    double conservedQuantity;
392 +  double LkBT;
393 +  double fkBT;
394 +  double f1kBT;
395 +  double f2kBT;
396 +  double NkBT;
397 +  double Energy;
398 +  double thermostat_kinetic;
399 +  double thermostat_potential;
400 +  double barostat_kinetic;
401 +  double barostat_potential;
402    double tb2;
403    double eta2;  
404 <  double E_NPT;
405 <  double U;
406 <  double TS;
407 <  double PV;
408 <  double extra;
404 >
405 >  LkBT = (double)(info->getNDF() + 4) * kB * targetTemp;  // 3N + 1
406 >  fkBT = (double)(info->getNDF()    ) * kB * targetTemp;  // 3N - 3
407 >  f1kBT = (double)(info->getNDF()+ 1) * kB * targetTemp;  // 3N - 3 + 1
408 >  NkBT = (double)(info->getNDF() + 3) * kB * targetTemp;  // 3N
409 >  f2kBT = (double)(info->getNDF()+ 2) * kB * targetTemp;  // 3N - 3 + 1
410  
411 <  U = tStats->getTotalE();
411 >  Energy = tStats->getTotalE();
412  
413 <  TS = fkBT *
414 <    (integralOfChidt + tauThermostat * tauThermostat * chi * chi / 2.0) / eConvert;
404 <
405 <  PV = (targetPressure * tStats->getVolume() / p_convert) / eConvert;
406 <
407 <  tb2 = tauBarostat * tauBarostat;
408 <  eta2 = eta * eta;
413 >  thermostat_kinetic = fkBT* tauThermostat * tauThermostat * chi * chi /
414 >    (2.0 * eConvert);
415  
416 +  thermostat_potential = fkBT* integralOfChidt / eConvert;
417  
411  extra = ((double)info->ndfTrans * kB * targetTemp * tb2 * eta2 / 2.0) / eConvert;
418  
419 +  barostat_kinetic = fkBT * tauBarostat * tauBarostat * eta * eta /
420 +    (2.0 * eConvert);
421 +  
422 +  barostat_potential = (targetPressure * tStats->getVolume() / p_convert) /
423 +    eConvert;
424 +
425 +  conservedQuantity = Energy + thermostat_kinetic + thermostat_potential +
426 +    barostat_kinetic + barostat_potential;
427 +  
428    cout.width(8);
429    cout.precision(8);
430  
431 <  
432 < //   cout << info->getTime() << "\t"
433 < //        << chi << "\t"
419 < //        << eta << "\t"
420 < //        << U << "\t"
421 < //        << TS << "\t"
422 < //        << PV << "\t"
423 < //        << extra << "\t"
424 < //        << U+TS+PV+extra << endl;
431 >  cerr << info->getTime() << "\t" << Energy << "\t" << thermostat_kinetic <<
432 >      "\t" << thermostat_potential << "\t" << barostat_kinetic <<
433 >      "\t" << barostat_potential << "\t" << conservedQuantity << endl;
434  
426  conservedQuantity = U+TS+PV+extra;
435    return conservedQuantity;
436   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines