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 1883 by tim, Mon Dec 13 22:30:27 2004 UTC vs.
Revision 1895 by tim, Thu Dec 16 19:20:49 2004 UTC

# Line 32 | Line 32
32  
33   #include <algorithm>
34   #include <set>
35 +
36   #include "brains/SimInfo.hpp"
37 + #include "math/Vector3.hpp"
38   #include "primitives/Molecule.hpp"
39   #include "UseTheForce/doForces_interface.h"
40   #include "UseTheForce/notifyCutoffs_interface.h"
# Line 387 | Line 389 | void SimInfo::addMoleculeStamp(MoleculeStamp* molStamp
389      int curStampId;
390  
391      //index from 0
392 <    curStampId = molStampIds_.size();
392 >    curStampId = moleculeStamps_.size();
393  
394      moleculeStamps_.push_back(molStamp);
395      molStampIds_.insert(molStampIds_.end(), nmol, curStampId);
# Line 460 | Line 462 | void SimInfo::setupSimType() {
462      int useDirectionalAtom = 0;    
463      int useElectrostatics = 0;
464      //usePBC and useRF are from simParams
465 <    bool usePBC = simParams_->getPBC();
466 <    bool useRF = simParams_->getUseRF();
465 >    int usePBC = simParams_->getPBC();
466 >    int useRF = simParams_->getUseRF();
467  
468      //loop over all of the atom types
469      for (i = atomTypes.begin(); i != atomTypes.end(); ++i) {
# Line 838 | Line 840 | Vector3d SimInfo::getComVel(){
840          totalMass += mass;
841          comVel += mass * mol->getComVel();
842      }  
843 +
844 + #ifdef IS_MPI
845 +    double tmpMass = totalMass;
846 +    Vector3d tmpComVel(comVel);    
847 +    MPI_Allreduce(&tmpMass,&totalMass,1,MPI_DOUBLE,MPI_SUM, MPI_COMM_WORLD);
848 +    MPI_Allreduce(tmpComVel.getArrayPointer(), comVel.getArrayPointer(),3,MPI_DOUBLE,MPI_SUM, MPI_COMM_WORLD);
849 + #endif
850  
851      comVel /= totalMass;
852  
# Line 857 | Line 866 | Vector3d SimInfo::getCom(){
866          com += mass * mol->getCom();
867      }  
868  
869 + #ifdef IS_MPI
870 +    double tmpMass = totalMass;
871 +    Vector3d tmpCom(com);    
872 +    MPI_Allreduce(&tmpMass,&totalMass,1,MPI_DOUBLE,MPI_SUM, MPI_COMM_WORLD);
873 +    MPI_Allreduce(tmpCom.getArrayPointer(), com.getArrayPointer(),3,MPI_DOUBLE,MPI_SUM, MPI_COMM_WORLD);
874 + #endif
875 +
876      com /= totalMass;
877  
878      return com;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines