--- trunk/src/brains/SimInfo.cpp 2005/02/13 20:05:42 326 +++ 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); + } + } + } + } @@ -765,9 +817,9 @@ void SimInfo::getCutoff(double& rcut, double& rsw) { "\tfor the cutoffRadius.\n"); painCave.isFatal = 0; simError(); - rcut_ = 15.0; + rcut = 15.0; } else{ - rcut_ = simParams_->getRcut(); + rcut = simParams_->getRcut(); } if (!simParams_->haveRsw()){ @@ -777,9 +829,9 @@ void SimInfo::getCutoff(double& rcut, double& rsw) { "\t0.95 * cutoffRadius for the switchingRadius\n"); painCave.isFatal = 0; simError(); - rsw_ = 0.95 * rcut_; + rsw = 0.95 * rcut; } else{ - rsw_ = simParams_->getRsw(); + rsw = simParams_->getRsw(); } } else { @@ -787,16 +839,16 @@ void SimInfo::getCutoff(double& rcut, double& rsw) { //meta-data file, the maximum cutoff radius calculated from forcefiled will be used if (simParams_->haveRcut()) { - rcut_ = simParams_->getRcut(); + rcut = simParams_->getRcut(); } else { //set cutoff radius to the maximum cutoff radius based on atom types in the whole system - rcut_ = calcMaxCutoffRadius(); + rcut = calcMaxCutoffRadius(); } if (simParams_->haveRsw()) { - rsw_ = simParams_->getRsw(); + rsw = simParams_->getRsw(); } else { - rsw_ = rcut_; + rsw = rcut; } } @@ -835,6 +887,11 @@ void SimInfo::setSnapshotManager(SnapshotManager* sman } void SimInfo::setSnapshotManager(SnapshotManager* sman) { + //if (sman_ == sman_) { + // return; + //} + + //delete sman_; sman_ = sman; Molecule* mol;