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 |
|
|
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); |
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) { |
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(¶llelData, &(parallelData.nAtomsLocal), |
687 |
> |
&localToGlobalAtomIndex[0], &(parallelData.nGroupsLocal), |
688 |
|
&localToGlobalCutoffGroupIndex[0], &isError); |
689 |
|
|
690 |
|
if (isError) { |
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; |
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; |