NAMD
Public Member Functions | List of all members
ComputeExt Class Reference

#include <ComputeExt.h>

Inheritance diagram for ComputeExt:
ComputeHomePatches Compute

Public Member Functions

 ComputeExt (ComputeID c)
 
virtual ~ComputeExt ()
 
void doWork ()
 
void saveResults (ExtForceMsg *)
 
- Public Member Functions inherited from ComputeHomePatches
 ComputeHomePatches (ComputeID c)
 
virtual ~ComputeHomePatches ()
 
virtual void initialize ()
 
virtual void atomUpdate ()
 
FlagsgetFlags (void)
 
- Public Member Functions inherited from Compute
 Compute (ComputeID)
 
int type ()
 
virtual ~Compute ()
 
void setNumPatches (int n)
 
int getNumPatches ()
 
virtual void patchReady (PatchID, int doneMigration, int seq)
 
virtual int noWork ()
 
virtual void finishPatch (int)
 
int sequence (void)
 
int priority (void)
 
int getGBISPhase (void)
 
virtual void gbisP2PatchReady (PatchID, int seq)
 
virtual void gbisP3PatchReady (PatchID, int seq)
 

Additional Inherited Members

- Public Attributes inherited from Compute
const ComputeID cid
 
LDObjHandle ldObjHandle
 
LocalWorkMsg *const localWorkMsg
 
- Protected Member Functions inherited from Compute
void enqueueWork ()
 
- Protected Attributes inherited from ComputeHomePatches
int useAvgPositions
 
int hasPatchZero
 
ComputeHomePatchList patchList
 
PatchMappatchMap
 
- Protected Attributes inherited from Compute
int computeType
 
int basePriority
 
int gbisPhase
 
int gbisPhasePriority [3]
 

Detailed Description

Definition at line 17 of file ComputeExt.h.

Constructor & Destructor Documentation

ComputeExt::ComputeExt ( ComputeID  c)

Definition at line 91 of file ComputeExt.C.

References ReductionMgr::Object(), REDUCTIONS_BASIC, and ReductionMgr::willSubmit().

91  :
93 {
94  CProxy_ComputeExtMgr::ckLocalBranch(
95  CkpvAccess(BOCclass_group).computeExtMgr)->setCompute(this);
96 
98 
99 }
SubmitReduction * willSubmit(int setID, int size=-1)
Definition: ReductionMgr.C:365
static ReductionMgr * Object(void)
Definition: ReductionMgr.h:278
ComputeHomePatches(ComputeID c)
ComputeExt::~ComputeExt ( )
virtual

Definition at line 101 of file ComputeExt.C.

102 {
103 }

Member Function Documentation

void ComputeExt::doWork ( void  )
virtual

Reimplemented from Compute.

Definition at line 105 of file ComputeExt.C.

References ResizeArrayIter< Type >::begin(), ComputeExtAtom::charge, CompAtom::charge, ExtCoordMsg::coord, ResizeArrayIter< Type >::end(), ComputeExtAtom::id, CompAtomExt::id, ExtCoordMsg::lattice, ExtCoordMsg::numAtoms, ComputeHomePatches::patchList, ComputeExtAtom::position, CompAtom::position, ExtCoordMsg::sourceNode, SubmitReduction::submit(), and x.

106 {
108 
109 #if 0
110  // Skip computations if nothing to do.
111  if ( ! patchList[0].p->flags.doFullElectrostatics )
112  {
113  for (ap = ap.begin(); ap != ap.end(); ap++) {
114  CompAtom *x = (*ap).positionBox->open();
115  Results *r = (*ap).forceBox->open();
116  (*ap).positionBox->close(&x);
117  (*ap).forceBox->close(&r);
118  }
119  reduction->submit();
120  return;
121  }
122 #endif
123 
124  // allocate message
125  int numLocalAtoms = 0;
126  for (ap = ap.begin(); ap != ap.end(); ap++) {
127  numLocalAtoms += (*ap).p->getNumAtoms();
128  }
129 
130  ExtCoordMsg *msg = new (numLocalAtoms, 0) ExtCoordMsg;
131  msg->sourceNode = CkMyPe();
132  msg->numAtoms = numLocalAtoms;
133  msg->lattice = patchList[0].p->flags.lattice;
134  ComputeExtAtom *data_ptr = msg->coord;
135 
136  // get positions
137  for (ap = ap.begin(); ap != ap.end(); ap++) {
138  CompAtom *x = (*ap).positionBox->open();
139  CompAtomExt *xExt = (*ap).p->getCompAtomExtInfo();
140 #if 0
141  if ( patchList[0].p->flags.doMolly ) {
142  (*ap).positionBox->close(&x);
143  x = (*ap).avgPositionBox->open();
144  }
145 #endif
146  int numAtoms = (*ap).p->getNumAtoms();
147 
148  for(int i=0; i<numAtoms; ++i)
149  {
150  data_ptr->position = x[i].position;
151  data_ptr->charge = x[i].charge;
152  data_ptr->id = xExt[i].id;
153  ++data_ptr;
154  }
155 
156 #if 0
157  if ( patchList[0].p->flags.doMolly ) { (*ap).avgPositionBox->close(&x); }
158  else { (*ap).positionBox->close(&x); }
159 #endif
160  (*ap).positionBox->close(&x);
161  }
162 
163  CProxy_ComputeExtMgr extProxy(CkpvAccess(BOCclass_group).computeExtMgr);
164  extProxy[0].recvCoord(msg);
165 
166 }
Lattice lattice
Definition: ComputeExt.C:43
ComputeHomePatchList patchList
Position position
Definition: NamdTypes.h:53
Charge charge
Definition: NamdTypes.h:54
ComputeExtAtom * coord
Definition: ComputeExt.C:44
int sourceNode
Definition: ComputeExt.C:41
int numAtoms
Definition: ComputeExt.C:42
void submit(void)
Definition: ReductionMgr.h:323
gridSize x
Position position
Definition: ComputeExt.C:34
void ComputeExt::saveResults ( ExtForceMsg msg)

Definition at line 298 of file ComputeExt.C.

References ResizeArrayIter< Type >::begin(), ResizeArrayIter< Type >::end(), ExtForceMsg::energy, Results::f, ExtForceMsg::force, ExtForce::force, SubmitReduction::item(), Results::normal, ComputeHomePatches::patchList, REDUCTION_MISC_ENERGY, ExtForce::replace, SubmitReduction::submit(), and ExtForceMsg::virial.

Referenced by ComputeExtMgr::recvForce().

299 {
301 
302  ExtForce *results_ptr = msg->force;
303 
304  // add in forces
305  for (ap = ap.begin(); ap != ap.end(); ap++) {
306  Results *r = (*ap).forceBox->open();
307  Force *f = r->f[Results::normal];
308  int numAtoms = (*ap).p->getNumAtoms();
309 
310  int replace = 0;
311  ExtForce *replacementForces = results_ptr;
312  for(int i=0; i<numAtoms; ++i) {
313  if ( results_ptr->replace ) replace = 1;
314  else f[i] += results_ptr->force;
315  ++results_ptr;
316  }
317  if ( replace ) (*ap).p->replaceForces(replacementForces);
318 
319  (*ap).forceBox->close(&r);
320  }
321 
322  reduction->item(REDUCTION_MISC_ENERGY) += msg->energy;
323  reduction->item(REDUCTION_VIRIAL_NORMAL_XX) += msg->virial[0][0];
324  reduction->item(REDUCTION_VIRIAL_NORMAL_XY) += msg->virial[0][1];
325  reduction->item(REDUCTION_VIRIAL_NORMAL_XZ) += msg->virial[0][2];
326  reduction->item(REDUCTION_VIRIAL_NORMAL_YX) += msg->virial[1][0];
327  reduction->item(REDUCTION_VIRIAL_NORMAL_YY) += msg->virial[1][1];
328  reduction->item(REDUCTION_VIRIAL_NORMAL_YZ) += msg->virial[1][2];
329  reduction->item(REDUCTION_VIRIAL_NORMAL_ZX) += msg->virial[2][0];
330  reduction->item(REDUCTION_VIRIAL_NORMAL_ZY) += msg->virial[2][1];
331  reduction->item(REDUCTION_VIRIAL_NORMAL_ZZ) += msg->virial[2][2];
332  reduction->submit();
333 }
Definition: Vector.h:64
ComputeHomePatchList patchList
BigReal & item(int i)
Definition: ReductionMgr.h:312
int replace
Definition: NamdTypes.h:201
BigReal virial[3][3]
Definition: ComputeExt.C:50
BigReal energy
Definition: ComputeExt.C:49
Force * f[maxNumForces]
Definition: PatchTypes.h:67
Force force
Definition: NamdTypes.h:202
ExtForce * force
Definition: ComputeExt.C:51
void submit(void)
Definition: ReductionMgr.h:323

The documentation for this class was generated from the following files: