--- trunk/src/parallel/ForceMatrixDecomposition.cpp 2015/03/03 15:22:26 2057 +++ trunk/src/parallel/ForceMatrixDecomposition.cpp 2015/03/03 16:40:39 2062 @@ -436,15 +436,16 @@ namespace OpenMD { void ForceMatrixDecomposition::distributeData() { + +#ifdef IS_MPI + snap_ = sman_->getCurrentSnapshot(); storageLayout_ = sman_->getStorageLayout(); - + bool needsCG = true; if(info_->getNCutoffGroups() != info_->getNAtoms()) needsCG = false; - -#ifdef IS_MPI - + // gather up the atomic positions AtomPlanVectorRow->gather(snap_->atomData.position, atomRowData.position); @@ -512,10 +513,11 @@ namespace OpenMD { * data structures. */ void ForceMatrixDecomposition::collectIntermediateData() { +#ifdef IS_MPI + snap_ = sman_->getCurrentSnapshot(); storageLayout_ = sman_->getStorageLayout(); -#ifdef IS_MPI - + if (storageLayout_ & DataStorage::dslDensity) { AtomPlanRealRow->scatter(atomRowData.density, @@ -550,9 +552,10 @@ namespace OpenMD { * row and column-indexed data structures */ void ForceMatrixDecomposition::distributeIntermediateData() { +#ifdef IS_MPI snap_ = sman_->getCurrentSnapshot(); storageLayout_ = sman_->getStorageLayout(); -#ifdef IS_MPI + if (storageLayout_ & DataStorage::dslFunctional) { AtomPlanRealRow->gather(snap_->atomData.functional, atomRowData.functional); @@ -571,9 +574,10 @@ namespace OpenMD { void ForceMatrixDecomposition::collectData() { +#ifdef IS_MPI snap_ = sman_->getCurrentSnapshot(); storageLayout_ = sman_->getStorageLayout(); -#ifdef IS_MPI + int n = snap_->atomData.force.size(); vector frc_tmp(n, V3Zero); @@ -781,10 +785,11 @@ namespace OpenMD { * functional) loops onto local data structures. */ void ForceMatrixDecomposition::collectSelfData() { + +#ifdef IS_MPI snap_ = sman_->getCurrentSnapshot(); storageLayout_ = sman_->getStorageLayout(); -#ifdef IS_MPI for (int ii = 0; ii < N_INTERACTION_FAMILIES; ii++) { RealType ploc1 = embeddingPot[ii]; RealType ploc2 = 0.0; @@ -801,8 +806,6 @@ namespace OpenMD { } - - int& ForceMatrixDecomposition::getNAtomsInRow() { #ifdef IS_MPI return nAtomsInRow_; @@ -830,9 +833,10 @@ namespace OpenMD { #endif } - Vector3d ForceMatrixDecomposition::getIntergroupVector(int cg1, int cg2){ + inline Vector3d ForceMatrixDecomposition::getIntergroupVector(int cg1, + int cg2){ + Vector3d d; - #ifdef IS_MPI d = cgColData.position[cg2] - cgRowData.position[cg1]; #else @@ -862,8 +866,8 @@ namespace OpenMD { } - Vector3d ForceMatrixDecomposition::getAtomToGroupVectorRow(int atom1, int cg1){ - + Vector3d ForceMatrixDecomposition::getAtomToGroupVectorRow(int atom1, + int cg1) { Vector3d d; #ifdef IS_MPI @@ -877,7 +881,8 @@ namespace OpenMD { return d; } - Vector3d ForceMatrixDecomposition::getAtomToGroupVectorColumn(int atom2, int cg2){ + Vector3d ForceMatrixDecomposition::getAtomToGroupVectorColumn(int atom2, + int cg2) { Vector3d d; #ifdef IS_MPI @@ -908,7 +913,8 @@ namespace OpenMD { } - Vector3d ForceMatrixDecomposition::getInteratomicVector(int atom1, int atom2){ + inline Vector3d ForceMatrixDecomposition::getInteratomicVector(int atom1, + int atom2){ Vector3d d; #ifdef IS_MPI @@ -930,7 +936,8 @@ namespace OpenMD { * We need to exclude some overcounted interactions that result from * the parallel decomposition. */ - bool ForceMatrixDecomposition::skipAtomPair(int atom1, int atom2, int cg1, int cg2) { + bool ForceMatrixDecomposition::skipAtomPair(int atom1, int atom2, + int cg1, int cg2) { int unique_id_1, unique_id_2; #ifdef IS_MPI