--- branches/development/src/constraints/Rattle.cpp 2011/11/22 20:38:56 1665 +++ branches/development/src/constraints/Rattle.cpp 2012/05/22 21:55:31 1715 @@ -45,8 +45,12 @@ namespace OpenMD { #include "utils/simError.h" namespace OpenMD { - Rattle::Rattle(SimInfo* info) : info_(info), maxConsIteration_(10), consTolerance_(1.0e-6) { + Rattle::Rattle(SimInfo* info) : info_(info), maxConsIteration_(10), consTolerance_(1.0e-6), doRattle_(false) { + if (info_->getNConstraints() > 0) + doRattle_ = true; + + if (info_->getSimParams()->haveDt()) { dt_ = info_->getSimParams()->getDt(); } else { @@ -60,17 +64,17 @@ namespace OpenMD { } void Rattle::constraintA() { - if (info_->getNConstraints() > 0) { - doConstraint(&Rattle::constraintPairA); - } + if (!doRattle_) return; + doConstraint(&Rattle::constraintPairA); } void Rattle::constraintB() { - if (info_->getNConstraints() > 0) { - doConstraint(&Rattle::constraintPairB); - } + if (!doRattle_) return; + doConstraint(&Rattle::constraintPairB); } void Rattle::doConstraint(ConstraintPairFuncPtr func) { + if (!doRattle_) return; + Molecule* mol; SimInfo::MoleculeIterator mi; ConstraintElem* consElem; @@ -149,6 +153,7 @@ namespace OpenMD { } int Rattle::constraintPairA(ConstraintPair* consPair){ + ConstraintElem* consElem1 = consPair->getConsElem1(); ConstraintElem* consElem2 = consPair->getConsElem2();