--- trunk/src/brains/ForceManager.cpp 2013/08/05 16:13:46 1923 +++ trunk/src/brains/ForceManager.cpp 2014/02/26 14:14:50 1969 @@ -637,14 +637,23 @@ namespace OpenMD { // Collect from all nodes. This should eventually be moved into a // SystemDecomposition, but this is a better place than in // Thermo to do the collection. - MPI::COMM_WORLD.Allreduce(MPI::IN_PLACE, &bondPotential, 1, MPI::REALTYPE, - MPI::SUM); - MPI::COMM_WORLD.Allreduce(MPI::IN_PLACE, &bendPotential, 1, MPI::REALTYPE, - MPI::SUM); - MPI::COMM_WORLD.Allreduce(MPI::IN_PLACE, &torsionPotential, 1, - MPI::REALTYPE, MPI::SUM); - MPI::COMM_WORLD.Allreduce(MPI::IN_PLACE, &inversionPotential, 1, - MPI::REALTYPE, MPI::SUM); + + MPI_Allreduce(MPI_IN_PLACE, &bondPotential, 1, MPI_REALTYPE, + MPI_SUM, MPI_COMM_WORLD); + MPI_Allreduce(MPI_IN_PLACE, &bendPotential, 1, MPI_REALTYPE, + MPI_SUM, MPI_COMM_WORLD); + MPI_Allreduce(MPI_IN_PLACE, &torsionPotential, 1, + MPI_REALTYPE, MPI_SUM, MPI_COMM_WORLD); + MPI_Allreduce(MPI_IN_PLACE, &inversionPotential, 1, + MPI_REALTYPE, MPI_SUM, MPI_COMM_WORLD); + // MPI::COMM_WORLD.Allreduce(MPI::IN_PLACE, &bondPotential, 1, MPI::REALTYPE, + // MPI::SUM); + // MPI::COMM_WORLD.Allreduce(MPI::IN_PLACE, &bendPotential, 1, MPI::REALTYPE, + // MPI::SUM); + // MPI::COMM_WORLD.Allreduce(MPI::IN_PLACE, &torsionPotential, 1, + // MPI::REALTYPE, MPI::SUM); + // MPI::COMM_WORLD.Allreduce(MPI::IN_PLACE, &inversionPotential, 1, + // MPI::REALTYPE, MPI::SUM); #endif Snapshot* curSnapshot = info_->getSnapshotManager()->getCurrentSnapshot(); @@ -666,6 +675,7 @@ namespace OpenMD { DataStorage* config = &(curSnapshot->atomData); DataStorage* cgConfig = &(curSnapshot->cgData); + //calculate the center of mass of cutoff group SimInfo::MoleculeIterator mi; @@ -709,7 +719,7 @@ namespace OpenMD { RealType dVdFQ1(0.0); RealType dVdFQ2(0.0); potVec longRangePotential(0.0); - potVec reciprocalPotential(0.0); + RealType reciprocalPotential(0.0); potVec workPot(0.0); potVec exPot(0.0); Vector3d eField1(0.0); @@ -770,7 +780,6 @@ namespace OpenMD { rgrpsq = d_grp.lengthSquare(); if (rgrpsq < rCutSq) { - if (iLoop == PAIR_LOOP) { vij = 0.0; fij.zero(); @@ -827,7 +836,7 @@ namespace OpenMD { r = sqrt( *(idat.r2) ); idat.rij = &r; - + if (iLoop == PREPAIR_LOOP) { interactionMan_->doPrePair(idat); } else { @@ -928,6 +937,8 @@ namespace OpenMD { fDecomp_->collectData(); if (cutoffMethod_ == EWALD_FULL) { interactionMan_->doReciprocalSpaceSum(reciprocalPotential); + + curSnapshot->setReciprocalPotential(reciprocalPotential); } if (info_->requiresSelfCorrection()) { @@ -941,7 +952,7 @@ namespace OpenMD { fDecomp_->collectSelfData(); longRangePotential = *(fDecomp_->getEmbeddingPotential()) + - *(fDecomp_->getPairwisePotential()) + reciprocalPotential; + *(fDecomp_->getPairwisePotential()); curSnapshot->setLongRangePotential(longRangePotential); @@ -975,8 +986,10 @@ namespace OpenMD { } #ifdef IS_MPI - MPI::COMM_WORLD.Allreduce(MPI::IN_PLACE, stressTensor.getArrayPointer(), 9, - MPI::REALTYPE, MPI::SUM); + MPI_Allreduce(MPI_IN_PLACE, stressTensor.getArrayPointer(), 9, + MPI_REALTYPE, MPI_SUM, MPI_COMM_WORLD); + // MPI::COMM_WORLD.Allreduce(MPI::IN_PLACE, stressTensor.getArrayPointer(), 9, + // MPI::REALTYPE, MPI::SUM); #endif curSnapshot->setStressTensor(stressTensor);