--- trunk/src/brains/SimInfo.cpp 2005/02/13 20:36:24 328 +++ trunk/src/brains/SimInfo.cpp 2005/04/13 18:41:17 490 @@ -65,15 +65,15 @@ namespace oopse { namespace oopse { -SimInfo::SimInfo(std::vector >& molStampPairs, +SimInfo::SimInfo(MakeStamps* stamps, std::vector >& molStampPairs, ForceField* ff, Globals* simParams) : - forceField_(ff), simParams_(simParams), + stamps_(stamps), forceField_(ff), simParams_(simParams), ndf_(0), ndfRaw_(0), ndfTrans_(0), nZconstraint_(0), nGlobalMols_(0), nGlobalAtoms_(0), nGlobalCutoffGroups_(0), nGlobalIntegrableObjects_(0), nGlobalRigidBodies_(0), nAtoms_(0), nBonds_(0), nBends_(0), nTorsions_(0), nRigidBodies_(0), nIntegrableObjects_(0), nCutoffGroups_(0), nConstraints_(0), - sman_(NULL), fortranInitialized_(false), selectMan_(NULL) { + sman_(NULL), fortranInitialized_(false) { std::vector >::iterator i; @@ -139,19 +139,19 @@ 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(); + + delete stamps_; delete sman_; delete simParams_; delete forceField_; - delete selectMan_; } int SimInfo::getNGlobalConstraints() { @@ -366,7 +366,19 @@ 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); + } + } + } + } void SimInfo::removeExcludePairs(Molecule* mol) { @@ -410,6 +422,19 @@ void SimInfo::removeExcludePairs(Molecule* mol) { exclude_.removePair(b, d); 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); + } + } + } } @@ -645,9 +670,6 @@ void SimInfo::setupFortranSim() { } //setup fortran simulation - //gloalExcludes and molMembershipArray should go away (They are never used) - //why the hell fortran need to know molecule? - //OOPSE = Object-Obfuscated Parallel Simulation Engine int nGlobalExcludes = 0; int* globalExcludes = NULL; int* excludeList = exclude_.getExcludeList(); @@ -835,6 +857,10 @@ void SimInfo::setSnapshotManager(SnapshotManager* sman } void SimInfo::setSnapshotManager(SnapshotManager* sman) { + if (sman_ == sman) { + return; + } + delete sman_; sman_ = sman; Molecule* mol;