--- trunk/src/integrators/NPTxyz.cpp 2009/11/25 20:02:06 1390 +++ trunk/src/integrators/NPTxyz.cpp 2013/06/16 15:15:42 1879 @@ -35,8 +35,9 @@ * * [1] Meineke, et al., J. Comp. Chem. 26, 252-271 (2005). * [2] Fennell & Gezelter, J. Chem. Phys. 124, 234104 (2006). - * [3] Sun, Lin & Gezelter, J. Chem. Phys. 128, 24107 (2008). - * [4] Vardeman & Gezelter, in progress (2009). + * [3] Sun, Lin & Gezelter, J. Chem. Phys. 128, 234107 (2008). + * [4] Kuang & Gezelter, J. Chem. Phys. 133, 164101 (2010). + * [5] Vardeman, Stocker & Gezelter, J. Chem. Theory Comput. 7, 834 (2011). */ #include "brains/SimInfo.hpp" @@ -61,6 +62,8 @@ namespace OpenMD { RealType NPTxyz::calcConservedQuantity(){ + thermostat = snap->getThermostat(); + loadEta(); // We need NkBT a lot, so just set it here: This is the RAW number // of integrableObjects, so no subtraction or addition of constraints or @@ -80,11 +83,13 @@ namespace OpenMD { RealType barostat_potential; RealType trEta; - totalEnergy = thermo.getTotalE(); + totalEnergy = thermo.getTotalEnergy(); - thermostat_kinetic = fkBT * tt2 * chi * chi /(2.0 * PhysicalConstants::energyConvert); + thermostat_kinetic = fkBT * tt2 * thermostat.first * thermostat.first + / (2.0 * PhysicalConstants::energyConvert); - thermostat_potential = fkBT* integralOfChidt / PhysicalConstants::energyConvert; + thermostat_potential = fkBT* thermostat.second + / PhysicalConstants::energyConvert; SquareMatrix tmp = eta.transpose() * eta; trEta = tmp.trace(); @@ -104,15 +109,13 @@ namespace OpenMD { void NPTxyz::scaleSimBox(){ - int i,j,k; + int i, j; Mat3x3d scaleMat; - RealType eta2ij, scaleFactor; - RealType bigScale, smallScale, offDiagMax; + RealType scaleFactor; + RealType bigScale, smallScale; Mat3x3d hm; Mat3x3d hmnew; - - // Scale the box after all the positions have been moved: // Use a taylor expansion for eta products: Hmat = Hmat . exp(dt * etaMat) @@ -120,7 +123,6 @@ namespace OpenMD { bigScale = 1.0; smallScale = 1.0; - offDiagMax = 0.0; for(i=0; i<3; i++){ for(j=0; j<3; j++){ @@ -162,14 +164,14 @@ namespace OpenMD { simError(); } else { - Mat3x3d hmat = currentSnapshot_->getHmat(); + Mat3x3d hmat = snap->getHmat(); hmat = hmat *scaleMat; - currentSnapshot_->setHmat(hmat); + snap->setHmat(hmat); } } void NPTxyz::loadEta() { - eta= currentSnapshot_->getEta(); + eta= snap->getBarostat(); } }