ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/OpenMD/trunk/src/parallel/ForceMatrixDecomposition.cpp
(Generate patch)

Comparing branches/development/src/parallel/ForceMatrixDecomposition.cpp (file contents):
Revision 1736 by jmichalk, Tue Jun 5 17:51:31 2012 UTC vs.
Revision 1756 by gezelter, Mon Jun 18 18:23:20 2012 UTC

# Line 461 | Line 461 | namespace OpenMD {
461      }
462    }
463  
464
464    groupCutoffs ForceMatrixDecomposition::getGroupCutoffs(int cg1, int cg2) {
465      int i, j;  
466   #ifdef IS_MPI
# Line 852 | Line 851 | namespace OpenMD {
851        pairwisePot[ii] = ploc2;
852      }
853  
855    for (int ii = 0; ii < N_INTERACTION_FAMILIES; ii++) {
856      RealType ploc1 = embeddingPot[ii];
857      RealType ploc2 = 0.0;
858      MPI::COMM_WORLD.Allreduce(&ploc1, &ploc2, 1, MPI::REALTYPE, MPI::SUM);
859      embeddingPot[ii] = ploc2;
860    }
861    
854      // Here be dragons.
855      MPI::Intracomm col = colComm.getComm();
856  
# Line 869 | Line 861 | namespace OpenMD {
861  
862   #endif
863  
864 +  }
865 +
866 +  /**
867 +   * Collects information obtained during the post-pair (and embedding
868 +   * functional) loops onto local data structures.
869 +   */
870 +  void ForceMatrixDecomposition::collectSelfData() {
871 +    snap_ = sman_->getCurrentSnapshot();
872 +    storageLayout_ = sman_->getStorageLayout();
873 +
874 + #ifdef IS_MPI
875 +    for (int ii = 0; ii < N_INTERACTION_FAMILIES; ii++) {
876 +      RealType ploc1 = embeddingPot[ii];
877 +      RealType ploc2 = 0.0;
878 +      MPI::COMM_WORLD.Allreduce(&ploc1, &ploc2, 1, MPI::REALTYPE, MPI::SUM);
879 +      embeddingPot[ii] = ploc2;
880 +    }    
881 + #endif
882 +    
883    }
884  
885 +
886 +
887    int ForceMatrixDecomposition::getNAtomsInRow() {  
888   #ifdef IS_MPI
889      return nAtomsInRow_;
# Line 993 | Line 1006 | namespace OpenMD {
1006     * We need to exclude some overcounted interactions that result from
1007     * the parallel decomposition.
1008     */
1009 <  bool ForceMatrixDecomposition::skipAtomPair(int atom1, int atom2) {
1010 <    int unique_id_1, unique_id_2;
1009 >  bool ForceMatrixDecomposition::skipAtomPair(int atom1, int atom2, int cg1, int cg2) {
1010 >    int unique_id_1, unique_id_2, group1, group2;
1011          
1012   #ifdef IS_MPI
1013      // in MPI, we have to look up the unique IDs for each atom
1014      unique_id_1 = AtomRowToGlobal[atom1];
1015      unique_id_2 = AtomColToGlobal[atom2];
1016 +    group1 = cgRowToGlobal[cg1];
1017 +    group2 = cgColToGlobal[cg2];
1018   #else
1019      unique_id_1 = AtomLocalToGlobal[atom1];
1020      unique_id_2 = AtomLocalToGlobal[atom2];
1021 +    group1 = cgLocalToGlobal[cg1];
1022 +    group2 = cgLocalToGlobal[cg2];
1023   #endif  
1024  
1025      if (unique_id_1 == unique_id_2) return true;
# Line 1013 | Line 1030 | namespace OpenMD {
1030        if ((unique_id_1 + unique_id_2) % 2 == 0) return true;
1031      } else {
1032        if ((unique_id_1 + unique_id_2) % 2 == 1) return true;
1033 +    }
1034 + #endif    
1035 +
1036 + #ifndef IS_MPI
1037 +    if (group1 == group2) {
1038 +      if (unique_id_1 < unique_id_2) return true;
1039      }
1040   #endif
1041      
# Line 1116 | Line 1139 | namespace OpenMD {
1139  
1140   #else
1141      
1119
1120    // cerr << "atoms = " << atom1 << " " << atom2 << "\n";
1121    // cerr << "pos1 = " << snap_->atomData.position[atom1] << "\n";
1122    // cerr << "pos2 = " << snap_->atomData.position[atom2] << "\n";
1123
1142      idat.atypes = make_pair( atypesLocal[atom1], atypesLocal[atom2]);
1125    //idat.atypes = make_pair( ff_->getAtomType(idents[atom1]),
1126    //                         ff_->getAtomType(idents[atom2]) );
1143  
1144      if (storageLayout_ & DataStorage::dslAmat) {
1145        idat.A1 = &(snap_->atomData.aMat[atom1]);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines