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