ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/branches/new_design/OOPSE-3.0/src/brains/SimInfo.cpp
(Generate patch)

Comparing branches/new_design/OOPSE-3.0/src/brains/SimInfo.cpp (file contents):
Revision 1841 by tim, Fri Dec 3 17:59:45 2004 UTC vs.
Revision 1856 by tim, Mon Dec 6 04:49:53 2004 UTC

# Line 109 | Line 109 | SimInfo::SimInfo(std::vector<std::pair<MoleculeStamp*,
109      //file plus the number of  rigid bodies defined in meta-data file
110      nGlobalIntegrableObjects_ = nGlobalAtoms_ - nRigidAtoms + nGlobalRigidBodies_;
111  
112    //initialize globalGroupMembership_, every element of this array will be 0
113    globalGroupMembership_.insert(globalGroupMembership_.end(), nGlobalAtoms_, 0);
114
112      nGlobalMols_ = molStampIds_.size();
113  
114   #ifdef IS_MPI    
# Line 149 | Line 146 | bool SimInfo::addMolecule(Molecule* mol) {
146          nCutoffGroups_ += mol->getNCutoffGroups();
147          nConstraints_ += mol->getNConstraints();
148  
149 +        addExcludePairs(mol);
150 +        
151          return true;
152      } else {
153          return false;
# Line 172 | Line 171 | bool SimInfo::removeMolecule(Molecule* mol) {
171          nCutoffGroups_ -= mol->getNCutoffGroups();
172          nConstraints_ -= mol->getNConstraints();
173  
174 +        removeExcludePairs(mol);
175          molecules_.erase(mol->getGlobalIndex());
176  
177          delete mol;
# Line 605 | Line 605 | void SimInfo::setupFortranSim() {
605      //molMembershipArray is filled by SimCreator    
606      std::vector<int> molMembershipArray(nGlobalAtoms_);
607      for (int i = 0; i < nGlobalAtoms_; i++) {
608 <        molMembershipArray.push_back(globalMolMembership_[i] + 1);
608 >        molMembershipArray[i] = globalMolMembership_[i] + 1;
609      }
610      
611      //setup fortran simulation
# Line 820 | Line 820 | std::ostream& operator <<(std::ostream& o, SimInfo& in
820      
821   }
822  
823 + Vector3d SimInfo::getComVel(){
824 +    SimInfo::MoleculeIterator i;
825 +    Molecule* mol;
826 +
827 +    Vector3d comVel(0.0);
828 +    double totalMass = 0.0;
829 +    
830 +
831 +    for (mol = beginMolecule(i); mol != NULL; mol = nextMolecule(i)) {
832 +        double mass = mol->getMass();
833 +        totalMass += mass;
834 +        comVel += mass * mol->getComVel();
835 +    }  
836 +
837 +    comVel /= totalMass;
838 +
839 +    return comVel;
840 + }
841 +
842 + Vector3d SimInfo::getCom(){
843 +    SimInfo::MoleculeIterator i;
844 +    Molecule* mol;
845 +
846 +    Vector3d com(0.0);
847 +    double totalMass = 0.0;
848 +    
849 +    for (mol = beginMolecule(i); mol != NULL; mol = nextMolecule(i)) {
850 +        double mass = mol->getMass();
851 +        totalMass += mass;
852 +        com += mass * mol->getCom();
853 +    }  
854 +
855 +    com /= totalMass;
856 +
857 +    return com;
858 +
859 + }        
860 +
861   std::ostream& operator <<(std::ostream& o, SimInfo& info) {
862  
863      return o;
864   }
865  
866   }//end namespace oopse
867 +

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines