# | Line 59 | Line 59 | namespace OpenMD { | |
---|---|---|
59 | nLocal_ = snap_->getNumberOfAtoms(); | |
60 | ||
61 | nGroups_ = info_->getNLocalCutoffGroups(); | |
62 | – | cerr << "in dId, nGroups = " << nGroups_ << "\n"; |
62 | // gather the information for atomtype IDs (atids): | |
63 | < | identsLocal = info_->getIdentArray(); |
63 | > | idents = info_->getIdentArray(); |
64 | AtomLocalToGlobal = info_->getGlobalAtomIndices(); | |
65 | cgLocalToGlobal = info_->getGlobalGroupIndices(); | |
66 | vector<int> globalGroupMembership = info_->getGlobalGroupMembership(); | |
67 | + | |
68 | massFactors = info_->getMassFactors(); | |
69 | + | |
70 | PairList excludes = info_->getExcludedInteractions(); | |
71 | PairList oneTwo = info_->getOneTwoInteractions(); | |
72 | PairList oneThree = info_->getOneThreeInteractions(); | |
# | Line 108 | Line 109 | namespace OpenMD { | |
109 | identsRow.resize(nAtomsInRow_); | |
110 | identsCol.resize(nAtomsInCol_); | |
111 | ||
112 | < | AtomCommIntRow->gather(identsLocal, identsRow); |
113 | < | AtomCommIntColumn->gather(identsLocal, identsCol); |
112 | > | AtomCommIntRow->gather(idents, identsRow); |
113 | > | AtomCommIntColumn->gather(idents, identsCol); |
114 | ||
115 | AtomCommIntRow->gather(AtomLocalToGlobal, AtomRowToGlobal); | |
116 | AtomCommIntColumn->gather(AtomLocalToGlobal, AtomColToGlobal); | |
# | Line 225 | Line 226 | namespace OpenMD { | |
226 | } | |
227 | ||
228 | void ForceMatrixDecomposition::createGtypeCutoffMap() { | |
229 | < | |
229 | > | |
230 | RealType tol = 1e-6; | |
231 | RealType rc; | |
232 | int atid; | |
233 | set<AtomType*> atypes = info_->getSimulatedAtomTypes(); | |
234 | vector<RealType> atypeCutoff; | |
235 | atypeCutoff.resize( atypes.size() ); | |
236 | < | |
236 | > | |
237 | for (set<AtomType*>::iterator at = atypes.begin(); | |
238 | at != atypes.end(); ++at){ | |
238 | – | rc = interactionMan_->getSuggestedCutoffRadius(*at); |
239 | atid = (*at)->getIdent(); | |
240 | < | atypeCutoff[atid] = rc; |
240 | > | |
241 | > | if (userChoseCutoff_) |
242 | > | atypeCutoff[atid] = userCutoff_; |
243 | > | else |
244 | > | atypeCutoff[atid] = interactionMan_->getSuggestedCutoffRadius(*at); |
245 | } | |
246 | ||
247 | vector<RealType> gTypeCutoffs; | |
# | Line 300 | Line 304 | namespace OpenMD { | |
304 | vector<RealType> groupCutoff(nGroups_, 0.0); | |
305 | groupToGtype.resize(nGroups_); | |
306 | ||
303 | – | cerr << "nGroups = " << nGroups_ << "\n"; |
307 | for (int cg1 = 0; cg1 < nGroups_; cg1++) { | |
308 | ||
309 | groupCutoff[cg1] = 0.0; | |
# | Line 309 | Line 312 | namespace OpenMD { | |
312 | for (vector<int>::iterator ia = atomList.begin(); | |
313 | ia != atomList.end(); ++ia) { | |
314 | int atom1 = (*ia); | |
315 | < | atid = identsLocal[atom1]; |
315 | > | atid = idents[atom1]; |
316 | if (atypeCutoff[atid] > groupCutoff[cg1]) { | |
317 | groupCutoff[cg1] = atypeCutoff[atid]; | |
318 | } | |
# | Line 329 | Line 332 | namespace OpenMD { | |
332 | } | |
333 | #endif | |
334 | ||
332 | – | cerr << "gTypeCutoffs.size() = " << gTypeCutoffs.size() << "\n"; |
335 | // Now we find the maximum group cutoff value present in the simulation | |
336 | ||
337 | RealType groupMax = *max_element(gTypeCutoffs.begin(), gTypeCutoffs.end()); | |
# | Line 378 | Line 380 | namespace OpenMD { | |
380 | if (abs(gTypeCutoffMap[key].first - userCutoff_) > 0.0001) { | |
381 | sprintf(painCave.errMsg, | |
382 | "ForceMatrixDecomposition::createGtypeCutoffMap " | |
383 | < | "user-specified rCut does not match computed group Cutoff\n"); |
383 | > | "user-specified rCut (%lf) does not match computed group Cutoff\n", userCutoff_); |
384 | painCave.severity = OPENMD_ERROR; | |
385 | painCave.isFatal = 1; | |
386 | simError(); | |
# | Line 410 | Line 412 | namespace OpenMD { | |
412 | } | |
413 | ||
414 | void ForceMatrixDecomposition::zeroWorkArrays() { | |
415 | < | |
416 | < | for (int j = 0; j < N_INTERACTION_FAMILIES; j++) { |
415 | < | longRangePot_[j] = 0.0; |
416 | < | } |
415 | > | pairwisePot = 0.0; |
416 | > | embeddingPot = 0.0; |
417 | ||
418 | #ifdef IS_MPI | |
419 | if (storageLayout_ & DataStorage::dslForce) { | |
# | Line 430 | Line 430 | namespace OpenMD { | |
430 | Vector<RealType, N_INTERACTION_FAMILIES> (0.0)); | |
431 | ||
432 | fill(pot_col.begin(), pot_col.end(), | |
433 | < | Vector<RealType, N_INTERACTION_FAMILIES> (0.0)); |
434 | < | |
435 | < | pot_local = Vector<RealType, N_INTERACTION_FAMILIES>(0.0); |
433 | > | Vector<RealType, N_INTERACTION_FAMILIES> (0.0)); |
434 | ||
435 | if (storageLayout_ & DataStorage::dslParticlePot) { | |
436 | fill(atomRowData.particlePot.begin(), atomRowData.particlePot.end(), 0.0); | |
# | Line 456 | Line 454 | namespace OpenMD { | |
454 | atomColData.functionalDerivative.end(), 0.0); | |
455 | } | |
456 | ||
457 | + | if (storageLayout_ & DataStorage::dslSkippedCharge) { |
458 | + | fill(atomRowData.skippedCharge.begin(), atomRowData.skippedCharge.end(), 0.0); |
459 | + | fill(atomColData.skippedCharge.begin(), atomColData.skippedCharge.end(), 0.0); |
460 | + | } |
461 | + | |
462 | #else | |
463 | ||
464 | if (storageLayout_ & DataStorage::dslParticlePot) { | |
# | Line 475 | Line 478 | namespace OpenMD { | |
478 | fill(snap_->atomData.functionalDerivative.begin(), | |
479 | snap_->atomData.functionalDerivative.end(), 0.0); | |
480 | } | |
481 | + | if (storageLayout_ & DataStorage::dslSkippedCharge) { |
482 | + | fill(snap_->atomData.skippedCharge.begin(), |
483 | + | snap_->atomData.skippedCharge.end(), 0.0); |
484 | + | } |
485 | #endif | |
486 | ||
487 | } | |
# | Line 606 | Line 613 | namespace OpenMD { | |
613 | AtomCommPotRow->scatter(pot_row, pot_temp); | |
614 | ||
615 | for (int ii = 0; ii < pot_temp.size(); ii++ ) | |
616 | < | pot_local += pot_temp[ii]; |
616 | > | pairwisePot += pot_temp[ii]; |
617 | ||
618 | fill(pot_temp.begin(), pot_temp.end(), | |
619 | Vector<RealType, N_INTERACTION_FAMILIES> (0.0)); | |
# | Line 614 | Line 621 | namespace OpenMD { | |
621 | AtomCommPotColumn->scatter(pot_col, pot_temp); | |
622 | ||
623 | for (int ii = 0; ii < pot_temp.size(); ii++ ) | |
624 | < | pot_local += pot_temp[ii]; |
618 | < | |
624 | > | pairwisePot += pot_temp[ii]; |
625 | #endif | |
626 | + | |
627 | } | |
628 | ||
629 | int ForceMatrixDecomposition::getNAtomsInRow() { | |
# | Line 754 | Line 761 | namespace OpenMD { | |
761 | for (vector<int>::iterator i = skipsForAtom[atom1].begin(); | |
762 | i != skipsForAtom[atom1].end(); ++i) { | |
763 | if ( (*i) == unique_id_2 ) return true; | |
764 | < | } |
764 | > | } |
765 | ||
766 | + | return false; |
767 | } | |
768 | ||
769 | ||
# | Line 776 | Line 784 | namespace OpenMD { | |
784 | } | |
785 | ||
786 | // filling interaction blocks with pointers | |
787 | < | void ForceMatrixDecomposition::fillInteractionData(InteractionData idat, |
787 | > | void ForceMatrixDecomposition::fillInteractionData(InteractionData &idat, |
788 | int atom1, int atom2) { | |
789 | #ifdef IS_MPI | |
790 | ||
# | Line 820 | Line 828 | namespace OpenMD { | |
828 | ||
829 | #else | |
830 | ||
831 | < | idat.atypes = make_pair( ff_->getAtomType(identsLocal[atom1]), |
832 | < | ff_->getAtomType(identsLocal[atom2]) ); |
831 | > | idat.atypes = make_pair( ff_->getAtomType(idents[atom1]), |
832 | > | ff_->getAtomType(idents[atom2]) ); |
833 | ||
834 | if (storageLayout_ & DataStorage::dslAmat) { | |
835 | idat.A1 = &(snap_->atomData.aMat[atom1]); | |
# | Line 838 | Line 846 | namespace OpenMD { | |
846 | idat.t2 = &(snap_->atomData.torque[atom2]); | |
847 | } | |
848 | ||
849 | < | if (storageLayout_ & DataStorage::dslDensity) { |
849 | > | if (storageLayout_ & DataStorage::dslDensity) { |
850 | idat.rho1 = &(snap_->atomData.density[atom1]); | |
851 | idat.rho2 = &(snap_->atomData.density[atom2]); | |
852 | } | |
# | Line 862 | Line 870 | namespace OpenMD { | |
870 | } | |
871 | ||
872 | ||
873 | < | void ForceMatrixDecomposition::unpackInteractionData(InteractionData idat, int atom1, int atom2) { |
873 | > | void ForceMatrixDecomposition::unpackInteractionData(InteractionData &idat, int atom1, int atom2) { |
874 | #ifdef IS_MPI | |
875 | pot_row[atom1] += 0.5 * *(idat.pot); | |
876 | pot_col[atom2] += 0.5 * *(idat.pot); | |
# | Line 870 | Line 878 | namespace OpenMD { | |
878 | atomRowData.force[atom1] += *(idat.f1); | |
879 | atomColData.force[atom2] -= *(idat.f1); | |
880 | #else | |
881 | < | longRangePot_ += *(idat.pot); |
882 | < | |
881 | > | pairwisePot += *(idat.pot); |
882 | > | |
883 | snap_->atomData.force[atom1] += *(idat.f1); | |
884 | snap_->atomData.force[atom2] -= *(idat.f1); | |
885 | #endif | |
886 | < | |
886 | > | |
887 | } | |
888 | ||
889 | ||
890 | < | void ForceMatrixDecomposition::fillSkipData(InteractionData idat, |
890 | > | void ForceMatrixDecomposition::fillSkipData(InteractionData &idat, |
891 | int atom1, int atom2) { | |
892 | #ifdef IS_MPI | |
893 | idat.atypes = make_pair( ff_->getAtomType(identsRow[atom1]), | |
# | Line 889 | Line 897 | namespace OpenMD { | |
897 | idat.eFrame1 = &(atomRowData.electroFrame[atom1]); | |
898 | idat.eFrame2 = &(atomColData.electroFrame[atom2]); | |
899 | } | |
900 | + | |
901 | if (storageLayout_ & DataStorage::dslTorque) { | |
902 | idat.t1 = &(atomRowData.torque[atom1]); | |
903 | idat.t2 = &(atomColData.torque[atom2]); | |
904 | } | |
905 | + | |
906 | + | if (storageLayout_ & DataStorage::dslSkippedCharge) { |
907 | + | idat.skippedCharge1 = &(atomRowData.skippedCharge[atom1]); |
908 | + | idat.skippedCharge2 = &(atomColData.skippedCharge[atom2]); |
909 | + | } |
910 | #else | |
911 | < | idat.atypes = make_pair( ff_->getAtomType(identsLocal[atom1]), |
912 | < | ff_->getAtomType(identsLocal[atom2]) ); |
911 | > | idat.atypes = make_pair( ff_->getAtomType(idents[atom1]), |
912 | > | ff_->getAtomType(idents[atom2]) ); |
913 | ||
914 | if (storageLayout_ & DataStorage::dslElectroFrame) { | |
915 | idat.eFrame1 = &(snap_->atomData.electroFrame[atom1]); | |
916 | idat.eFrame2 = &(snap_->atomData.electroFrame[atom2]); | |
917 | } | |
918 | + | |
919 | if (storageLayout_ & DataStorage::dslTorque) { | |
920 | idat.t1 = &(snap_->atomData.torque[atom1]); | |
921 | idat.t2 = &(snap_->atomData.torque[atom2]); | |
922 | } | |
923 | + | |
924 | + | if (storageLayout_ & DataStorage::dslSkippedCharge) { |
925 | + | idat.skippedCharge1 = &(snap_->atomData.skippedCharge[atom1]); |
926 | + | idat.skippedCharge2 = &(snap_->atomData.skippedCharge[atom2]); |
927 | + | } |
928 | #endif | |
929 | } | |
930 | ||
931 | + | |
932 | + | void ForceMatrixDecomposition::unpackSkipData(InteractionData &idat, int atom1, int atom2) { |
933 | + | #ifdef IS_MPI |
934 | + | pot_row[atom1] += 0.5 * *(idat.pot); |
935 | + | pot_col[atom2] += 0.5 * *(idat.pot); |
936 | + | #else |
937 | + | pairwisePot += *(idat.pot); |
938 | + | #endif |
939 | + | |
940 | + | } |
941 | + | |
942 | + | |
943 | /* | |
944 | * buildNeighborList | |
945 | * | |
# | Line 943 | Line 975 | namespace OpenMD { | |
975 | int cellIndex; | |
976 | int nCtot = nCells_.x() * nCells_.y() * nCells_.z(); | |
977 | ||
946 | – | cerr << "flag1\n"; |
978 | #ifdef IS_MPI | |
979 | cellListRow_.resize(nCtot); | |
980 | cellListCol_.resize(nCtot); | |
981 | #else | |
982 | cellList_.resize(nCtot); | |
983 | #endif | |
984 | < | cerr << "flag2\n"; |
984 | > | |
985 | #ifdef IS_MPI | |
986 | for (int i = 0; i < nGroupsInRow_; i++) { | |
987 | rs = cgRowData.position[i]; | |
# | Line 1111 | Line 1142 | namespace OpenMD { | |
1142 | saved_CG_positions_.clear(); | |
1143 | for (int i = 0; i < nGroups_; i++) | |
1144 | saved_CG_positions_.push_back(snap_->cgData.position[i]); | |
1145 | < | |
1145 | > | |
1146 | return neighborList; | |
1147 | } | |
1148 | } //end namespace OpenMD |
– | Removed lines |
+ | Added lines |
< | Changed lines |
> | Changed lines |