--- branches/development/src/nonbonded/MAW.cpp 2011/06/14 20:41:44 1582 +++ branches/development/src/nonbonded/MAW.cpp 2011/11/22 14:37:41 1664 @@ -50,53 +50,43 @@ namespace OpenMD { namespace OpenMD { - MAW::MAW() : name_("MAW"), initialized_(false), forceField_(NULL), - shiftedPot_(false), shiftedFrc_(false) {} + MAW::MAW() : name_("MAW"), initialized_(false), forceField_(NULL) {} void MAW::initialize() { ForceField::NonBondedInteractionTypeContainer* nbiTypes = forceField_->getNonBondedInteractionTypes(); ForceField::NonBondedInteractionTypeContainer::MapTypeIterator j; NonBondedInteractionType* nbt; + ForceField::NonBondedInteractionTypeContainer::KeyType keys; for (nbt = nbiTypes->beginType(j); nbt != NULL; nbt = nbiTypes->nextType(j)) { if (nbt->isMAW()) { - pair atypes = nbt->getAtomTypes(); - - GenericData* data = nbt->getPropertyByName("MAW"); - if (data == NULL) { - sprintf( painCave.errMsg, "MAW::initialize could not find\n" - "\tMAW parameters for %s - %s interaction.\n", - atypes.first->getName().c_str(), - atypes.second->getName().c_str()); - painCave.severity = OPENMD_ERROR; - painCave.isFatal = 1; - simError(); - } - - MAWData* mawData = dynamic_cast(data); - if (mawData == NULL) { + keys = nbiTypes->getKeys(j); + AtomType* at1 = forceField_->getAtomType(keys[0]); + AtomType* at2 = forceField_->getAtomType(keys[1]); + + MAWInteractionType* mit = dynamic_cast(nbt); + + if (mit == NULL) { sprintf( painCave.errMsg, - "MAW::initialize could not convert GenericData to\n" - "\tMAWData for %s - %s interaction.\n", - atypes.first->getName().c_str(), - atypes.second->getName().c_str()); + "MAW::initialize could not convert NonBondedInteractionType\n" + "\tto MAWInteractionType for %s - %s interaction.\n", + at1->getName().c_str(), + at2->getName().c_str()); painCave.severity = OPENMD_ERROR; painCave.isFatal = 1; simError(); } - MAWParam mawParam = mawData->getData(); - - RealType De = mawParam.De; - RealType beta = mawParam.beta; - RealType Re = mawParam.Re; - RealType ca1 = mawParam.ca1; - RealType cb1 = mawParam.cb1; + RealType De = mit->getD(); + RealType beta = mit->getBeta(); + RealType Re = mit->getR(); + RealType ca1 = mit->getCA1(); + RealType cb1 = mit->getCB1(); - addExplicitInteraction(atypes.first, atypes.second, + addExplicitInteraction(at1, at2, De, beta, Re, ca1, cb1); } } @@ -172,16 +162,16 @@ namespace OpenMD { myPot = D_e * (expfnc2 - 2.0 * expfnc); myDeriv = 2.0 * D_e * beta * (expfnc - expfnc2); - if (MAW::shiftedPot_ || MAW::shiftedFrc_) { + if (idat.shiftedPot || idat.shiftedForce) { exptC = -beta*( *(idat.rcut) - R_e); expfncC = exp(exptC); expfnc2C = expfncC*expfncC; } - if (MAW::shiftedPot_) { + if (idat.shiftedPot) { myPotC = D_e * (expfnc2C - 2.0 * expfncC); myDerivC = 0.0; - } else if (MAW::shiftedFrc_) { + } else if (idat.shiftedForce) { myPotC = D_e * (expfnc2C - 2.0 * expfncC); myDerivC = 2.0 * D_e * beta * (expfnc2C - expfnc2C); myPotC += myDerivC * ( *(idat.rij) - *(idat.rcut) );