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" |
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 |
|
|
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; |