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