NAMD
ComputeGlobal.h
Go to the documentation of this file.
1 
7 /*
8  Forwards atoms to master node for force evaluation.
9 */
10 
11 #ifndef COMPUTEGLOBAL_H
12 #define COMPUTEGLOBAL_H
13 
14 #include "ComputeHomePatches.h"
15 #include "NamdTypes.h"
16 
17 class ComputeGlobalConfigMsg;
20 class ComputeMgr;
21 class SubmitReduction;
22 
23 struct intpair {
24  int first, second;
25  intpair() {;}
26  intpair(int f, int s) : first(f), second(s) {;}
27 };
28 
29 inline bool operator<(const intpair &lhs, const intpair &rhs) {
30  return lhs.first < rhs.first ? true :
31  lhs.first != rhs.first ? false :
32  lhs.second < rhs.second;
33 }
34 
36 public:
38  virtual ~ComputeGlobal();
39  void doWork();
40  // void recvConfig(ComputeGlobalConfigMsg *);
42  // For "loadtotalforces" TCL command
43  void saveTotalForces(HomePatch *);
44 
45 private:
46  ComputeMgr *comm;
47 
48  void sendData();
49  void configure(AtomIDList &newaid, AtomIDList &newgdef, IntList &newgridobjid);
50 
51  AtomIDList aid;
52  AtomIDList gdef; // definitions of groups
54 
55  // (For "loadtotalforces" TCL command)
56  // The atom IDs and forces of the requested atoms on the node
57  // after force evaluation. "fid" could be slightly different
58  // from "aid", since the latter is after atom migration.
59  AtomIDList fid;
60  ForceList totalForce;
61  ForceList groupTotalForce;
62  int numGroupsRequested;
63 
64  Force **forcePtrs;
65  FullAtom **atomPtrs;
66 
68  size_t numGridObjects;
69 
72  IntList gridObjActive;
73 
75  size_t numActiveGridObjects;
76 
78  ForceList ***gridForcesPtrs;
79 
80  void configureGridObjects(IntList &newgridobjid);
81  void deleteGridObjects();
82  void computeGridObjects(ComputeGlobalDataMsg *msg);
84  template<class T> void computeGridForceGrid(FullAtomList::iterator aii,
87  Lattice const &lattice,
88  int gridIndex,
89  T *grid,
90  BigReal &gridObjValue);
91  void applyGridObjectForces(ComputeGlobalResultsMsg *msg,
92  Force *extForce, Tensor *extVirial);
93 
94  int forceSendEnabled; // are total forces received?
95  int forceSendActive; // are total forces received this step?
96  int gfcount; // count of atoms contributing to group forces
97  char *isRequested; // whether this atom is requested by the TCL script
98  int isRequestedAllocSize; // size of array
99  int endRequested; // starting at this point assume not requested
100  int dofull; // whether "Results::slow" force will exist
101 
102  int firsttime;
103  SubmitReduction *reduction;
104 };
105 
106 #endif
107 
void recvResults(ComputeGlobalResultsMsg *)
int ComputeID
Definition: NamdTypes.h:183
intpair(int f, int s)
Definition: ComputeGlobal.h:26
Definition: Vector.h:64
void saveTotalForces(HomePatch *)
ComputeGlobal(ComputeID, ComputeMgr *)
Definition: ComputeGlobal.C:35
int second
Definition: ComputeGlobal.h:24
virtual ~ComputeGlobal()
Definition: ComputeGlobal.C:69
bool operator<(const intpair &lhs, const intpair &rhs)
Definition: ComputeGlobal.h:29
Definition: Tensor.h:15
double BigReal
Definition: common.h:114