NAMD
GlobalMasterServer.C
Go to the documentation of this file.
1 
7 /*
8  Forwards atoms to master node for force evaluation.
9 */
10 
11 #include "ComputeGlobalMsgs.h"
12 #include "ComputeMgr.h"
13 #include "NamdTypes.h"
14 #include "InfoStream.h"
15 #include "Node.h"
16 #include "SimParameters.h"
17 #include "Molecule.h"
18 #include "PatchMap.h"
19 //#define DEBUGM
20 #define MIN_DEBUG_LEVEL 3
21 #include "Debug.h"
22 #include "PatchData.h"
23 #include <stdlib.h>
24 #include <vector>
25 #include <algorithm>
26 #include "NamdEventsProfiling.h"
27 using namespace std;
29  int atomID;
30  int index;
31 };
32 
34  DebugM(3,"Adding client\n");
35  clientList.add(newClient);
36  newClient->setLattice(&lattice);
37  DebugM(2,"Added.\n");
38 }
39 
41  DebugM(3,"Storing data (" << msg->aid.size() << " positions) on master\n");
42 
43  if ( msg->step != -1 ) step = msg->step;
44 
45  /* get the beginning and end of the lists */
46  AtomIDList::iterator a_i = msg->aid.begin();
47  AtomIDList::iterator a_e = msg->aid.end();
48  PositionList::iterator p_i = msg->p.begin();
49  PositionList::iterator g_i = msg->gcom.begin();
50  PositionList::iterator g_e = msg->gcom.end();
51  BigRealList::iterator gm_i = msg->gmass.begin();
52 
53  /* iterate over each member of the atom lists */
54  for ( ; a_i != a_e; ++a_i, ++p_i ) {
55  receivedAtomIDs.add(*a_i);
56  receivedAtomPositions.add(*p_i);
57  }
58 
59  /* iterate over each member of "total force" lists */
60  a_e = msg->fid.end();
61  ForceList::iterator f_i=msg->tf.begin();
62  for (a_i=msg->fid.begin() ; a_i!=a_e; ++a_i,++f_i) {
63  receivedForceIDs.add(*a_i);
64  receivedTotalForces.add(*f_i);
65  }
66 
67  /* iterate over each member of the group position list */
68  int i=0;
69  for ( ; g_i != g_e; ++g_i, ++gm_i ) {
70  DebugM(1,"Received center of mass "<<*g_i<<"\n");
71  if(i >= totalGroupsRequested) NAMD_bug("Received too many groups.");
72  receivedGroupPositions[i] += (*g_i);
73  receivedGroupMasses[i] += (*gm_i);
74  i++;
75  }
76  if(i!=totalGroupsRequested) NAMD_bug("Received too few groups.");
77 
78  /* iterate over each member of group total force lists */
79  int ntf = msg->gtf.size();
80  if ( ntf && ntf != receivedGroupTotalForces.size() ) NAMD_bug("Received wrong number of group forces.");
81  ForceList::iterator gf_i=msg->gtf.begin();
82  ForceList::iterator gf_e=msg->gtf.end();
83  for ( i=0 ; gf_i != gf_e; ++gf_i, ++i ) {
84  receivedGroupTotalForces[i] += (*gf_i);
85  }
86 
87  // Get values of the GridForce objects
88  int ngov = msg->gridobjvalue.size();
89  IntList::iterator goi_i = msg->gridobjindex.begin();
91  BigRealList::iterator gov_e = msg->gridobjvalue.end();
92  for ( i=0 ; gov_i != gov_e; gov_i++, goi_i++, i++ ) {
93  receivedGridObjIndices[i] = (*goi_i);
94  receivedGridObjValues[i] += (*gov_i);
95  }
96  if (ngov && ngov != receivedGridObjValues.size()) {
97  NAMD_bug("Received wrong number of grid objects.");
98  }
99 
100  if ( msg->lat.size() ) {
101  if ( latticeCount ) {
102  NAMD_bug("GlobalMasterServer::recvData received lattice twice.");
103  }
104  lattice = msg->lat[0];
105  latticeCount = 1;
106  }
107 
108  recvCount += msg->count;
109  recvPatchesCount += msg->patchcount;
110  int numPatches = PatchMap::Object()->numPatches();
111 
112  /* done with the message, delete it */
113  delete msg;
114 
115  /* check whether we've gotten all the expected messages */
116 
117  DebugM(3, "received " << recvCount << " atom messages and "
118  << recvPatchesCount << " patch messages (out of " << numPatches
119  << " patches) from the ComputeGlobals\n" << endi);
120 
121  int numNeededPatches = totalGridObjsRequested ? numPatches : 0;
122  if (firstTime) numNeededPatches = 0;
123 
124  if (recvCount > numDataSenders + numForceSenders + 1) {
125  NAMD_bug("GlobalMasterServer::recvData recvCount too high.");
126  }
127  if(recvCount == numDataSenders + numForceSenders + 1) {
128  if ( ! latticeCount ) {
129  NAMD_bug("GlobalMasterServer::recvData did not receive lattice.");
130  }
131 
132  DebugM(3, "Received all needed data\n" << endi);
133 
134 #ifdef DEBUGM
135  for (size_t ig = 0; ig < receivedGroupMasses.size(); ig++) {
136  // The groups' positions will be normalized later, in callClients()
137  DebugM(3, "Group mass " << ig << " = "
138  << receivedGroupMasses[ig] << "\n" << endi);
139  }
140  for (size_t ig = 0; ig < receivedGridObjValues.size(); ig++) {
141  DebugM(3, "Grid object " << receivedGridObjIndices[ig] << " = "
142  << receivedGridObjValues[ig] << "\n" << endi);
143  }
144 #endif
145 
146  int oldTotalGroupsRequested = totalGroupsRequested;
147 
148  DebugM(3,"received messages from each of the ComputeGlobals\n");
149  int resendCoordinates = callClients();
150 
151  if (resendCoordinates) {
152  DebugM(3, "resendCoordinates\n" << endi);
153  }
154 
155  /* now restart */
156  step = -1;
157  receivedAtomIDs.resize(0);
158  receivedAtomPositions.resize(0);
159  receivedGroupPositions.resize(totalGroupsRequested);
160  receivedGroupPositions.setall(Vector(0,0,0));
161  receivedGroupMasses.resize(totalGroupsRequested);
162  receivedGroupMasses.setall(0);
163  receivedGridObjIndices.resize(totalGridObjsRequested);
164  receivedGridObjIndices.setall(-1);
165  receivedGridObjValues.resize(totalGridObjsRequested);
166  receivedGridObjValues.setall(0);
167  latticeCount = 0;
168  recvCount = 0;
169  recvPatchesCount = 0;
170  if ( resendCoordinates ) {
171  recvCount += numForceSenders;
172  } else {
173  receivedGroupTotalForces.resize(totalGroupsRequested);
174  receivedGroupTotalForces.setall(0);
175  receivedForceIDs.resize(0);
176  receivedTotalForces.resize(0);
177  }
178  }
179 }
180 
181 void GlobalMasterServer::resetAtomList(AtomIDList &atomsRequested) {
182  atomsRequested.resize(0);
183 
184  /* iterate over all of the masters */
185  GlobalMaster **m_i = clientList.begin();
186  GlobalMaster **m_e = clientList.end();
187  while(m_i != m_e) {
188  /* add all of the atoms in this master */
189  int i;
190  for(i=0;i<(*m_i)->requestedAtoms().size();i++) {
191  atomsRequested.add((*m_i)->requestedAtoms()[i]);
192  }
193 
194  /* go to next master */
195  m_i++;
196  }
197 
198  /* remove duplicates */
199  sort(atomsRequested.begin(), atomsRequested.end());
200  AtomIDList::iterator it = unique(atomsRequested.begin(), atomsRequested.end());
201  atomsRequested.resize( distance(atomsRequested.begin(), it) );
202 }
203 
204 void GlobalMasterServer::resetGroupList(AtomIDList &groupsRequested,
205  int *numGroups) {
206  DebugM(3,"Rebuilding the group list\n");
207  groupsRequested.resize(0);
208  *numGroups = 0;
209 
210  /* iterate over all of the masters */
211  GlobalMaster **m_i = clientList.begin();
212  GlobalMaster **m_e = clientList.end();
213  while(m_i != m_e) {
214 
215  /* add all of the groups requested by this master */
216  int i;
217  GlobalMaster *master = *m_i;
218  for(i=0;i<master->requestedGroups().size();i++) {
219  /* add all of the atoms in this group, then add a -1 */
220  int j;
221  const AtomIDList &atoms_in_group = master->requestedGroups()[i];
222  (*numGroups) ++;
223  DebugM(1,"adding group "<<*numGroups<<"\n");
224  for(j=0;j<atoms_in_group.size();j++) {
225  groupsRequested.add(atoms_in_group[j]); // add an atom
226  }
227  DebugM(1,"here\n");
228  groupsRequested.add(-1); // add a -1 to separate the groups (yuck)
229  }
230 
231  /* go to next master */
232  m_i++;
233  }
234 }
235 
236 void GlobalMasterServer::resetForceList(AtomIDList &atomsForced,
237  ForceList &forces,
238  ForceList &groupForces) {
239  DebugM(1,"Restting forces\n");
240  atomsForced.resize(0);
241  forces.resize(0);
242  groupForces.resize(0);
243  lastAtomsForced.resize(0);
244  lastForces.resize(0);
245 
246  /* iterate over all of the masters */
247  GlobalMaster **m_i = clientList.begin();
248  GlobalMaster **m_e = clientList.end();
249  while(m_i != m_e) {
250  (*m_i)->check(); // just in case!
251 
252  /* add all of the atoms in this master */
253  int i;
254  DebugM(1,"Adding atom forces\n");
255  for(i=0;i<(*m_i)->forcedAtoms().size();i++) {
256  atomsForced.add((*m_i)->forcedAtoms()[i]);
257  forces.add((*m_i)->appliedForces()[i]);
258  lastAtomsForced.add((*m_i)->forcedAtoms()[i]);
259  lastForces.add((*m_i)->appliedForces()[i]);
260  }
261 
262  /* add all of the group forces for this master */
263  DebugM(1,"Adding "<<(*m_i)->requestedGroups().size()<<" group forces\n");
264  for(i=0;i<(*m_i)->groupForces().size();i++) {
265  groupForces.add((*m_i)->groupForces()[i]);
266  }
267 
268  /* go to next master */
269  DebugM(1,"Next master...\n");
270  m_i++;
271  }
272  DebugM(1,"Done restting forces\n");
273 }
274 
275 void GlobalMasterServer::resetGridObjList(IntList &gridObjsRequested) {
276  gridObjsRequested.resize(0);
277 
278  for (GlobalMaster **m_i = clientList.begin(); m_i != clientList.end();
279  m_i++) {
280  // add all of the grids requested by this master
281  GlobalMaster *master = *m_i;
282  for (size_t i = 0; i < master->requestedGridObjs().size(); i++) {
283  gridObjsRequested.add(master->requestedGridObjs()[i]);
284  }
285  }
286 
287  // remove duplicates
288  sort(gridObjsRequested.begin(), gridObjsRequested.end());
289  IntList::iterator it = unique(gridObjsRequested.begin(), gridObjsRequested.end());
290  gridObjsRequested.resize( distance(gridObjsRequested.begin(), it) );
291  totalGridObjsRequested = gridObjsRequested.size();
292 }
293 
294 void GlobalMasterServer::resetGridObjForceList(BigRealList &gridObjForces)
295 {
296  gridObjForces.resize(totalGridObjsRequested);
297  gridObjForces.setall(0.0);
298 
299  GlobalMaster **m_i = clientList.begin();
300  GlobalMaster **m_e = clientList.end();
301  bool have_forces = false;
302  while (m_i != m_e) {
303  size_t i;
304  GlobalMaster *master = *m_i;
305  for(i = 0; i < master->gridObjForces().size(); i++) {
306  have_forces = true;
307  gridObjForces[i] += master->gridObjForces()[i];
308  }
309  m_i++;
310  }
311  if (!have_forces) {
312  gridObjForces.resize(0);
313  }
314 }
315 
316 struct atomID_less {
317  bool operator ()(position_index const& a, position_index const& b) const {
318  if (a.atomID < b.atomID) return true;
319  if (a.atomID > b.atomID) return false;
320 
321  return false;
322 }
323 };
324 
325 int GlobalMasterServer::callClients() {
326  DebugM(3,"Calling clients\n");
327  bool forceSendActive = false;
328  {
329  GlobalMaster **m_i = clientList.begin();
330  GlobalMaster **m_e = clientList.end();
331  for ( ; m_i != m_e; ++m_i ) {
332  if ( (*m_i)->changedAtoms() ) firstTime = 1;
333  if ( (*m_i)->changedGroups() ) firstTime = 1;
334  if ( (*m_i)->requestedTotalForces() ) forceSendActive = true;
335  (*m_i)->clearChanged();
336  }
337  }
338 
339  // CkPrintf("*** Call Client from PE %d \n", CkMyPe());
340  if(firstTime) {
341 
342  /* the first time we just get the requested atom ids from the
343  clients and send messages to the compute globals requesting
344  those atoms, so they can have coordinates for the first time
345  step. */
346  DebugM(1,"first time.\n");
348  resetAtomList(msg->newaid); // add any atom IDs made in constructors
349  // resetForceList(msg->aid,msg->f,msg->gforce); // same for forces
350  resetGroupList(msg->newgdef,&totalGroupsRequested);
351  msg->resendCoordinates = 1;
352  msg->reconfig = 1;
353  msg->totalforces = forceSendActive;
354  totalAtomsRequested = msg->newaid.size(); // record the atom total
355 
356  numDataSenders = totalAtomsRequested;
357  AtomIDList::iterator g_i = msg->newgdef.begin();
358  AtomIDList::iterator g_e = msg->newgdef.end();
359  Molecule *mol = Node::Object()->molecule;
360  for ( ; g_i != g_e; ++g_i ) {
361  if ( *g_i != -1 ) {
362  if (mol->atommass(*g_i) <= 0.001) {
363  iout << iWARN << "Atom " << (*g_i+1) << " has a near-zero mass, "
364  << "but it was requested for center-of-mass calculation.\n"
365  << endi;
366  }
367  ++numDataSenders;
368  }
369  }
370 
371  resetGridObjList(msg->newgridobjid);
372 
373  DebugM(3,"Sending configure ("<<totalAtomsRequested<<" atoms, "
374  <<totalGroupsRequested<<" groups, " << totalGridObjsRequested << " grids)\n");
375  DebugM(3,"calling sendComputeGlobalResults(msg) atoms.\n");
376  myComputeManager->sendComputeGlobalResults(msg);
377 
378  firstTime = 0;
379  return 1;
380  }
381 
382  /* check to make sure we've got everything */
383  if(receivedAtomIDs.size() != totalAtomsRequested) {
384  DebugM(3,"Requested " << totalAtomsRequested << " atoms.\n");
385  NAMD_bug("Got the wrong number of atoms");
386  }
387  if(receivedGroupPositions.size() != totalGroupsRequested) {
388  DebugM(3,"Requested " << totalGroupsRequested << " groups.\n");
389  DebugM(3,"Got " << receivedGroupPositions.size() << " group positions.\n");
390  NAMD_bug("Got the wrong number of groups");
391  }
392  if(receivedGroupMasses.size() != totalGroupsRequested) {
393  DebugM(3,"Requested " << totalGroupsRequested << " groups.\n");
394  DebugM(3,"Got " << receivedGroupMasses.size() << " group masses.\n");
395  NAMD_bug("Got the wrong number of group masses");
396  }
397  if(receivedGridObjValues.size() != totalGridObjsRequested) {
398  DebugM(3,"Requested " << totalGridObjsRequested << " grid objects.\n");
399  DebugM(3,"Got " << receivedGridObjValues.size() << " grid object values.\n");
400  NAMD_bug("Got the wrong number of grid object values");
401  }
402 
403  /* get the beginning and end of the lists */
404  AtomIDList::iterator a_i = receivedAtomIDs.begin();
405  AtomIDList::iterator a_e = receivedAtomIDs.end();
406  PositionList::iterator p_i = receivedAtomPositions.begin();
407  PositionList::iterator g_i = receivedGroupPositions.begin();
408  PositionList::iterator g_e = receivedGroupPositions.end();
409  ForceList::iterator gtf_i = receivedGroupTotalForces.begin();
410  ForceList::iterator gtf_e = receivedGroupTotalForces.end();
411  IntList::iterator goi_i = receivedGridObjIndices.begin();
412  IntList::iterator goi_e = receivedGridObjIndices.end();
413  BigRealList::iterator gov_i = receivedGridObjValues.begin();
414  BigRealList::iterator gov_e = receivedGridObjValues.end();
415  AtomIDList::iterator forced_atoms_i = lastAtomsForced.begin();
416  AtomIDList::iterator forced_atoms_e = lastAtomsForced.end();
417  ForceList::iterator forces_i = lastForces.begin();
418  GlobalMaster **m_i = clientList.begin();
419  GlobalMaster **m_e = clientList.end();
420  AtomIDList::iterator f_i = receivedForceIDs.begin();
421  AtomIDList::iterator f_e = receivedForceIDs.end();
422 
423  /* renormalize group center of mass by group total mass */
424  ResizeArray<BigReal>::iterator gm_i = receivedGroupMasses.begin();
425  for ( ; g_i < g_e; ++g_i, ++gm_i ) { *g_i /= *gm_i; }
426  g_i = receivedGroupPositions.begin();
427  gm_i = receivedGroupMasses.begin();
428 
429  /* use these to check whether anything has changed for any master */
430  bool requested_atoms_changed=false;
431  bool requested_forces_changed=false;
432  bool requested_groups_changed=false;
433  bool requested_grids_changed=false;
434  forceSendActive = false;
435 
436  vector <position_index> positions;
437  for (int j = 0; a_i != a_e; ++a_i, ++j) {
438  position_index temp;
439  temp.atomID = *a_i;
440  temp.index = j;
441  positions.push_back(temp);
442  }
443  sort(positions.begin(), positions.end(), atomID_less());
444 
445  /* call each of the masters with the coordinates */
446  while(m_i != m_e) {
447  int num_atoms_requested, num_groups_requested, num_gridobjs_requested;
448 
449  /* get the masters information */
450  GlobalMaster *master = *m_i;
451  num_atoms_requested = master->requestedAtoms().size();
452  num_groups_requested = master->requestedGroups().size();
453  num_gridobjs_requested = master->requestedGridObjs().size();
454 
455  AtomIDList clientAtomIDs;
456  PositionList clientAtomPositions;
457  AtomIDList clientReceivedForceIDs;
458  ForceList clientReceivedTotalForces;
459 
460  if (num_atoms_requested) {
461  vector <int> rqAtoms;
462  for (int i = 0; i < master->requestedAtoms().size(); i++){
463  rqAtoms.push_back(master->requestedAtoms()[i]);
464  }
465  sort(rqAtoms.begin(), rqAtoms.end());
466  int j = 0;
467  for (int i = 0; i < positions.size(); i++){
468  if (positions[i].atomID == rqAtoms[j]){
469  clientAtomPositions.add(receivedAtomPositions[positions[i].index]);
470  clientAtomIDs.add(rqAtoms[j]);
471  --i; // rqAtoms may contain repeats
472  if ( ++j == num_atoms_requested ) break;
473  }
474  }
475  if ( j != num_atoms_requested ) NAMD_bug(
476  "GlobalMasterServer::callClients() did not find all requested atoms");
477  }
478 
479  AtomIDList::iterator ma_i = clientAtomIDs.begin();
480  AtomIDList::iterator ma_e = clientAtomIDs.end();
481  PositionList::iterator mp_i = clientAtomPositions.begin();
482  AtomIDList::iterator mf_i = clientReceivedForceIDs.begin();
483  AtomIDList::iterator mf_e = clientReceivedForceIDs.end();
484  ForceList::iterator mtf_i = clientReceivedTotalForces.begin();
485 
486  /* check to make sure we have some atoms left. This must work for
487  zero requested atoms, as well! */
488  // if(a_i+num_atoms_requested > a_e)
489  // NAMD_bug("GlobalMasterServer ran out of atom IDs!");
490 
491  /* update this master */
492  master->step = step;
493  master->globalMasterStep = step / frequency ;
494  NAMD_EVENT_START(1, NamdProfileEvent::GM_PROC_DATA);
495  master->processData(ma_i,ma_e,
496  mp_i,g_i,g_i+num_groups_requested,
497  gm_i,gm_i+num_groups_requested,
498  gtf_i,gtf_i+(numForceSenders?master->old_num_groups_requested:0),
499  goi_i, goi_e, gov_i, gov_e,
500  forced_atoms_i,forced_atoms_e,forces_i,
501  receivedForceIDs.begin(),receivedForceIDs.end(),receivedTotalForces.begin());
502  NAMD_EVENT_STOP(1, NamdProfileEvent::GM_PROC_DATA);
503  a_i = receivedAtomIDs.begin();
504  p_i = receivedAtomPositions.begin();
505 //}
506 
507  /* check to see if anything changed */
508  if(master->changedAtoms()) {
509  requested_atoms_changed = true;
510  }
511  if(master->changedForces()) {
512  requested_forces_changed = true;
513  }
514  if(master->changedGroups()) {
515  requested_groups_changed = true;
516  }
517  if(master->changedGridObjs()) {
518  requested_grids_changed = true;
519  }
520  master->clearChanged();
521  if(master->requestedTotalForces()) forceSendActive = true;
522 
523  /* go to next master */
524  m_i++;
525 
526  g_i += num_groups_requested;
527  gm_i += num_groups_requested;
528  if ( numForceSenders ) gtf_i += master->old_num_groups_requested;
529  master->old_num_groups_requested = master->requestedGroups().size(); // include changes
530  }
531 
532  if ( numForceSenders && gtf_i != gtf_e ) NAMD_bug("GlobalMasterServer::callClients bad group total force count");
533 
534  /* make a new message */
536 
537  /* build an atom list, if necessary */
538  if(requested_atoms_changed || requested_groups_changed || requested_grids_changed) {
539  resetAtomList(msg->newaid); // add all of the atom IDs
540  totalAtomsRequested = msg->newaid.size();
541  msg->reconfig = 1; // request a reconfig
542  resetGroupList(msg->newgdef,&totalGroupsRequested); // add all of the group IDs
543  numDataSenders = totalAtomsRequested;
544  AtomIDList::iterator g_i = msg->newgdef.begin();
545  AtomIDList::iterator g_e = msg->newgdef.end();
546  Molecule *mol = Node::Object()->molecule;
547  for ( ; g_i != g_e; ++g_i ) {
548  if ( *g_i != -1 ) {
549  if (mol->atommass(*g_i) <= 0.001) {
550  iout << iWARN << "Atom " << (*g_i+1) << " has a near-zero mass, "
551  << "but it was requested for center-of-mass calculation.\n"
552  << endi;
553  }
554  ++numDataSenders;
555  }
556  }
557  resetGridObjList(msg->newgridobjid);
558  }
559  msg->totalforces = forceSendActive;
560  numForceSenders = (forceSendActive ? numDataSenders : 0);
561  resetForceList(msg->aid,msg->f,msg->gforce); // could this be more efficient?
562  resetGridObjForceList(msg->gridobjforce); // ain't touching the one above...
563 
564  /* get group acceleration by renormalizing group net force by group total mass */
565  ForceList::iterator gf_i = msg->gforce.begin();
566  ForceList::iterator gf_e = msg->gforce.end();
567  gm_i = receivedGroupMasses.begin();
568  for ( ; gf_i < gf_e; ++gf_i, ++gm_i ) { *gf_i /= *gm_i; }
569 
570  /* now send the results */
571  DebugM(3,"Sending results ("<<totalAtomsRequested<<" atoms requested, "
572  <<totalGroupsRequested<<" groups requested, "
573  <<msg->f.size()<<" forces set)\n");
574  myComputeManager->sendComputeGlobalResults(msg);
575  DebugM(3,"Sent.\n");
576  return 0;
577 }
578 
580  int theNumDataSenders) {
581  DebugM(3,"Constructing GlobalMasterServer\n");
582  myComputeManager = m;
583  numDataSenders = 0; // theNumDataSenders;
584  numForceSenders = 0;
585  latticeCount = 0;
586  lattice = Node::Object()->simParameters->lattice;
588  recvCount = 0; /* we haven't gotten any messages yet */
589  recvPatchesCount = 0;
590  firstTime = 1; /* XXX temporary */
591  step = -1;
592  totalAtomsRequested = 0;
593  totalGroupsRequested = 0;
594  forceSendEnabled = 0;
595  if ( Node::Object()->simParameters->tclForcesOn ) forceSendEnabled = 1;
596  if ( Node::Object()->simParameters->colvarsOn ) forceSendEnabled = 1;
597  DebugM(3,"done constructing\n");
598 }
599 
601  GlobalMaster *m_i = *clientList.begin();
602  GlobalMaster *m_e = *clientList.end();
603 
604  /* delete each of the masters */
605  while(m_i != m_e) {
606  delete m_i;
607  m_i++;
608  }
609 }
610 
611 
612 
static Node * Object()
Definition: Node.h:86
int old_num_groups_requested
Definition: GlobalMaster.h:57
#define NAMD_EVENT_STOP(eon, id)
int size(void) const
Definition: ResizeArray.h:131
static PatchMap * Object()
Definition: PatchMap.h:27
BigRealList gridobjvalue
Partial values of the GridForce objects from this message.
Definition: Vector.h:72
SimParameters * simParameters
Definition: Node.h:181
bool changedAtoms()
Definition: GlobalMaster.C:108
#define DebugM(x, y)
Definition: Debug.h:75
std::ostream & endi(std::ostream &s)
Definition: InfoStream.C:54
bool requestedTotalForces()
Definition: GlobalMaster.h:70
std::ostream & iWARN(std::ostream &s)
Definition: InfoStream.C:82
#define iout
Definition: InfoStream.h:51
int add(const Elem &elem)
Definition: ResizeArray.h:101
Molecule stores the structural information for the system.
Definition: Molecule.h:175
const ResizeArray< AtomIDList > & requestedGroups()
Definition: GlobalMaster.C:150
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
void resize(int i)
Definition: ResizeArray.h:84
void setall(const Elem &elem)
Definition: ResizeArray.h:94
void setLattice(const Lattice *lat)
Definition: GlobalMaster.h:78
int numPatches(void) const
Definition: PatchMap.h:59
#define NAMD_EVENT_START(eon, id)
bool changedForces()
Definition: GlobalMaster.C:112
bool changedGridObjs()
Definition: GlobalMaster.C:120
void NAMD_bug(const char *err_msg)
Definition: common.C:195
ResizeArray< Lattice > lat
IntList gridobjindex
Indices of the GridForce objects contained in this message.
bool changedGroups()
Definition: GlobalMaster.C:116
Real atommass(int anum) const
Definition: Molecule.h:1107
void recvData(ComputeGlobalDataMsg *)
void addClient(GlobalMaster *newClient)
int globalMasterStep
Definition: GlobalMaster.h:56
iterator begin(void)
Definition: ResizeArray.h:36
const BigRealList & gridObjForces()
Definition: GlobalMaster.C:146
iterator end(void)
Definition: ResizeArray.h:37
int count
Numer of atoms processed for this message.
void clearChanged()
Definition: GlobalMaster.C:74
GlobalMasterServer(ComputeMgr *m, int theNumDataSenders)
const IntList & requestedGridObjs()
Definition: GlobalMaster.C:154
int patchcount
Number of patches processed for this message.
void check() const
Definition: GlobalMaster.C:64
Molecule * molecule
Definition: Node.h:179
int globalMasterFrequency
const AtomIDList & requestedAtoms()
Definition: GlobalMaster.C:124