--- trunk/src/brains/SimInfo.cpp 2005/02/14 17:57:01 334 +++ trunk/src/brains/SimInfo.cpp 2005/03/10 23:56:42 430 @@ -73,7 +73,7 @@ SimInfo::SimInfo(std::vector >::iterator i; @@ -139,19 +139,20 @@ SimInfo::SimInfo(std::vectorselectAll(); } SimInfo::~SimInfo() { - //MemoryUtils::deleteVectorOfPointer(molecules_); - - MemoryUtils::deleteVectorOfPointer(moleculeStamps_); + std::map::iterator i; + for (i = molecules_.begin(); i != molecules_.end(); ++i) { + delete i->second; + } + molecules_.clear(); + MemoryUtils::deletePointers(moleculeStamps_); + delete sman_; delete simParams_; delete forceField_; - delete selectMan_; } int SimInfo::getNGlobalConstraints() { @@ -366,7 +367,32 @@ void SimInfo::addExcludePairs(Molecule* mol) { exclude_.addPair(c, d); } - + Molecule::RigidBodyIterator rbIter; + RigidBody* rb; + for (rb = mol->beginRigidBody(rbIter); rb != NULL; rb = mol->nextRigidBody(rbIter)) { + std::vector atoms = rb->getAtoms(); + for (int i = 0; i < atoms.size() -1 ; ++i) { + for (int j = i + 1; j < atoms.size(); ++j) { + a = atoms[i]->getGlobalIndex(); + b = atoms[j]->getGlobalIndex(); + exclude_.addPair(a, b); + } + } + } + + Molecule::CutoffGroupIterator cgIter; + CutoffGroup* cg; + for (cg = mol->beginCutoffGroup(cgIter); cg != NULL; cg = mol->nextCutoffGroup(cgIter)) { + std::vector atoms = cg->getAtoms(); + for (int i = 0; i < atoms.size() -1 ; ++i) { + for (int j = i + 1; j < atoms.size(); ++j) { + a = atoms[i]->getGlobalIndex(); + b = atoms[j]->getGlobalIndex(); + exclude_.addPair(a, b); + } + } + } + } void SimInfo::removeExcludePairs(Molecule* mol) { @@ -411,6 +437,32 @@ void SimInfo::removeExcludePairs(Molecule* mol) { exclude_.removePair(c, d); } + Molecule::RigidBodyIterator rbIter; + RigidBody* rb; + for (rb = mol->beginRigidBody(rbIter); rb != NULL; rb = mol->nextRigidBody(rbIter)) { + std::vector atoms = rb->getAtoms(); + for (int i = 0; i < atoms.size() -1 ; ++i) { + for (int j = i + 1; j < atoms.size(); ++j) { + a = atoms[i]->getGlobalIndex(); + b = atoms[j]->getGlobalIndex(); + exclude_.removePair(a, b); + } + } + } + + Molecule::CutoffGroupIterator cgIter; + CutoffGroup* cg; + for (cg = mol->beginCutoffGroup(cgIter); cg != NULL; cg = mol->nextCutoffGroup(cgIter)) { + std::vector atoms = cg->getAtoms(); + for (int i = 0; i < atoms.size() -1 ; ++i) { + for (int j = i + 1; j < atoms.size(); ++j) { + a = atoms[i]->getGlobalIndex(); + b = atoms[j]->getGlobalIndex(); + exclude_.removePair(a, b); + } + } + } + }