--- branches/development/src/nonbonded/LJ.cpp 2010/07/19 20:42:55 1472 +++ branches/development/src/nonbonded/LJ.cpp 2010/07/21 18:31:05 1476 @@ -107,6 +107,7 @@ namespace OpenMD { } RealType LJ::getSigma(int atid) { + if (!initialized_) initialize(); std::map :: const_iterator it; it = LJMap.find(atid); if (it == LJMap.end()) { @@ -142,6 +143,7 @@ namespace OpenMD { } RealType LJ::getEpsilon(int atid) { + if (!initialized_) initialize(); std::map :: const_iterator it; it = LJMap.find(atid); if (it == LJMap.end()) { @@ -164,23 +166,23 @@ namespace OpenMD { } void LJ::initialize() { - ForceField::AtomTypeContainer atomTypes = forceField_->getAtomTypes(); + ForceField::AtomTypeContainer* atomTypes = forceField_->getAtomTypes(); ForceField::AtomTypeContainer::MapTypeIterator i; AtomType* at; - for (at = atomTypes.beginType(i); at != NULL; - at = atomTypes.nextType(i)) { + for (at = atomTypes->beginType(i); at != NULL; + at = atomTypes->nextType(i)) { if (at->isLennardJones()) addType(at); } - ForceField::NonBondedInteractionTypeContainer nbiTypes = forceField_->getNonBondedInteractionTypes(); + ForceField::NonBondedInteractionTypeContainer* nbiTypes = forceField_->getNonBondedInteractionTypes(); ForceField::NonBondedInteractionTypeContainer::MapTypeIterator j; NonBondedInteractionType* nbt; - for (nbt = nbiTypes.beginType(j); nbt != NULL; - nbt = nbiTypes.nextType(j)) { + for (nbt = nbiTypes->beginType(j); nbt != NULL; + nbt = nbiTypes->nextType(j)) { if (nbt->isLennardJones()) { @@ -228,7 +230,8 @@ namespace OpenMD { // add it to the map: AtomTypeProperties atp = atomType->getATP(); - std::pair::iterator,bool> ret; + + std::pair::iterator,bool> ret; ret = LJMap.insert( std::pair(atp.ident, atomType) ); if (ret.second == false) { sprintf( painCave.errMsg, @@ -305,6 +308,7 @@ namespace OpenMD { RealType sigmai = mixer.sigmai; RealType epsilon = mixer.epsilon; + ros = rij * sigmai; getLJfunc(ros, myPot, myDeriv); @@ -331,6 +335,7 @@ namespace OpenMD { f1 = d * dudr / rij; return; + } void LJ::do_lj_pair(int *atid1, int *atid2, RealType *d, RealType *rij, @@ -352,7 +357,7 @@ namespace OpenMD { f1[0] = frc.x(); f1[1] = frc.y(); f1[2] = frc.z(); - + return; }