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 1587 by gezelter, Fri Jul 8 20:25:32 2011 UTC vs.
Revision 1591 by gezelter, Tue Jul 12 15:25:07 2011 UTC

# Line 112 | Line 112 | namespace OpenMD {
112      AtomCommIntRow->gather(idents, identsRow);
113      AtomCommIntColumn->gather(idents, identsCol);
114      
115 +    // allocate memory for the parallel objects
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 176 | Line 194 | namespace OpenMD {
194      }
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_);
# Line 331 | Line 355 | namespace OpenMD {
355  
356      // Now we find the maximum group cutoff value present in the simulation
357  
358 <    RealType groupMax = *max_element(gTypeCutoffs.begin(), gTypeCutoffs.end());
358 >    RealType groupMax = *max_element(gTypeCutoffs.begin(),
359 >                                     gTypeCutoffs.end());
360  
361   #ifdef IS_MPI
362 <    MPI::COMM_WORLD.Allreduce(&groupMax, &groupMax, 1, MPI::REALTYPE, MPI::MAX);
362 >    MPI::COMM_WORLD.Allreduce(&groupMax, &groupMax, 1, MPI::REALTYPE,
363 >                              MPI::MAX);
364   #endif
365      
366      RealType tradRcut = groupMax;
# Line 430 | Line 456 | namespace OpenMD {
456           Vector<RealType, N_INTERACTION_FAMILIES> (0.0));  
457  
458      if (storageLayout_ & DataStorage::dslParticlePot) {    
459 <      fill(atomRowData.particlePot.begin(), atomRowData.particlePot.end(), 0.0);
460 <      fill(atomColData.particlePot.begin(), atomColData.particlePot.end(), 0.0);
459 >      fill(atomRowData.particlePot.begin(), atomRowData.particlePot.end(),
460 >           0.0);
461 >      fill(atomColData.particlePot.begin(), atomColData.particlePot.end(),
462 >           0.0);
463      }
464  
465      if (storageLayout_ & DataStorage::dslDensity) {      
# Line 440 | Line 468 | namespace OpenMD {
468      }
469  
470      if (storageLayout_ & DataStorage::dslFunctional) {  
471 <      fill(atomRowData.functional.begin(), atomRowData.functional.end(), 0.0);
472 <      fill(atomColData.functional.begin(), atomColData.functional.end(), 0.0);
471 >      fill(atomRowData.functional.begin(), atomRowData.functional.end(),
472 >           0.0);
473 >      fill(atomColData.functional.begin(), atomColData.functional.end(),
474 >           0.0);
475      }
476  
477      if (storageLayout_ & DataStorage::dslFunctionalDerivative) {      
# Line 458 | Line 488 | namespace OpenMD {
488             atomColData.skippedCharge.end(), 0.0);
489      }
490  
491 < #else
492 <    
491 > #endif
492 >    // even in parallel, we need to zero out the local arrays:
493 >
494      if (storageLayout_ & DataStorage::dslParticlePot) {      
495        fill(snap_->atomData.particlePot.begin(),
496             snap_->atomData.particlePot.end(), 0.0);
# Line 481 | Line 512 | namespace OpenMD {
512        fill(snap_->atomData.skippedCharge.begin(),
513             snap_->atomData.skippedCharge.end(), 0.0);
514      }
484 #endif
515      
516    }
517  
# Line 518 | Line 548 | namespace OpenMD {
548        AtomCommMatrixColumn->gather(snap_->atomData.electroFrame,
549                                     atomColData.electroFrame);
550      }
551 +
552   #endif      
553    }
554    
# Line 584 | Line 615 | namespace OpenMD {
615      AtomCommVectorColumn->scatter(atomColData.force, frc_tmp);
616      for (int i = 0; i < n; i++)
617        snap_->atomData.force[i] += frc_tmp[i];
618 <    
588 <    
618 >        
619      if (storageLayout_ & DataStorage::dslTorque) {
620  
621        int nt = snap_->atomData.torque.size();
# Line 609 | Line 639 | namespace OpenMD {
639  
640        AtomCommRealRow->scatter(atomRowData.skippedCharge, skch_tmp);
641        for (int i = 0; i < ns; i++) {
642 <        snap_->atomData.skippedCharge[i] = skch_tmp[i];
642 >        snap_->atomData.skippedCharge[i] += skch_tmp[i];
643          skch_tmp[i] = 0.0;
644        }
645        
# Line 820 | Line 850 | namespace OpenMD {
850      idat.excluded = excludeAtomPair(atom1, atom2);
851    
852   #ifdef IS_MPI
853 <    
854 <    idat.atypes = make_pair( ff_->getAtomType(identsRow[atom1]),
855 <                             ff_->getAtomType(identsCol[atom2]) );
853 >    idat.atypes = make_pair( atypesRow[atom1], atypesCol[atom2]);
854 >    //idat.atypes = make_pair( ff_->getAtomType(identsRow[atom1]),
855 >    //                         ff_->getAtomType(identsCol[atom2]) );
856      
857      if (storageLayout_ & DataStorage::dslAmat) {
858        idat.A1 = &(atomRowData.aMat[atom1]);
# Line 866 | Line 896 | namespace OpenMD {
896  
897   #else
898  
899 <    idat.atypes = make_pair( ff_->getAtomType(idents[atom1]),
900 <                             ff_->getAtomType(idents[atom2]) );
899 >    idat.atypes = make_pair( atypesLocal[atom1], atypesLocal[atom2]);
900 >    //idat.atypes = make_pair( ff_->getAtomType(idents[atom1]),
901 >    //                         ff_->getAtomType(idents[atom2]) );
902  
903      if (storageLayout_ & DataStorage::dslAmat) {
904        idat.A1 = &(snap_->atomData.aMat[atom1]);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines