# | Line 99 | Line 99 | namespace OpenMD { | |
---|---|---|
99 | nGroups_ = info_->getNLocalCutoffGroups(); | |
100 | // gather the information for atomtype IDs (atids): | |
101 | idents = info_->getIdentArray(); | |
102 | + | regions = info_->getRegions(); |
103 | AtomLocalToGlobal = info_->getGlobalAtomIndices(); | |
104 | cgLocalToGlobal = info_->getGlobalGroupIndices(); | |
105 | vector<int> globalGroupMembership = info_->getGlobalGroupMembership(); | |
# | Line 118 | 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 163 | Line 164 | namespace OpenMD { | |
164 | ||
165 | AtomPlanIntRow->gather(idents, identsRow); | |
166 | AtomPlanIntColumn->gather(idents, identsCol); | |
167 | + | |
168 | + | regionsRow.resize(nAtomsInRow_); |
169 | + | regionsCol.resize(nAtomsInCol_); |
170 | + | |
171 | + | AtomPlanIntRow->gather(regions, regionsRow); |
172 | + | AtomPlanIntColumn->gather(regions, regionsCol); |
173 | ||
174 | // allocate memory for the parallel objects | |
175 | atypesRow.resize(nAtomsInRow_); | |
# | Line 417 | 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 579 | 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 611 | 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 825 | 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 909 | 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 944 | 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 1168 | Line 1201 | namespace OpenMD { | |
1201 | idat.excluded = excludeAtomPair(atom1, atom2); | |
1202 | ||
1203 | #ifdef IS_MPI | |
1204 | < | idat.atypes = make_pair( atypesRow[atom1], atypesCol[atom2]); |
1204 | > | //idat.atypes = make_pair( atypesRow[atom1], atypesCol[atom2]); |
1205 | idat.atid1 = identsRow[atom1]; | |
1206 | idat.atid2 = identsCol[atom2]; | |
1207 | < | //idat.atypes = make_pair( ff_->getAtomType(identsRow[atom1]), |
1208 | < | // ff_->getAtomType(identsCol[atom2]) ); |
1209 | < | |
1207 | > | |
1208 | > | if (regionsRow[atom1] >= 0 && regionsCol[atom2] >= 0) { |
1209 | > | idat.sameRegion = (regionsRow[atom1] == regionsCol[atom2]); |
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 1226 | Line 1263 | namespace OpenMD { | |
1263 | ||
1264 | #else | |
1265 | ||
1266 | < | idat.atypes = make_pair( atypesLocal[atom1], atypesLocal[atom2]); |
1266 | > | //idat.atypes = make_pair( atypesLocal[atom1], atypesLocal[atom2]); |
1267 | idat.atid1 = idents[atom1]; | |
1268 | idat.atid2 = idents[atom2]; | |
1269 | + | |
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 1304 | Line 1347 | namespace OpenMD { | |
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 | |
1356 | pairwisePot += *(idat.pot); | |
1357 | excludedPot += *(idat.excludedPot); | |
# | Line 1330 | 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 1375 | 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 1473 | 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_); |
– | Removed lines |
+ | Added lines |
< | Changed lines |
> | Changed lines |