--- branches/new_design/OOPSE-2.0/src/brains/SimInfo.cpp 2004/12/03 17:59:45 1841 +++ branches/new_design/OOPSE-2.0/src/brains/SimInfo.cpp 2004/12/06 04:49:53 1856 @@ -109,9 +109,6 @@ SimInfo::SimInfo(std::vectorgetNCutoffGroups(); nConstraints_ += mol->getNConstraints(); + addExcludePairs(mol); + return true; } else { return false; @@ -172,6 +171,7 @@ bool SimInfo::removeMolecule(Molecule* mol) { nCutoffGroups_ -= mol->getNCutoffGroups(); nConstraints_ -= mol->getNConstraints(); + removeExcludePairs(mol); molecules_.erase(mol->getGlobalIndex()); delete mol; @@ -605,7 +605,7 @@ void SimInfo::setupFortranSim() { //molMembershipArray is filled by SimCreator std::vector molMembershipArray(nGlobalAtoms_); for (int i = 0; i < nGlobalAtoms_; i++) { - molMembershipArray.push_back(globalMolMembership_[i] + 1); + molMembershipArray[i] = globalMolMembership_[i] + 1; } //setup fortran simulation @@ -820,9 +820,48 @@ std::ostream& operator <<(std::ostream& o, SimInfo& in } +Vector3d SimInfo::getComVel(){ + SimInfo::MoleculeIterator i; + Molecule* mol; + + Vector3d comVel(0.0); + double totalMass = 0.0; + + + for (mol = beginMolecule(i); mol != NULL; mol = nextMolecule(i)) { + double mass = mol->getMass(); + totalMass += mass; + comVel += mass * mol->getComVel(); + } + + comVel /= totalMass; + + return comVel; +} + +Vector3d SimInfo::getCom(){ + SimInfo::MoleculeIterator i; + Molecule* mol; + + Vector3d com(0.0); + double totalMass = 0.0; + + for (mol = beginMolecule(i); mol != NULL; mol = nextMolecule(i)) { + double mass = mol->getMass(); + totalMass += mass; + com += mass * mol->getCom(); + } + + com /= totalMass; + + return com; + +} + std::ostream& operator <<(std::ostream& o, SimInfo& info) { return o; } }//end namespace oopse +