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

Comparing trunk/src/parallel/ForceMatrixDecomposition.cpp (file contents):
Revision 1939 by gezelter, Thu Oct 31 18:18:57 2013 UTC vs.
Revision 1993 by gezelter, Tue Apr 29 17:32:31 2014 UTC

# Line 119 | Line 119 | namespace OpenMD {
119      
120   #ifdef IS_MPI
121  
122 <    MPI::Intracomm row = rowComm.getComm();
123 <    MPI::Intracomm col = colComm.getComm();
122 >    MPI_Comm row = rowComm.getComm();
123 >    MPI_Comm col = colComm.getComm();
124  
125      AtomPlanIntRow = new Plan<int>(row, nLocal_);
126      AtomPlanRealRow = new Plan<RealType>(row, nLocal_);
# Line 424 | Line 424 | namespace OpenMD {
424                                       gTypeCutoffs.end());
425  
426   #ifdef IS_MPI
427 <    MPI::COMM_WORLD.Allreduce(&groupMax, &groupMax, 1, MPI::REALTYPE,
428 <                              MPI::MAX);
427 >    MPI_Allreduce(MPI_IN_PLACE, &groupMax, 1, MPI_REALTYPE,
428 >                  MPI_MAX, MPI_COMM_WORLD);
429   #endif
430      
431      RealType tradRcut = groupMax;
# Line 586 | Line 586 | namespace OpenMD {
586             atomColData.electricField.end(), V3Zero);
587      }
588  
589 +    if (storageLayout_ & DataStorage::dslSitePotential) {    
590 +      fill(atomRowData.sitePotential.begin(),
591 +           atomRowData.sitePotential.end(), 0.0);
592 +      fill(atomColData.sitePotential.begin(),
593 +           atomColData.sitePotential.end(), 0.0);
594 +    }
595 +
596   #endif
597      // even in parallel, we need to zero out the local arrays:
598  
# Line 618 | Line 625 | namespace OpenMD {
625        fill(snap_->atomData.electricField.begin(),
626             snap_->atomData.electricField.end(), V3Zero);
627      }
628 +    if (storageLayout_ & DataStorage::dslSitePotential) {      
629 +      fill(snap_->atomData.sitePotential.begin(),
630 +           snap_->atomData.sitePotential.end(), 0.0);
631 +    }
632    }
633  
634  
# Line 832 | Line 843 | namespace OpenMD {
843          snap_->atomData.electricField[i] += efield_tmp[i];
844      }
845  
846 +    if (storageLayout_ & DataStorage::dslSitePotential) {
847 +
848 +      int nsp = snap_->atomData.sitePotential.size();
849 +      vector<RealType> sp_tmp(nsp, 0.0);
850 +
851 +      AtomPlanRealRow->scatter(atomRowData.sitePotential, sp_tmp);
852 +      for (int i = 0; i < nsp; i++) {
853 +        snap_->atomData.sitePotential[i] += sp_tmp[i];
854 +        sp_tmp[i] = 0.0;
855 +      }
856 +      
857 +      AtomPlanRealColumn->scatter(atomColData.sitePotential, sp_tmp);
858 +      for (int i = 0; i < nsp; i++)
859 +        snap_->atomData.sitePotential[i] += sp_tmp[i];
860 +    }
861  
862      nLocal_ = snap_->getNumberOfAtoms();
863  
# Line 916 | Line 942 | namespace OpenMD {
942      for (int ii = 0; ii < N_INTERACTION_FAMILIES; ii++) {
943        RealType ploc1 = pairwisePot[ii];
944        RealType ploc2 = 0.0;
945 <      MPI::COMM_WORLD.Allreduce(&ploc1, &ploc2, 1, MPI::REALTYPE, MPI::SUM);
945 >      MPI_Allreduce(&ploc1, &ploc2, 1, MPI_REALTYPE, MPI_SUM, MPI_COMM_WORLD);
946        pairwisePot[ii] = ploc2;
947      }
948  
949      for (int ii = 0; ii < N_INTERACTION_FAMILIES; ii++) {
950        RealType ploc1 = excludedPot[ii];
951        RealType ploc2 = 0.0;
952 <      MPI::COMM_WORLD.Allreduce(&ploc1, &ploc2, 1, MPI::REALTYPE, MPI::SUM);
952 >      MPI_Allreduce(&ploc1, &ploc2, 1, MPI_REALTYPE, MPI_SUM, MPI_COMM_WORLD);
953        excludedPot[ii] = ploc2;
954      }
955  
956      // Here be dragons.
957 <    MPI::Intracomm col = colComm.getComm();
957 >    MPI_Comm col = colComm.getComm();
958  
959 <    col.Allreduce(MPI::IN_PLACE,
959 >    MPI_Allreduce(MPI_IN_PLACE,
960                    &snap_->frameData.conductiveHeatFlux[0], 3,
961 <                  MPI::REALTYPE, MPI::SUM);
961 >                  MPI_REALTYPE, MPI_SUM, col);
962  
963  
964   #endif
# Line 951 | Line 977 | namespace OpenMD {
977      for (int ii = 0; ii < N_INTERACTION_FAMILIES; ii++) {
978        RealType ploc1 = embeddingPot[ii];
979        RealType ploc2 = 0.0;
980 <      MPI::COMM_WORLD.Allreduce(&ploc1, &ploc2, 1, MPI::REALTYPE, MPI::SUM);
980 >      MPI_Allreduce(&ploc1, &ploc2, 1, MPI_REALTYPE, MPI_SUM, MPI_COMM_WORLD);
981        embeddingPot[ii] = ploc2;
982      }    
983      for (int ii = 0; ii < N_INTERACTION_FAMILIES; ii++) {
984        RealType ploc1 = excludedSelfPot[ii];
985        RealType ploc2 = 0.0;
986 <      MPI::COMM_WORLD.Allreduce(&ploc1, &ploc2, 1, MPI::REALTYPE, MPI::SUM);
986 >      MPI_Allreduce(&ploc1, &ploc2, 1, MPI_REALTYPE, MPI_SUM, MPI_COMM_WORLD);
987        excludedSelfPot[ii] = ploc2;
988      }    
989   #endif
# Line 1319 | Line 1345 | namespace OpenMD {
1345      if (storageLayout_ & DataStorage::dslElectricField) {              
1346        atomRowData.electricField[atom1] += *(idat.eField1);
1347        atomColData.electricField[atom2] += *(idat.eField2);
1348 +    }
1349 +
1350 +    if (storageLayout_ & DataStorage::dslSitePotential) {              
1351 +      atomRowData.sitePotential[atom1] += *(idat.sPot1);
1352 +      atomColData.sitePotential[atom2] += *(idat.sPot2);
1353      }
1354  
1355   #else
# Line 1347 | Line 1378 | namespace OpenMD {
1378        snap_->atomData.electricField[atom2] += *(idat.eField2);
1379      }
1380  
1381 +    if (storageLayout_ & DataStorage::dslSitePotential) {              
1382 +      snap_->atomData.sitePotential[atom1] += *(idat.sPot1);
1383 +      snap_->atomData.sitePotential[atom2] += *(idat.sPot2);
1384 +    }
1385 +
1386   #endif
1387      
1388    }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines