NAMD
GlobalMaster.C
Go to the documentation of this file.
1 
7 #include "Node.h"
8 #include "Molecule.h"
9 #include "NamdTypes.h"
10 #include "GlobalMaster.h"
11 #include "NamdEventsProfiling.h"
12 
13 //#define DEBUGM
14 #define MIN_DEBUG_LEVEL 1
15 #include "Debug.h"
16 
24  ForceList::iterator gtf_i,
25  ForceList::iterator gtf_e,
26  IntList::iterator goi_i,
27  IntList::iterator goi_e,
30  AtomIDList::iterator last_atoms_forced_i,
31  AtomIDList::iterator last_atoms_forced_e,
32  ForceList::iterator last_forces_i,
33  AtomIDList::iterator forceid_i,
34  AtomIDList::iterator forceid_e,
35  ForceList::iterator totalforce_i) {
36  atomIdBegin = a_i;
37  atomIdEnd = a_e;
38  atomPositionBegin = p_i;
39  groupPositionBegin = g_i;
40  groupPositionEnd = g_e;
41  groupMassBegin = gm_i;
42  groupMassEnd = gm_e;
43  groupTotalForceBegin = gtf_i;
44  groupTotalForceEnd = gtf_e;
45  gridObjIndexBegin = goi_i;
46  gridObjIndexEnd = goi_e;
47  gridObjValueBegin = gov_i;
48  gridObjValueEnd = gov_e;
49  lastAtomsForcedBegin = last_atoms_forced_i;
50  lastAtomsForcedEnd = last_atoms_forced_e;
51  lastForcesBegin = last_forces_i;
52  forceIdBegin = forceid_i;
53  forceIdEnd = forceid_e;
54  totalForceBegin = totalforce_i;
55 
56  calculate();
57 
58  /* check to make sure the force arrays still match */
59  if(appForcesChanged) {
60  check();
61  }
62 }
63 
64 void GlobalMaster::check() const {
65  /* check to make sure the force arrays still match */
66  if(fAtoms.size() != appForces.size())
67  NAMD_die("# of atoms forced != # of forces given");
69  NAMD_die("# of groups forced != # of groups requested");
71  NAMD_die("# of grid objects forced != # of grid objects requested");
72 }
73 
75  reqAtomsChanged = false;
76  appForcesChanged = false;
77  reqGroupsChanged = false;
78  reqGridObjsChanged = false;
79 }
80 
82  NAMD_die("Internal error: pure virtual function called");
83 }
84 
86  step = -1;
88  clearChanged();
89  atomIdBegin = 0;
90  atomIdEnd = 0;
93  groupPositionEnd = 0;
94  groupMassBegin = 0;
95  groupMassEnd = 0;
97  gridObjValueEnd = 0;
100  lastForcesBegin = 0;
101  forceIdBegin = 0;
102  forceIdEnd = 0;
103  totalForceBegin = 0;
104  lattice = 0;
105  totalForceRequested = false;
106 }
107 
109  return reqAtomsChanged;
110 }
111 
113  return appForcesChanged;
114 }
115 
117  return reqGroupsChanged;
118 }
119 
121  return reqGridObjsChanged;
122 }
123 
125  return reqAtoms;
126 }
127 
129  reqAtomsChanged = true;
130  DebugM(3,"modifyRequestedAtoms()\n" << endi);
131  return reqAtoms;
132 }
133 
135  return fAtoms;
136 }
137 
139  return appForces;
140 }
141 
143  return grpForces;
144 }
145 
147  return gridobjForces;
148 }
149 
151  return reqGroups;
152 }
153 
155  return reqGridObjs;
156 }
157 
159  appForcesChanged = true;
160  return fAtoms;
161 }
162 
164  appForcesChanged = true;
165  return appForces;
166 }
167 
169  // XXX should we mark something else here?
170  appForcesChanged = true;
171  return grpForces;
172 }
173 
175  reqGridObjsChanged = true;
176  DebugM(3,"modifyRequestedGridObjects()\n" << endi);
177  return reqGridObjs;
178 }
179 
181  appForcesChanged = true;
182  return gridobjForces;
183 }
184 
186  reqGroupsChanged = true;
187  DebugM(1,"Groups have changed.\n");
188  return reqGroups;
189 }
190 
192  return atomIdBegin;
193 }
194 
196  return atomIdEnd;
197 }
198 
200  return atomPositionBegin;
201 }
202 
204  return groupPositionBegin;
205 }
206 
208  return groupPositionEnd;
209 }
210 
212  return groupTotalForceBegin;
213 }
214 
216  return groupTotalForceEnd;
217 }
218 
220  return gridObjIndexBegin;
221 }
222 
224  return gridObjIndexEnd;
225 }
226 
228  return gridObjValueBegin;
229 }
230 
232  return gridObjValueEnd;
233 }
234 
236 {
237  return groupMassBegin;
238 }
239 
241  return groupMassEnd;
242 }
243 
245  return lastAtomsForcedBegin;
246 }
247 
249  return lastAtomsForcedEnd;
250 }
251 
253  return lastForcesBegin;
254 }
255 
257 {
258  return forceIdBegin;
259 }
260 
262 {
263  return forceIdEnd;
264 }
265 
267 {
268  return totalForceBegin;
269 }
ForceList grpForces
Definition: GlobalMaster.h:184
ForceList & modifyAppliedForces()
Definition: GlobalMaster.C:163
int old_num_groups_requested
Definition: GlobalMaster.h:57
AtomIDList & modifyRequestedAtoms()
Definition: GlobalMaster.C:128
const ForceList & groupForces()
Definition: GlobalMaster.C:142
BigRealList & modifyGridObjForces()
Definition: GlobalMaster.C:180
int size(void) const
Definition: ResizeArray.h:131
Elem * iterator
Definition: ResizeArray.h:35
bool totalForceRequested
Definition: GlobalMaster.h:133
BigRealList::iterator gridObjValueEnd
Definition: GlobalMaster.h:161
IntList::iterator gridObjIndexBegin
Definition: GlobalMaster.h:158
AtomIDList::const_iterator getForceIdEnd()
Definition: GlobalMaster.C:261
AtomIDList::const_iterator getAtomIdBegin()
Definition: GlobalMaster.C:191
PositionList::const_iterator getGroupPositionEnd()
Definition: GlobalMaster.C:207
Definition: Vector.h:72
AtomIDList reqAtoms
Definition: GlobalMaster.h:176
ResizeArray< AtomIDList > reqGroups
Definition: GlobalMaster.h:183
bool changedAtoms()
Definition: GlobalMaster.C:108
#define DebugM(x, y)
Definition: Debug.h:75
std::ostream & endi(std::ostream &s)
Definition: InfoStream.C:54
ForceList::const_iterator getGroupTotalForceBegin()
Definition: GlobalMaster.C:211
ForceList::iterator totalForceBegin
Definition: GlobalMaster.h:171
AtomIDList::iterator lastAtomsForcedEnd
Definition: GlobalMaster.h:166
ForceList::iterator lastForcesBegin
Definition: GlobalMaster.h:165
PositionList::const_iterator getAtomPositionBegin()
Definition: GlobalMaster.C:199
ForceList appForces
Definition: GlobalMaster.h:180
bool reqGroupsChanged
Definition: GlobalMaster.h:182
AtomIDList::iterator lastAtomsForcedBegin
Definition: GlobalMaster.h:164
BigRealList::const_iterator getGroupMassEnd()
Definition: GlobalMaster.C:240
bool reqGridObjsChanged
Definition: GlobalMaster.h:186
const ResizeArray< AtomIDList > & requestedGroups()
Definition: GlobalMaster.C:150
BigRealList gridobjForces
Definition: GlobalMaster.h:188
void processData(AtomIDList::iterator a_i, AtomIDList::iterator a_e, PositionList::iterator p_i, PositionList::iterator g_i, PositionList::iterator g_e, BigRealList::iterator gm_i, BigRealList::iterator gm_e, ForceList::iterator gtf_i, ForceList::iterator gtf_e, IntList::iterator goi_i, IntList::iterator goi_e, BigRealList::iterator gov_i, BigRealList::iterator gov_e, AtomIDList::iterator last_atoms_forced_i, AtomIDList::iterator last_atoms_forced_e, ForceList::iterator last_forces_i, AtomIDList::iterator, AtomIDList::iterator, ForceList::iterator)
Definition: GlobalMaster.C:17
AtomIDList::const_iterator getForceIdBegin()
Definition: GlobalMaster.C:256
virtual void calculate()
Definition: GlobalMaster.C:81
const ForceList & appliedForces()
Definition: GlobalMaster.C:138
PositionList::iterator atomPositionBegin
Definition: GlobalMaster.h:151
ForceList::iterator groupTotalForceEnd
Definition: GlobalMaster.h:157
IntList::const_iterator getGridObjIndexBegin()
Definition: GlobalMaster.C:219
bool changedForces()
Definition: GlobalMaster.C:112
bool changedGridObjs()
Definition: GlobalMaster.C:120
const AtomID * const_iterator
Definition: ResizeArray.h:38
BigRealList::iterator gridObjValueBegin
Definition: GlobalMaster.h:160
ForceList::const_iterator getLastForcesBegin()
Definition: GlobalMaster.C:252
bool reqAtomsChanged
Definition: GlobalMaster.h:175
AtomIDList::iterator atomIdEnd
Definition: GlobalMaster.h:150
IntList & modifyRequestedGridObjects()
Definition: GlobalMaster.C:174
BigRealList::iterator groupMassBegin
Definition: GlobalMaster.h:154
bool changedGroups()
Definition: GlobalMaster.C:116
AtomIDList & modifyForcedAtoms()
Definition: GlobalMaster.C:158
IntList reqGridObjs
Definition: GlobalMaster.h:187
ResizeArray< AtomIDList > & modifyRequestedGroups()
Definition: GlobalMaster.C:185
void NAMD_die(const char *err_msg)
Definition: common.C:147
IntList::iterator gridObjIndexEnd
Definition: GlobalMaster.h:159
BigRealList::const_iterator getGroupMassBegin()
Definition: GlobalMaster.C:235
ForceList & modifyGroupForces()
Definition: GlobalMaster.C:168
AtomIDList::iterator atomIdBegin
Definition: GlobalMaster.h:149
BigRealList::const_iterator getGridObjValueBegin()
Definition: GlobalMaster.C:227
BigRealList::iterator groupMassEnd
Definition: GlobalMaster.h:155
IntList::const_iterator getGridObjIndexEnd()
Definition: GlobalMaster.C:223
const Lattice * lattice
Definition: GlobalMaster.h:142
PositionList::iterator groupPositionBegin
Definition: GlobalMaster.h:152
bool appForcesChanged
Definition: GlobalMaster.h:178
AtomIDList::const_iterator getAtomIdEnd()
Definition: GlobalMaster.C:195
AtomIDList::iterator forceIdBegin
Definition: GlobalMaster.h:169
const BigRealList & gridObjForces()
Definition: GlobalMaster.C:146
AtomIDList::const_iterator getLastAtomsForcedBegin()
Definition: GlobalMaster.C:244
void clearChanged()
Definition: GlobalMaster.C:74
AtomIDList fAtoms
Definition: GlobalMaster.h:179
const IntList & requestedGridObjs()
Definition: GlobalMaster.C:154
AtomIDList::iterator forceIdEnd
Definition: GlobalMaster.h:170
AtomIDList::const_iterator getLastAtomsForcedEnd()
Definition: GlobalMaster.C:248
const AtomIDList & forcedAtoms()
Definition: GlobalMaster.C:134
void check() const
Definition: GlobalMaster.C:64
PositionList::const_iterator getGroupPositionBegin()
Definition: GlobalMaster.C:203
ForceList::const_iterator getTotalForce()
Definition: GlobalMaster.C:266
ForceList::iterator groupTotalForceBegin
Definition: GlobalMaster.h:156
PositionList::iterator groupPositionEnd
Definition: GlobalMaster.h:153
BigRealList::const_iterator getGridObjValueEnd()
Definition: GlobalMaster.C:231
ForceList::const_iterator getGroupTotalForceEnd()
Definition: GlobalMaster.C:215
const AtomIDList & requestedAtoms()
Definition: GlobalMaster.C:124