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 class NodeReduction;
23 
24 struct intpair {
25  int first, second;
26  intpair() {;}
27  intpair(int f, int s) : first(f), second(s) {;}
28 };
29 
30 inline bool operator<(const intpair &lhs, const intpair &rhs) {
31  return lhs.first < rhs.first ? true :
32  lhs.first != rhs.first ? false :
33  lhs.second < rhs.second;
34 }
35 
37 public:
39  virtual ~ComputeGlobal();
40  void doWork();
41  // void recvConfig(ComputeGlobalConfigMsg *);
43  // For "loadtotalforces" TCL command
44  void saveTotalForces(HomePatch *);
45  // Getter of forceSendActive. We use this flag to indicate whether we
46  // need to copy CUDA SOA forces for the calculation of total forces.
47  int getForceSendActive() const {return forceSendActive;}
48 
49 private:
50  ComputeMgr *comm;
51 
52  void sendData();
53  void configure(AtomIDList &newaid, AtomIDList &newgdef, IntList &newgridobjid);
54 
55  AtomIDList aid;
56  AtomIDList gdef; // definitions of groups
58 
59  // (For "loadtotalforces" TCL command)
60  // The atom IDs and forces of the requested atoms on the node
61  // after force evaluation. "fid" could be slightly different
62  // from "aid", since the latter is after atom migration.
63  AtomIDList fid;
64  ForceList totalForce;
65  ForceList groupTotalForce;
66  int numGroupsRequested;
67 
68  Force **forcePtrs;
69  FullAtom **atomPtrs;
70  int **transform_soa_i;
71  int **transform_soa_j;
72  int **transform_soa_k;
73  float **mass_soa;
74  double **pos_soa_x;
75  double **pos_soa_y;
76  double **pos_soa_z;
77  double **force_soa_x;
78  double **force_soa_y;
79  double **force_soa_z;
81  size_t numGridObjects;
83 
86  IntList gridObjActive;
87 
89  size_t numActiveGridObjects;
90 
92  ForceList ***gridForcesPtrs;
93 
94  void configureGridObjects(IntList &newgridobjid);
95  void deleteGridObjects();
96  void computeGridObjects(ComputeGlobalDataMsg *msg);
98  template<class T> void computeGridForceGrid(FullAtomList::iterator aii,
101  Lattice const &lattice,
102  int gridIndex,
103  T *grid,
104  BigReal &gridObjValue);
105  void applyGridObjectForces(ComputeGlobalResultsMsg *msg,
106  Force *extForce, Tensor *extVirial);
107 
108  #ifdef NODEGROUP_FORCE_REGISTER
109  NodeReduction *nodeReduction;
110  #endif
111 
112  int forceSendEnabled; // are total forces received?
113  int forceSendActive; // are total forces received this step?
114  int gfcount; // count of atoms contributing to group forces
115  char *isRequested; // whether this atom is requested by the TCL script
116  int isRequestedAllocSize; // size of array
117  int endRequested; // starting at this point assume not requested
118  int dofull; // whether "Results::slow" force will exist
119 
120  int firsttime;
121  SubmitReduction *reduction;
122 };
123 
124 #endif
125 
void recvResults(ComputeGlobalResultsMsg *)
int32 ComputeID
Definition: NamdTypes.h:278
intpair(int f, int s)
Definition: ComputeGlobal.h:27
Definition: Vector.h:72
void saveTotalForces(HomePatch *)
ComputeGlobal(ComputeID, ComputeMgr *)
Definition: ComputeGlobal.C:38
int second
Definition: ComputeGlobal.h:25
virtual ~ComputeGlobal()
int getForceSendActive() const
Definition: ComputeGlobal.h:47
bool operator<(const intpair &lhs, const intpair &rhs)
Definition: ComputeGlobal.h:30
Definition: Tensor.h:15
double BigReal
Definition: common.h:123