--- trunk/src/restraints/ThermoIntegrationForceManager.cpp 2009/09/07 16:31:51 1360 +++ trunk/src/restraints/ThermoIntegrationForceManager.cpp 2014/02/26 14:14:50 1969 @@ -6,19 +6,10 @@ * redistribute this software in source and binary code form, provided * that the following conditions are met: * - * 1. Acknowledgement of the program authors must be made in any - * publication of scientific results based in part on use of the - * program. An acceptable form of acknowledgement is citation of - * the article in which the program was described (Matthew - * A. Meineke, Charles F. Vardeman II, Teng Lin, Christopher - * J. Fennell and J. Daniel Gezelter, "OOPSE: An Object-Oriented - * Parallel Simulation Engine for Molecular Dynamics," - * J. Comput. Chem. 26, pp. 252-271 (2005)) - * - * 2. Redistributions of source code must retain the above copyright + * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * - * 3. Redistributions in binary form must reproduce the above copyright + * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the * distribution. @@ -37,16 +28,25 @@ * arising out of the use of or inability to use software, even if the * University of Notre Dame has been advised of the possibility of * such damages. + * + * SUPPORT OPEN SCIENCE! If you use OpenMD or its source code in your + * research, please cite the appropriate papers when you publish your + * work. Good starting points are: + * + * [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, 234107 (2008). + * [4] Kuang & Gezelter, J. Chem. Phys. 133, 164101 (2010). + * [5] Vardeman, Stocker & Gezelter, J. Chem. Theory Comput. 7, 834 (2011). */ - -#include "restraints/ThermoIntegrationForceManager.hpp" - #ifdef IS_MPI #include #endif -namespace oopse { +#include "restraints/ThermoIntegrationForceManager.hpp" + +namespace OpenMD { ThermoIntegrationForceManager::ThermoIntegrationForceManager(SimInfo* info): RestraintForceManager(info){ @@ -60,7 +60,7 @@ namespace oopse { tIntLambda_ = 1.0; sprintf(painCave.errMsg, "ThermoIntegration error: the transformation parameter\n" - "\t(lambda) was not specified. OOPSE will use a default\n" + "\t(lambda) was not specified. OpenMD will use a default\n" "\tvalue of %f. To set lambda, use the \n" "\tthermodynamicIntegrationLambda variable.\n", tIntLambda_); @@ -75,7 +75,7 @@ namespace oopse { tIntK_ = 1.0; sprintf(painCave.errMsg, "ThermoIntegration Warning: the tranformation parameter\n" - "\texponent (k) was not specified. OOPSE will use a default\n" + "\texponent (k) was not specified. OpenMD will use a default\n" "\tvalue of %f. To set k, use the thermodynamicIntegrationK\n" "\tvariable.\n", tIntK_); @@ -90,53 +90,53 @@ namespace oopse { ThermoIntegrationForceManager::~ThermoIntegrationForceManager(){ } - void ThermoIntegrationForceManager::calcForces(bool needPotential, - bool needStress){ + void ThermoIntegrationForceManager::calcForces(){ Snapshot* curSnapshot; SimInfo::MoleculeIterator mi; Molecule* mol; Molecule::IntegrableObjectIterator ii; - StuntDouble* integrableObject; + StuntDouble* sd; Vector3d frc; Vector3d trq; Mat3x3d tempTau; // perform the standard calcForces first - ForceManager::calcForces(needPotential, needStress); + ForceManager::calcForces(); curSnapshot = info_->getSnapshotManager()->getCurrentSnapshot(); - // now scale forces and torques of all the integrableObjects + // now scale forces and torques of all the sds for (mol = info_->beginMolecule(mi); mol != NULL; mol = info_->nextMolecule(mi)) { - for (integrableObject = mol->beginIntegrableObject(ii); - integrableObject != NULL; - integrableObject = mol->nextIntegrableObject(ii)) { - frc = integrableObject->getFrc(); + + for (sd = mol->beginIntegrableObject(ii); sd != NULL; + sd = mol->nextIntegrableObject(ii)) { + + frc = sd->getFrc(); frc *= factor_; - integrableObject->setFrc(frc); + sd->setFrc(frc); - if (integrableObject->isDirectional()){ - trq = integrableObject->getTrq(); + if (sd->isDirectional()){ + trq = sd->getTrq(); trq *= factor_; - integrableObject->setTrq(trq); + sd->setTrq(trq); } } } - // set vraw to be the unmodulated potential - lrPot_ = curSnapshot->statData[Stats::LONG_RANGE_POTENTIAL]; - curSnapshot->statData[Stats::VRAW] = lrPot_; + // set rawPotential to be the unmodulated potential + lrPot_ = curSnapshot->getLongRangePotential(); + curSnapshot->setRawPotential(lrPot_); // modulate the potential and update the snapshot lrPot_ *= factor_; - curSnapshot->statData[Stats::LONG_RANGE_POTENTIAL] = lrPot_; + curSnapshot->setLongRangePotential(lrPot_); // scale the pressure tensor - tempTau = curSnapshot->statData.getTau(); + tempTau = curSnapshot->getStressTensor(); tempTau *= factor_; - curSnapshot->statData.setTau(tempTau); + curSnapshot->setStressTensor(tempTau); // now, on to the applied restraining potentials (if needed): RealType restPot_local = 0.0; @@ -144,17 +144,16 @@ namespace oopse { if (simParam->getUseRestraints()) { // do restraints from RestraintForceManager: - //restPot_local = doRestraints(1.0 - factor_); restPot_local = doRestraints(1.0 - factor_); vHarm_local = getUnscaledPotential(); } #ifdef IS_MPI RealType restPot; - MPI::COMM_WORLD.Allreduce(&restPot_local, &restPot, 1, - MPI::REALTYPE, MPI::SUM); - MPI::COMM_WORLD.Allreduce(&vHarm_local, &vHarm_, 1, - MPI::REALTYPE, MPI::SUM); + MPI_Allreduce(&restPot_local, &restPot, 1, + MPI_REALTYPE, MPI_SUM, MPI_COMM_WORLD); + MPI_Allreduce(&vHarm_local, &vHarm_, 1, + MPI_REALTYPE, MPI_SUM, MPI_COMM_WORLD); lrPot_ += restPot; #else lrPot_ += restPot_local; @@ -162,7 +161,7 @@ namespace oopse { #endif // give the final values to stats - curSnapshot->statData[Stats::LONG_RANGE_POTENTIAL] = lrPot_; - curSnapshot->statData[Stats::VHARM] = vHarm_; + curSnapshot->setLongRangePotential(lrPot_); + curSnapshot->setRestraintPotential(vHarm_); } }