--- branches/development/src/parallel/ForceDecomposition.hpp 2011/05/26 13:55:04 1569 +++ branches/development/src/parallel/ForceDecomposition.hpp 2012/05/24 20:59:54 1723 @@ -36,7 +36,8 @@ * [1] Meineke, et al., J. Comp. Chem. 26, 252-271 (2005). * [2] Fennell & Gezelter, J. Chem. Phys. 124, 234104 (2006). * [3] Sun, Lin & Gezelter, J. Chem. Phys. 128, 24107 (2008). - * [4] Vardeman & Gezelter, in progress (2009). + * [4] Kuang & Gezelter, J. Chem. Phys. 133, 164101 (2010). + * [5] Vardeman, Stocker & Gezelter, J. Chem. Theory Comput. 7, 834 (2011). */ #ifndef PARALLEL_FORCEDECOMPOSITION_HPP @@ -45,10 +46,15 @@ #include "brains/SimInfo.hpp" #include "brains/SnapshotManager.hpp" #include "nonbonded/NonBondedInteraction.hpp" +#include "nonbonded/Cutoffs.hpp" +#include "nonbonded/InteractionManager.hpp" +#include "utils/Tuple.hpp" using namespace std; namespace OpenMD { + typedef tuple3 groupCutoffs; + /** * @class ForceDecomposition * @@ -86,21 +92,29 @@ namespace OpenMD { class ForceDecomposition { public: - ForceDecomposition(SimInfo* info); + ForceDecomposition(SimInfo* info, InteractionManager* iMan); virtual ~ForceDecomposition() {} virtual void distributeInitialData() = 0; virtual void distributeData() = 0; + virtual void zeroWorkArrays() = 0; virtual void collectIntermediateData() = 0; virtual void distributeIntermediateData() = 0; virtual void collectData() = 0; + virtual potVec* getEmbeddingPotential() { return &embeddingPot; } + virtual potVec* getPairwisePotential() { return &pairwisePot; } // neighbor list routines virtual bool checkNeighborList(); virtual vector > buildNeighborList() = 0; + // how to handle cutoffs: + void setCutoffPolicy(CutoffPolicy cp) {cutoffPolicy_ = cp;} + void setUserCutoff(RealType rcut) {userCutoff_ = rcut; userChoseCutoff_ = true; } + // group bookkeeping - virtual pair getGroupTypes(int cg1, int cg2) = 0; + virtual groupCutoffs getGroupCutoffs(int cg1, int cg2) = 0; + virtual Vector3d getGroupVelocityColumn(int atom2) = 0; // Group->atom bookkeeping virtual vector getAtomsInGroupRow(int cg1) = 0; @@ -116,51 +130,66 @@ namespace OpenMD { virtual Vector3d getInteratomicVector(int atom1, int atom2) = 0; // atom bookkeeping - virtual vector getAtomList() = 0; - virtual vector getSkipsForAtom(int atom1) = 0; + virtual int getNAtomsInRow() = 0; + virtual vector getExcludesForAtom(int atom1) = 0; virtual bool skipAtomPair(int atom1, int atom2) = 0; + virtual bool excludeAtomPair(int atom1, int atom2) = 0; + virtual int getTopologicalDistance(int atom1, int atom2) = 0; virtual void addForceToAtomRow(int atom1, Vector3d fg) = 0; virtual void addForceToAtomColumn(int atom2, Vector3d fg) = 0; + virtual Vector3d getAtomVelocityColumn(int atom2) = 0; // filling interaction blocks with pointers - virtual InteractionData fillInteractionData(int atom1, int atom2) = 0; - virtual InteractionData fillSkipData(int atom1, int atom2) = 0; - virtual SelfData fillSelfData(int atom1); + virtual void fillInteractionData(InteractionData &idat, int atom1, int atom2) = 0; + virtual void unpackInteractionData(InteractionData &idat, int atom1, int atom2) = 0; + + virtual void fillSelfData(SelfData &sdat, int atom1); + + virtual void addToHeatFlux(Vector3d hf); + virtual void setHeatFlux(Vector3d hf); protected: SimInfo* info_; SnapshotManager* sman_; Snapshot* snap_; + ForceField* ff_; + InteractionManager* interactionMan_; + int storageLayout_; + bool needVelocities_; RealType skinThickness_; /**< Verlet neighbor list skin thickness */ + RealType largestRcut_; - map, int> topoDist; //< topoDist gives the - //topological distance between - //two atomic sites. This - //declaration is agnostic - //regarding the parallel - //decomposition. The two - //indices could be local or row - //& column. It will be up to - //the specific decomposition - //method to fill this. - map, bool> exclude; //< exclude is the set of pairs - //to leave out of non-bonded - //force evaluations. This - //declaration is agnostic - //regarding the parallel - //decomposition. The two - //indices could be local or row - //& column. It will be up to - //the specific decomposition - //method to fill this. + vector idents; + potVec pairwisePot; + potVec embeddingPot; + /** + * The topological distance between two atomic sites is handled + * via two vector structures for speed. These structures agnostic + * regarding the parallel decomposition. The index for + * toposForAtom could be local or row, while the values could be + * local or column. It will be up to the specific decomposition + * method to fill these. + */ + vector > toposForAtom; + vector > topoDist; + vector > excludesForAtom; vector > groupList_; + vector massFactors; + vector atypesLocal; + vector cellOffsets_; Vector3i nCells_; vector > cellList_; vector saved_CG_positions_; + bool userChoseCutoff_; + RealType userCutoff_; + CutoffPolicy cutoffPolicy_; + + map, tuple3 > gTypeCutoffMap; + }; } #endif