OpenMD 3.1
Molecular Dynamics in the Open
Loading...
Searching...
No Matches
ForceMatrixDecomposition.hpp
1/*
2 * Copyright (c) 2004-present, The University of Notre Dame. All rights
3 * reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 *
8 * 1. Redistributions of source code must retain the above copyright notice,
9 * this list of conditions and the following disclaimer.
10 *
11 * 2. Redistributions in binary form must reproduce the above copyright notice,
12 * this list of conditions and the following disclaimer in the documentation
13 * and/or other materials provided with the distribution.
14 *
15 * 3. Neither the name of the copyright holder nor the names of its
16 * contributors may be used to endorse or promote products derived from
17 * this software without specific prior written permission.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
23 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
30 *
31 * SUPPORT OPEN SCIENCE! If you use OpenMD or its source code in your
32 * research, please cite the appropriate papers when you publish your
33 * work. Good starting points are:
34 *
35 * [1] Meineke, et al., J. Comp. Chem. 26, 252-271 (2005).
36 * [2] Fennell & Gezelter, J. Chem. Phys. 124, 234104 (2006).
37 * [3] Sun, Lin & Gezelter, J. Chem. Phys. 128, 234107 (2008).
38 * [4] Vardeman, Stocker & Gezelter, J. Chem. Theory Comput. 7, 834 (2011).
39 * [5] Kuang & Gezelter, Mol. Phys., 110, 691-701 (2012).
40 * [6] Lamichhane, Gezelter & Newman, J. Chem. Phys. 141, 134109 (2014).
41 * [7] Lamichhane, Newman & Gezelter, J. Chem. Phys. 141, 134110 (2014).
42 * [8] Bhattarai, Newman & Gezelter, Phys. Rev. B 99, 094106 (2019).
43 */
44
45#ifndef PARALLEL_FORCEMATRIXDECOMPOSITION_HPP
46#define PARALLEL_FORCEMATRIXDECOMPOSITION_HPP
47
48#include "brains/Snapshot.hpp"
50#include "parallel/ForceDecomposition.hpp"
51
52#ifdef IS_MPI
53#include "parallel/Communicator.hpp"
54#endif
55
56using namespace std;
57namespace OpenMD {
58
60 public:
63
65 void zeroWorkArrays();
66 void distributeData();
67 void collectIntermediateData();
68 void distributeIntermediateData();
69 void collectSelfData();
70 void collectData();
71
72 // neighbor list routines
73 void buildNeighborList(vector<int>& neighborList, vector<int>& point,
74 vector<Vector3d>& savedPositions);
75
76 // group bookkeeping
77 Vector3d& getGroupVelocityColumn(int cg2);
78
79 // Group->atom bookkeeping
80 vector<int>& getAtomsInGroupRow(int cg1);
81 vector<int>& getAtomsInGroupColumn(int cg2);
82 Vector3d getAtomToGroupVectorRow(int atom1, int cg1);
83 Vector3d getAtomToGroupVectorColumn(int atom2, int cg2);
84 RealType& getMassFactorRow(int atom1);
85 RealType& getMassFactorColumn(int atom2);
86
87 // spatial data
88 Vector3d getIntergroupVector(int cg1, int cg2);
89 Vector3d getInteratomicVector(int atom1, int atom2);
90
91 // atom bookkeeping
92 int& getNAtomsInRow();
93 int getTopologicalDistance(int atom1, int atom2);
94 vector<int>& getExcludesForAtom(int atom1);
95 bool skipAtomPair(int atom1, int atom2, int cg1, int cg2);
96 bool excludeAtomPair(int atom1, int atom2);
97 int getGlobalIDRow(int atom1);
98 int getGlobalIDCol(int atom1);
99 int getGlobalID(int atom1);
100 void addForceToAtomRow(int atom1, Vector3d fg);
101 void addForceToAtomColumn(int atom2, Vector3d fg);
102 Vector3d& getAtomVelocityColumn(int atom2);
103
104 // filling interaction blocks with pointers
105 void fillInteractionData(InteractionData& idat, int atom1, int atom2,
106 bool newAtom1 = true);
107 void unpackInteractionData(InteractionData& idat, int atom1, int atom2);
108 void unpackPrePairData(InteractionData& idat, int atom1, int atom2);
109
110 private:
111 int nLocal_;
112 int nGroups_;
113 vector<int> AtomLocalToGlobal;
114 vector<int> cgLocalToGlobal;
115 vector<RealType> groupCutoff;
116 vector<int> groupToGtype;
117
118#ifdef IS_MPI
119 DataStorage atomRowData;
120 DataStorage atomColData;
121 DataStorage cgRowData;
122 DataStorage cgColData;
123
124 int nAtomsInRow_;
125 int nAtomsInCol_;
126 int nGroupsInRow_;
127 int nGroupsInCol_;
128
129 Communicator<Row> rowComm;
130 Communicator<Column> colComm;
131
132 Plan<int>* AtomPlanIntRow {nullptr};
133 Plan<RealType>* AtomPlanRealRow {nullptr};
134 Plan<Vector3d>* AtomPlanVectorRow {nullptr};
135 Plan<Mat3x3d>* AtomPlanMatrixRow {nullptr};
136 Plan<potVec>* AtomPlanPotRow {nullptr};
137
138 Plan<int>* AtomPlanIntColumn {nullptr};
139 Plan<RealType>* AtomPlanRealColumn {nullptr};
140 Plan<Vector3d>* AtomPlanVectorColumn {nullptr};
141 Plan<Mat3x3d>* AtomPlanMatrixColumn {nullptr};
142 Plan<potVec>* AtomPlanPotColumn {nullptr};
143
144 Plan<int>* cgPlanIntRow {nullptr};
145 Plan<Vector3d>* cgPlanVectorRow {nullptr};
146 Plan<int>* cgPlanIntColumn {nullptr};
147 Plan<Vector3d>* cgPlanVectorColumn {nullptr};
148
149 // work arrays for assembling potential energy
150 vector<potVec> pot_row;
151 vector<potVec> pot_col;
152
153 vector<potVec> expot_row;
154 vector<potVec> expot_col;
155
156 vector<potVec> selepot_row;
157 vector<potVec> selepot_col;
158
159 vector<int> identsRow;
160 vector<int> identsCol;
161
162 vector<int> regionsRow;
163 vector<int> regionsCol;
164
165 vector<AtomType*> atypesRow;
166 vector<AtomType*> atypesCol;
167
168 vector<int> AtomRowToGlobal;
169 vector<int> AtomColToGlobal;
170
171 public:
172 vector<int> cgRowToGlobal;
173 vector<int> cgColToGlobal;
174
175 private:
176 vector<vector<int>> cellListRow_;
177 vector<vector<int>> cellListCol_;
178
179 vector<vector<int>> groupListRow_;
180 vector<vector<int>> groupListCol_;
181
182 vector<RealType> massFactorsRow;
183 vector<RealType> massFactorsCol;
184
185 vector<int> regionRow;
186 vector<int> regionCol;
187#endif
188 };
189} // namespace OpenMD
190
191#endif
ForceDecomposition is an interface for passing out and collecting information from many processors at...
bool excludeAtomPair(int atom1, int atom2)
We need to handle the interactions for atoms who are involved in the same rigid body as well as some ...
vector< int > & getAtomsInGroupRow(int cg1)
returns the list of atoms belonging to this group.
bool skipAtomPair(int atom1, int atom2, int cg1, int cg2)
We need to exclude some overcounted interactions that result from the parallel decomposition.
void distributeInitialData()
distributeInitialData is essentially a copy of the older fortran SimulationSetup
void collectSelfData()
Collects information obtained during the post-pair (and embedding functional) loops onto local data s...
InteractionManager is responsible for keeping track of the non-bonded interactions (C++)
One of the heavy-weight classes of OpenMD, SimInfo maintains objects and variables relating to the cu...
Definition SimInfo.hpp:93
This basic Periodic Table class was originally taken from the data.cpp file in OpenBabel.
The InteractionData struct.