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 770 by gezelter, Fri Sep 19 14:55:41 2003 UTC

# Line 215 | Line 215 | template<typename T> void NPTi<T>::moveB( void ){
215    
216    tt2 = tauThermostat * tauThermostat;
217    tb2 = tauBarostat * tauBarostat;
218
218  
219    // Set things up for the iteration:
220  
# Line 370 | Line 369 | template<typename T> int NPTi<T>::readyCheck() {
369      simError();
370    }
371  
372 <    if (!have_eta_tolerance) {
372 >  if (!have_eta_tolerance) {
373      sprintf( painCave.errMsg,
374               "NPTi warning: setting eta tolerance to 1e-6\n");
375      etaTolerance = 1e-6;
# Line 378 | Line 377 | template<typename T> int NPTi<T>::readyCheck() {
377      painCave.isFatal = 0;
378      simError();
379    }
380 <  // We need NkBT a lot, so just set it here:
381 <
380 >  
381 >  
382 >  // We need NkBT a lot, so just set it here: This is the RAW number
383 >  // of particles, so no subtraction or addition of constraints or
384 >  // orientational degrees of freedom:
385 >  
386    NkBT = (double)Nparticles * kB * targetTemp;
387 +  
388 +  // fkBT is used because the thermostat operates on more degrees of freedom
389 +  // than the barostat (when there are particles with orientational degrees
390 +  // of freedom).  ndf = 3 * (n_atoms + n_oriented -1) - n_constraint - nZcons
391 +  
392    fkBT = (double)info->ndf * kB * targetTemp;
393  
394    return 1;
# Line 389 | Line 397 | template<typename T> double NPTi<T>::getConservedQuant
397   template<typename T> double NPTi<T>::getConservedQuantity(void){
398  
399    double conservedQuantity;
400 +  double Three_NkBT;
401 +  double Energy;
402 +  double thermostat_kinetic;
403 +  double thermostat_potential;
404 +  double barostat_kinetic;
405 +  double barostat_potential;
406    double tb2;
407 <  double eta2;  
394 <  double E_NPT;
395 <  double U;
396 <  double TS;
397 <  double PV;
398 <  double extra;
407 >  double eta2;
408  
409 <  U = tStats->getTotalE();
409 >  Energy = tStats->getTotalE();
410  
411 <  TS = fkBT *
412 <    (integralOfChidt + tauThermostat * tauThermostat * chi * chi / 2.0) / eConvert;
411 >  thermostat_kinetic = fkBT* tauThermostat * tauThermostat * chi * chi /
412 >    (2.0 * eConvert);
413  
414 <  PV = (targetPressure * tStats->getVolume() / p_convert) / eConvert;
414 >  thermostat_potential = fkBT* integralOfChidt / eConvert;
415  
407  tb2 = tauBarostat * tauBarostat;
408  eta2 = eta * eta;
416  
417 +  barostat_kinetic = 3.0 * NkBT * tauBarostat * tauBarostat * eta * eta /
418 +    (2.0 * eConvert);
419 +  
420 +  barostat_potential = (targetPressure * tStats->getVolume() / p_convert) /
421 +    eConvert;
422  
423 <  extra = ((double)info->ndfTrans * kB * targetTemp * tb2 * eta2 / 2.0) / eConvert;
424 <
423 >  conservedQuantity = Energy + thermostat_kinetic + thermostat_potential +
424 >    barostat_kinetic + barostat_potential;
425 >  
426    cout.width(8);
427    cout.precision(8);
428  
429 <  
430 < //   cout << info->getTime() << "\t"
431 < //        << chi << "\t"
419 < //        << eta << "\t"
420 < //        << U << "\t"
421 < //        << TS << "\t"
422 < //        << PV << "\t"
423 < //        << extra << "\t"
424 < //        << U+TS+PV+extra << endl;
429 >  cerr << info->getTime() << "\t" << Energy << "\t" << thermostat_kinetic <<
430 >      "\t" << thermostat_potential << "\t" << barostat_kinetic <<
431 >      "\t" << barostat_potential << "\t" << conservedQuantity << endl;
432  
426  conservedQuantity = U+TS+PV+extra;
433    return conservedQuantity;
434   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines