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 1579 by gezelter, Thu Jun 9 20:26:29 2011 UTC vs.
Revision 1581 by gezelter, Mon Jun 13 22:13:12 2011 UTC

# Line 65 | Line 65 | namespace OpenMD {
65      AtomLocalToGlobal = info_->getGlobalAtomIndices();
66      cgLocalToGlobal = info_->getGlobalGroupIndices();
67      vector<int> globalGroupMembership = info_->getGlobalGroupMembership();
68 <    vector<RealType> massFactorsLocal = info_->getMassFactors();
68 >    massFactors = info_->getMassFactors();
69      PairList excludes = info_->getExcludedInteractions();
70      PairList oneTwo = info_->getOneTwoInteractions();
71      PairList oneThree = info_->getOneThreeInteractions();
# Line 117 | Line 117 | namespace OpenMD {
117      cgCommIntRow->gather(cgLocalToGlobal, cgRowToGlobal);
118      cgCommIntColumn->gather(cgLocalToGlobal, cgColToGlobal);
119  
120 <    AtomCommRealRow->gather(massFactorsLocal, massFactorsRow);
121 <    AtomCommRealColumn->gather(massFactorsLocal, massFactorsCol);
120 >    AtomCommRealRow->gather(massFactors, massFactorsRow);
121 >    AtomCommRealColumn->gather(massFactors, massFactorsCol);
122  
123      groupListRow_.clear();
124      groupListRow_.resize(nGroupsInRow_);
# Line 691 | Line 691 | namespace OpenMD {
691   #ifdef IS_MPI
692      return massFactorsRow[atom1];
693   #else
694 <    return massFactorsLocal[atom1];
694 >    return massFactors[atom1];
695   #endif
696    }
697  
# Line 699 | Line 699 | namespace OpenMD {
699   #ifdef IS_MPI
700      return massFactorsCol[atom2];
701   #else
702 <    return massFactorsLocal[atom2];
702 >    return massFactors[atom2];
703   #endif
704  
705    }
# Line 776 | Line 776 | namespace OpenMD {
776    }
777  
778      // filling interaction blocks with pointers
779 <  InteractionData ForceMatrixDecomposition::fillInteractionData(int atom1, int atom2) {    
780 <    InteractionData idat;
781 <
779 >  void ForceMatrixDecomposition::fillInteractionData(InteractionData idat,
780 >                                                     int atom1, int atom2) {    
781   #ifdef IS_MPI
782      
783      idat.atypes = make_pair( ff_->getAtomType(identsRow[atom1]),
784                               ff_->getAtomType(identsCol[atom2]) );
786
785      
786      if (storageLayout_ & DataStorage::dslAmat) {
787        idat.A1 = &(atomRowData.aMat[atom1]);
# Line 861 | Line 859 | namespace OpenMD {
859      }
860  
861   #endif
864    return idat;
862    }
863  
864    
# Line 882 | Line 879 | namespace OpenMD {
879    }
880  
881  
882 <  InteractionData ForceMatrixDecomposition::fillSkipData(int atom1, int atom2){
883 <
887 <    InteractionData idat;
882 >  void ForceMatrixDecomposition::fillSkipData(InteractionData idat,
883 >                                              int atom1, int atom2) {
884   #ifdef IS_MPI
885      idat.atypes = make_pair( ff_->getAtomType(identsRow[atom1]),
886                               ff_->getAtomType(identsCol[atom2]) );
# Line 947 | Line 943 | namespace OpenMD {
943      int cellIndex;
944      int nCtot = nCells_.x() * nCells_.y() * nCells_.z();
945  
946 +    cerr << "flag1\n";
947   #ifdef IS_MPI
948      cellListRow_.resize(nCtot);
949      cellListCol_.resize(nCtot);
950   #else
951      cellList_.resize(nCtot);
952   #endif
953 <
953 >    cerr << "flag2\n";
954   #ifdef IS_MPI
955      for (int i = 0; i < nGroupsInRow_; i++) {
956        rs = cgRowData.position[i];
957 +
958        // scaled positions relative to the box vectors
959        scaled = invHmat * rs;
960 +
961        // wrap the vector back into the unit box by subtracting integer box
962        // numbers
963 <      for (int j = 0; j < 3; j++)
963 >      for (int j = 0; j < 3; j++) {
964          scaled[j] -= roundMe(scaled[j]);
965 +        scaled[j] += 0.5;
966 +      }
967      
968        // find xyz-indices of cell that cutoffGroup is in.
969        whichCell.x() = nCells_.x() * scaled.x();
# Line 971 | Line 972 | namespace OpenMD {
972  
973        // find single index of this cell:
974        cellIndex = Vlinear(whichCell, nCells_);
975 +
976        // add this cutoff group to the list of groups in this cell;
977        cellListRow_[cellIndex].push_back(i);
978      }
979  
980      for (int i = 0; i < nGroupsInCol_; i++) {
981        rs = cgColData.position[i];
982 +
983        // scaled positions relative to the box vectors
984        scaled = invHmat * rs;
985 +
986        // wrap the vector back into the unit box by subtracting integer box
987        // numbers
988 <      for (int j = 0; j < 3; j++)
988 >      for (int j = 0; j < 3; j++) {
989          scaled[j] -= roundMe(scaled[j]);
990 +        scaled[j] += 0.5;
991 +      }
992  
993        // find xyz-indices of cell that cutoffGroup is in.
994        whichCell.x() = nCells_.x() * scaled.x();
# Line 991 | Line 997 | namespace OpenMD {
997  
998        // find single index of this cell:
999        cellIndex = Vlinear(whichCell, nCells_);
1000 +
1001        // add this cutoff group to the list of groups in this cell;
1002        cellListCol_[cellIndex].push_back(i);
1003      }
1004   #else
1005      for (int i = 0; i < nGroups_; i++) {
1006        rs = snap_->cgData.position[i];
1007 +
1008        // scaled positions relative to the box vectors
1009        scaled = invHmat * rs;
1010 +
1011        // wrap the vector back into the unit box by subtracting integer box
1012        // numbers
1013 <      for (int j = 0; j < 3; j++)
1013 >      for (int j = 0; j < 3; j++) {
1014          scaled[j] -= roundMe(scaled[j]);
1015 +        scaled[j] += 0.5;
1016 +      }
1017  
1018        // find xyz-indices of cell that cutoffGroup is in.
1019        whichCell.x() = nCells_.x() * scaled.x();
# Line 1010 | Line 1021 | namespace OpenMD {
1021        whichCell.z() = nCells_.z() * scaled.z();
1022  
1023        // find single index of this cell:
1024 <      cellIndex = Vlinear(whichCell, nCells_);
1024 >      cellIndex = Vlinear(whichCell, nCells_);      
1025 >
1026        // add this cutoff group to the list of groups in this cell;
1027        cellList_[cellIndex].push_back(i);
1028      }
# Line 1068 | Line 1080 | namespace OpenMD {
1080                }
1081              }
1082   #else
1083 +
1084              for (vector<int>::iterator j1 = cellList_[m1].begin();
1085                   j1 != cellList_[m1].end(); ++j1) {
1086                for (vector<int>::iterator j2 = cellList_[m2].begin();
1087                     j2 != cellList_[m2].end(); ++j2) {
1088 <                              
1088 >
1089                  // Always do this if we're in different cells or if
1090                  // we're in the same cell and the global index of the
1091                  // j2 cutoff group is less than the j1 cutoff group
# Line 1092 | Line 1105 | namespace OpenMD {
1105          }
1106        }
1107      }
1108 <
1108 >    
1109      // save the local cutoff group positions for the check that is
1110      // done on each loop:
1111      saved_CG_positions_.clear();
1112      for (int i = 0; i < nGroups_; i++)
1113        saved_CG_positions_.push_back(snap_->cgData.position[i]);
1114 <
1114 >    
1115      return neighborList;
1116    }
1117   } //end namespace OpenMD

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines