--- trunk/src/parallel/ForceMatrixDecomposition.cpp 2015/03/03 16:24:44 2061 +++ trunk/src/parallel/ForceMatrixDecomposition.cpp 2015/03/09 17:10:26 2077 @@ -513,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, @@ -551,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); @@ -572,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); @@ -683,12 +686,12 @@ namespace OpenMD { AtomPlanPotRow->scatter(pot_row, pot_temp); AtomPlanPotRow->scatter(expot_row, expot_temp); - for (int ii = 0; ii < pot_temp.size(); ii++ ) + for (std::size_t ii = 0; ii < pot_temp.size(); ii++ ) pairwisePot += pot_temp[ii]; - for (int ii = 0; ii < expot_temp.size(); ii++ ) + for (std::size_t ii = 0; ii < expot_temp.size(); ii++ ) excludedPot += expot_temp[ii]; - + if (storageLayout_ & DataStorage::dslParticlePot) { // This is the pairwise contribution to the particle pot. The // embedding contribution is added in each of the low level @@ -711,12 +714,12 @@ namespace OpenMD { AtomPlanPotColumn->scatter(pot_col, pot_temp); AtomPlanPotColumn->scatter(expot_col, expot_temp); - for (int ii = 0; ii < pot_temp.size(); ii++ ) + for (std::size_t ii = 0; ii < pot_temp.size(); ii++ ) pairwisePot += pot_temp[ii]; - for (int ii = 0; ii < expot_temp.size(); ii++ ) + for (std::size_t ii = 0; ii < expot_temp.size(); ii++ ) excludedPot += expot_temp[ii]; - + if (storageLayout_ & DataStorage::dslParticlePot) { // This is the pairwise contribution to the particle pot. The // embedding contribution is added in each of the low level @@ -782,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; @@ -802,8 +806,6 @@ namespace OpenMD { } - - int& ForceMatrixDecomposition::getNAtomsInRow() { #ifdef IS_MPI return nAtomsInRow_; @@ -831,9 +833,10 @@ namespace OpenMD { #endif } - Vector3d ForceMatrixDecomposition::getIntergroupVector(int cg1, int cg2){ + Vector3d ForceMatrixDecomposition::getIntergroupVector(int cg1, + int cg2){ + Vector3d d; - #ifdef IS_MPI d = cgColData.position[cg2] - cgRowData.position[cg1]; #else @@ -863,8 +866,8 @@ namespace OpenMD { } - Vector3d ForceMatrixDecomposition::getAtomToGroupVectorRow(int atom1, int cg1){ - + Vector3d ForceMatrixDecomposition::getAtomToGroupVectorRow(int atom1, + int cg1) { Vector3d d; #ifdef IS_MPI @@ -878,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 @@ -909,7 +913,8 @@ namespace OpenMD { } - Vector3d ForceMatrixDecomposition::getInteratomicVector(int atom1, int atom2){ + Vector3d ForceMatrixDecomposition::getInteratomicVector(int atom1, + int atom2){ Vector3d d; #ifdef IS_MPI @@ -931,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 @@ -1502,13 +1508,10 @@ namespace OpenMD { } // find xyz-indices of cell that cutoffGroup is in. - whichCell.x() = nCells_.x() * scaled.x(); - whichCell.y() = nCells_.y() * scaled.y(); - whichCell.z() = nCells_.z() * scaled.z(); + whichCell.x() = int(nCells_.x() * scaled.x()); + whichCell.y() = int(nCells_.y() * scaled.y()); + whichCell.z() = int(nCells_.z() * scaled.z()); - // find single index of this cell: - int m1 = Vlinear(whichCell, nCells_); - for (vector::iterator os = cellOffsets_.begin(); os != cellOffsets_.end(); ++os) {