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 1590 by gezelter, Mon Jul 11 01:39:49 2011 UTC vs.
Revision 1592 by gezelter, Tue Jul 12 20:33:14 2011 UTC

# Line 113 | Line 113 | namespace OpenMD {
113      AtomCommIntColumn->gather(idents, identsCol);
114      
115      // allocate memory for the parallel objects
116 <    AtomRowToGlobal.resize(nAtomsInRow_);
117 <    AtomColToGlobal.resize(nAtomsInCol_);
118 <    cgRowToGlobal.resize(nGroupsInRow_);
119 <    cgColToGlobal.resize(nGroupsInCol_);
120 <    massFactorsRow.resize(nAtomsInRow_);
121 <    massFactorsCol.resize(nAtomsInCol_);
116 >    atypesRow.resize(nAtomsInRow_);
117 >    atypesCol.resize(nAtomsInCol_);
118 >
119 >    for (int i = 0; i < nAtomsInRow_; i++)
120 >      atypesRow[i] = ff_->getAtomType(identsRow[i]);
121 >    for (int i = 0; i < nAtomsInCol_; i++)
122 >      atypesCol[i] = ff_->getAtomType(identsCol[i]);        
123 >
124      pot_row.resize(nAtomsInRow_);
125      pot_col.resize(nAtomsInCol_);
126  
127 +    AtomRowToGlobal.resize(nAtomsInRow_);
128 +    AtomColToGlobal.resize(nAtomsInCol_);
129      AtomCommIntRow->gather(AtomLocalToGlobal, AtomRowToGlobal);
130      AtomCommIntColumn->gather(AtomLocalToGlobal, AtomColToGlobal);
131      
132 +    cgRowToGlobal.resize(nGroupsInRow_);
133 +    cgColToGlobal.resize(nGroupsInCol_);
134      cgCommIntRow->gather(cgLocalToGlobal, cgRowToGlobal);
135      cgCommIntColumn->gather(cgLocalToGlobal, cgColToGlobal);
136  
137 +    massFactorsRow.resize(nAtomsInRow_);
138 +    massFactorsCol.resize(nAtomsInCol_);
139      AtomCommRealRow->gather(massFactors, massFactorsRow);
140      AtomCommRealColumn->gather(massFactors, massFactorsCol);
141  
# Line 187 | Line 195 | namespace OpenMD {
195  
196   #endif
197  
198 +    // allocate memory for the parallel objects
199 +    atypesLocal.resize(nLocal_);
200 +
201 +    for (int i = 0; i < nLocal_; i++)
202 +      atypesLocal[i] = ff_->getAtomType(idents[i]);
203 +
204      groupList_.clear();
205      groupList_.resize(nGroups_);
206      for (int i = 0; i < nGroups_; i++) {
# Line 239 | Line 253 | namespace OpenMD {
253    void ForceMatrixDecomposition::createGtypeCutoffMap() {
254      
255      RealType tol = 1e-6;
256 +    largestRcut_ = 0.0;
257      RealType rc;
258      int atid;
259      set<AtomType*> atypes = info_->getSimulatedAtomTypes();
260 +    
261      map<int, RealType> atypeCutoff;
262        
263      for (set<AtomType*>::iterator at = atypes.begin();
# Line 249 | Line 265 | namespace OpenMD {
265        atid = (*at)->getIdent();
266        if (userChoseCutoff_)
267          atypeCutoff[atid] = userCutoff_;
268 <      else
268 >      else
269          atypeCutoff[atid] = interactionMan_->getSuggestedCutoffRadius(*at);
270      }
271 <
271 >    
272      vector<RealType> gTypeCutoffs;
273      // first we do a single loop over the cutoff groups to find the
274      // largest cutoff for any atypes present in this group.
# Line 312 | Line 328 | namespace OpenMD {
328      vector<RealType> groupCutoff(nGroups_, 0.0);
329      groupToGtype.resize(nGroups_);
330      for (int cg1 = 0; cg1 < nGroups_; cg1++) {
315
331        groupCutoff[cg1] = 0.0;
332        vector<int> atomList = getAtomsInGroupRow(cg1);
318
333        for (vector<int>::iterator ia = atomList.begin();
334             ia != atomList.end(); ++ia) {            
335          int atom1 = (*ia);
336          atid = idents[atom1];
337 <        if (atypeCutoff[atid] > groupCutoff[cg1]) {
337 >        if (atypeCutoff[atid] > groupCutoff[cg1])
338            groupCutoff[cg1] = atypeCutoff[atid];
325        }
339        }
340 <
340 >      
341        bool gTypeFound = false;
342        for (int gt = 0; gt < gTypeCutoffs.size(); gt++) {
343          if (abs(groupCutoff[cg1] - gTypeCutoffs[gt]) < tol) {
# Line 332 | Line 345 | namespace OpenMD {
345            gTypeFound = true;
346          }
347        }
348 <      if (!gTypeFound) {
348 >      if (!gTypeFound) {      
349          gTypeCutoffs.push_back( groupCutoff[cg1] );
350          groupToGtype[cg1] = gTypeCutoffs.size() - 1;
351        }      
# Line 376 | Line 389 | namespace OpenMD {
389  
390          pair<int,int> key = make_pair(i,j);
391          gTypeCutoffMap[key].first = thisRcut;
379
392          if (thisRcut > largestRcut_) largestRcut_ = thisRcut;
381
393          gTypeCutoffMap[key].second = thisRcut*thisRcut;
383        
394          gTypeCutoffMap[key].third = pow(thisRcut + skinThickness_, 2);
385
395          // sanity check
396          
397          if (userChoseCutoff_) {
# Line 836 | Line 845 | namespace OpenMD {
845      idat.excluded = excludeAtomPair(atom1, atom2);
846    
847   #ifdef IS_MPI
848 <    
849 <    idat.atypes = make_pair( ff_->getAtomType(identsRow[atom1]),
850 <                             ff_->getAtomType(identsCol[atom2]) );
848 >    idat.atypes = make_pair( atypesRow[atom1], atypesCol[atom2]);
849 >    //idat.atypes = make_pair( ff_->getAtomType(identsRow[atom1]),
850 >    //                         ff_->getAtomType(identsCol[atom2]) );
851      
852      if (storageLayout_ & DataStorage::dslAmat) {
853        idat.A1 = &(atomRowData.aMat[atom1]);
# Line 882 | Line 891 | namespace OpenMD {
891  
892   #else
893  
894 <    idat.atypes = make_pair( ff_->getAtomType(idents[atom1]),
895 <                             ff_->getAtomType(idents[atom2]) );
894 >    idat.atypes = make_pair( atypesLocal[atom1], atypesLocal[atom2]);
895 >    //idat.atypes = make_pair( ff_->getAtomType(idents[atom1]),
896 >    //                         ff_->getAtomType(idents[atom2]) );
897  
898      if (storageLayout_ & DataStorage::dslAmat) {
899        idat.A1 = &(snap_->atomData.aMat[atom1]);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines