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 1930 by gezelter, Mon Aug 19 13:51:04 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 584 | Line 584 | namespace OpenMD {
584             atomRowData.electricField.end(), V3Zero);
585        fill(atomColData.electricField.begin(),
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
# 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  
864      vector<potVec> pot_temp(nLocal_,
# 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 1179 | Line 1205 | namespace OpenMD {
1205      idat.atid1 = identsRow[atom1];
1206      idat.atid2 = identsCol[atom2];
1207  
1208 <    if (regionsRow[atom1] >= 0 && regionsCol[atom2] >= 0)
1208 >    if (regionsRow[atom1] >= 0 && regionsCol[atom2] >= 0) {
1209        idat.sameRegion = (regionsRow[atom1] == regionsCol[atom2]);
1210 <      
1210 >    } else {
1211 >      idat.sameRegion = false;
1212 >    }
1213 >
1214      if (storageLayout_ & DataStorage::dslAmat) {
1215        idat.A1 = &(atomRowData.aMat[atom1]);
1216        idat.A2 = &(atomColData.aMat[atom2]);
# Line 1238 | Line 1267 | namespace OpenMD {
1267      idat.atid1 = idents[atom1];
1268      idat.atid2 = idents[atom2];
1269  
1270 <    if (regions[atom1] >= 0 && regions[atom2] >= 0)
1270 >    if (regions[atom1] >= 0 && regions[atom2] >= 0) {
1271        idat.sameRegion = (regions[atom1] == regions[atom2]);
1272 +    } else {
1273 +      idat.sameRegion = false;
1274 +    }
1275  
1276      if (storageLayout_ & DataStorage::dslAmat) {
1277        idat.A1 = &(snap_->atomData.aMat[atom1]);
# Line 1313 | 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 1341 | 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    }
# Line 1386 | Line 1428 | namespace OpenMD {
1428      Vector3d boxY = box.getColumn(1);
1429      Vector3d boxZ = box.getColumn(2);
1430      
1431 <    nCells_.x() = (int) ( boxX.length() )/ rList_;
1432 <    nCells_.y() = (int) ( boxY.length() )/ rList_;
1433 <    nCells_.z() = (int) ( boxZ.length() )/ rList_;
1431 >    nCells_.x() = int( boxX.length() / rList_ );
1432 >    nCells_.y() = int( boxY.length() / rList_ );
1433 >    nCells_.z() = int( boxZ.length() / rList_ );
1434      
1435      // handle small boxes where the cell offsets can end up repeating cells
1436      
# Line 1484 | Line 1526 | namespace OpenMD {
1526          }
1527          
1528          // find xyz-indices of cell that cutoffGroup is in.
1529 <        whichCell.x() = nCells_.x() * scaled.x();
1530 <        whichCell.y() = nCells_.y() * scaled.y();
1531 <        whichCell.z() = nCells_.z() * scaled.z();
1529 >        whichCell.x() = int(nCells_.x() * scaled.x());
1530 >        whichCell.y() = int(nCells_.y() * scaled.y());
1531 >        whichCell.z() = int(nCells_.z() * scaled.z());
1532          
1533          // find single index of this cell:
1534          cellIndex = Vlinear(whichCell, nCells_);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines