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 1856 by tim, Mon Dec 6 04:49:53 2004 UTC vs.
Revision 1887 by tim, Wed Dec 15 16:44:14 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"
41   #include "utils/MemoryUtils.hpp"
42   #include "utils/simError.h"
43  
44 + #ifdef IS_MPI
45 + #include "UseTheForce/mpiComponentPlan.h"
46 + #include "UseTheForce/DarkSide/simParallel_interface.h"
47 + #endif
48 +
49   namespace oopse {
50  
51   SimInfo::SimInfo(std::vector<std::pair<MoleculeStamp*, int> >& molStampPairs,
# Line 455 | 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 673 | Line 680 | void SimInfo::setupFortranParallel() {
680      parallelData.nGroupsGlobal = getNGlobalCutoffGroups();
681      parallelData.nGroupsLocal = getNCutoffGroups();
682      parallelData.myNode = worldRank;
683 <    MPI_Comm_size(MPI_COMM_WORLD, &(parallelData->nProcessors));
683 >    MPI_Comm_size(MPI_COMM_WORLD, &(parallelData.nProcessors));
684  
685      //pass mpiSimData struct and index arrays to fortran
686 <    setFsimParallel(parallelData, &(parallelData->nAtomsLocal),
687 <                    &localToGlobalAtomIndex[0],  &(parallelData->nGroupsLocal),
686 >    setFsimParallel(&parallelData, &(parallelData.nAtomsLocal),
687 >                    &localToGlobalAtomIndex[0],  &(parallelData.nGroupsLocal),
688                      &localToGlobalCutoffGroupIndex[0], &isError);
689  
690      if (isError) {
# Line 834 | Line 841 | Vector3d SimInfo::getComVel(){
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  
853      return comVel;
# Line 852 | 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