--- branches/development/src/nonbonded/InteractionManager.cpp 2011/06/21 06:34:35 1586 +++ branches/development/src/nonbonded/InteractionManager.cpp 2011/11/22 20:38:56 1665 @@ -36,7 +36,8 @@ * [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). + * [4] Kuang & Gezelter, J. Chem. Phys. 133, 164101 (2010). + * [5] Vardeman, Stocker & Gezelter, J. Chem. Theory Comput. 7, 834 (2011). */ #include "nonbonded/InteractionManager.hpp" @@ -51,6 +52,7 @@ namespace OpenMD { gb_ = new GB(); sticky_ = new Sticky(); morse_ = new Morse(); + repulsivePower_ = new RepulsivePower(); eam_ = new EAM(); sc_ = new SC(); electrostatic_ = new Electrostatic(); @@ -70,6 +72,7 @@ namespace OpenMD { electrostatic_->setSimInfo(info_); electrostatic_->setForceField(forceField_); maw_->setForceField(forceField_); + repulsivePower_->setForceField(forceField_); ForceField::AtomTypeContainer* atomTypes = forceField_->getAtomTypes(); ForceField::AtomTypeContainer::MapTypeIterator i1, i2; @@ -176,9 +179,33 @@ namespace OpenMD { if (ifam == VANDERWAALS_FAMILY) interactions_[key].erase(*it); } interactions_[key].insert(morse_); + vdwExplicit = true; + } + + if (nbiType->isRepulsivePower()) { + if (vdwExplicit) { + sprintf( painCave.errMsg, + "InteractionManager::initialize found more than one " + "explicit \n" + "\tvan der Waals interaction for atom types %s - %s\n", + atype1->getName().c_str(), atype2->getName().c_str()); + painCave.severity = OPENMD_ERROR; + painCave.isFatal = 1; + simError(); + } + // We found an explicit RepulsivePower interaction. + // override all other vdw entries for this pair of atom types: + set::iterator it; + for (it = interactions_[key].begin(); + it != interactions_[key].end(); ++it) { + InteractionFamily ifam = (*it)->getFamily(); + if (ifam == VANDERWAALS_FAMILY) interactions_[key].erase(*it); + } + interactions_[key].insert(repulsivePower_); vdwExplicit = true; } + if (nbiType->isEAM()) { // We found an explicit EAM interaction. // override all other metallic entries for this pair of atom types: @@ -271,6 +298,7 @@ namespace OpenMD { } void InteractionManager::setCutoffRadius(RealType rcut) { + electrostatic_->setCutoffRadius(rcut); eam_->setCutoffRadius(rcut); } @@ -283,6 +311,9 @@ namespace OpenMD { if (!initialized_) initialize(); + // excluded interaction, so just return + if (idat.excluded) return; + set::iterator it; for (it = interactions_[ idat.atypes ].begin(); @@ -314,26 +345,17 @@ namespace OpenMD { void InteractionManager::doPair(InteractionData idat){ if (!initialized_) initialize(); - + set::iterator it; for (it = interactions_[ idat.atypes ].begin(); - it != interactions_[ idat.atypes ].end(); ++it) - (*it)->calcForce(idat); - - return; - } + it != interactions_[ idat.atypes ].end(); ++it) { - void InteractionManager::doSkipCorrection(InteractionData idat){ + // electrostatics still has to worry about indirect + // contributions from excluded pairs of atoms: - if (!initialized_) initialize(); - - set::iterator it; - - for (it = interactions_[ idat.atypes ].begin(); - it != interactions_[ idat.atypes ].end(); ++it){ - if ((*it)->getFamily() == ELECTROSTATIC_FAMILY) { - dynamic_cast(*it)->calcSkipCorrection(idat); + if (!idat.excluded || (*it)->getFamily() == ELECTROSTATIC_FAMILY) { + (*it)->calcForce(idat); } }