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

#include <ComputeLjPmeSerial.h>

Inheritance diagram for ComputeLjPmeSerial:
ComputeHomePatches Compute

Public Member Functions

 ComputeLjPmeSerial (ComputeID c)
 
virtual ~ComputeLjPmeSerial ()
 
void doWork ()
 
void saveResults (LjPmeSerialForceMsg *)
 
- 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 ComputeLjPmeSerial.h.

Constructor & Destructor Documentation

◆ ComputeLjPmeSerial()

ComputeLjPmeSerial::ComputeLjPmeSerial ( ComputeID  c)

Definition at line 130 of file ComputeLjPmeSerial.C.

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

130  :
132 {
133  CProxy_ComputeLjPmeSerialMgr::ckLocalBranch(
134  CkpvAccess(BOCclass_group).computeLjPmeSerialMgr)->setCompute(this);
136 }
SubmitReduction * willSubmit(int setID, int size=-1)
Definition: ReductionMgr.C:366
static ReductionMgr * Object(void)
Definition: ReductionMgr.h:279
ComputeHomePatches(ComputeID c)

◆ ~ComputeLjPmeSerial()

ComputeLjPmeSerial::~ComputeLjPmeSerial ( )
virtual

Definition at line 128 of file ComputeLjPmeSerial.C.

128 {}

Member Function Documentation

◆ doWork()

void ComputeLjPmeSerial::doWork ( void  )
virtual

Reimplemented from Compute.

Definition at line 288 of file ComputeLjPmeSerial.C.

References ResizeArrayIter< T >::begin(), LjPmeSerialCoordMsg::coord, ResizeArrayIter< T >::end(), LjPmeSerialAtom::id, CompAtomExt::id, LjPmeSerialCoordMsg::lattice, LjPmeSerialCoordMsg::numAtoms, ComputeHomePatches::patchList, LjPmeSerialAtom::position, CompAtom::position, LjPmeSerialCoordMsg::sourceNode, LjPmeSerialAtom::vdwType, and CompAtom::vdwType.

289 {
291 
292  // For now we do the LJ-PME calculation every steps
293 
294  // Skip computations if nothing to do.
295  // if ( ! patchList[0].p->flags.doFullElectrostatics )
296  // {
297  // for (ap = ap.begin(); ap != ap.end(); ap++) {
298  // CompAtom *x = (*ap).positionBox->open();
299  // Results *r = (*ap).forceBox->open();
300  // (*ap).positionBox->close(&x);
301  // (*ap).forceBox->close(&r);
302  // }
303  // reduction->submit();
304  // return;
305  // }
306 
307  // allocate message
308  int numLocalAtoms = 0;
309  for (ap = ap.begin(); ap != ap.end(); ap++) {
310  numLocalAtoms += (*ap).p->getNumAtoms();
311  }
312 
313  LjPmeSerialCoordMsg *msg = new (numLocalAtoms, 0) LjPmeSerialCoordMsg;
314  msg->sourceNode = CkMyPe();
315  msg->numAtoms = numLocalAtoms;
316  msg->lattice = patchList[0].p->flags.lattice;
317  LjPmeSerialAtom *data_ptr = msg->coord;
318 
319  // get positions
320  for (ap = ap.begin(); ap != ap.end(); ap++) {
321  CompAtom *x = (*ap).positionBox->open();
322  CompAtomExt *xExt = (*ap).p->getCompAtomExtInfo();
323  if ( patchList[0].p->flags.doMolly ) {
324  (*ap).positionBox->close(&x);
325  x = (*ap).avgPositionBox->open();
326  }
327  int numAtoms = (*ap).p->getNumAtoms();
328 
329  for(int i=0; i < numAtoms; i++)
330  {
331  data_ptr->position = x[i].position;
332  data_ptr->vdwType = x[i].vdwType;
333  data_ptr->id = xExt[i].id;
334  ++data_ptr;
335  }
336 
337  if ( patchList[0].p->flags.doMolly ) { (*ap).avgPositionBox->close(&x); }
338  else { (*ap).positionBox->close(&x); }
339  }
340 
341  CProxy_ComputeLjPmeSerialMgr ljPmeProxy(
342  CkpvAccess(BOCclass_group).computeLjPmeSerialMgr);
343  ljPmeProxy[0].recvCoord(msg);
344 }
ComputeHomePatchList patchList
Position position
Definition: NamdTypes.h:77
LjPmeSerialAtom * coord
uint32 id
Definition: NamdTypes.h:156
int16 vdwType
Definition: NamdTypes.h:79

◆ saveResults()

void ComputeLjPmeSerial::saveResults ( LjPmeSerialForceMsg msg)

Definition at line 514 of file ComputeLjPmeSerial.C.

References ResizeArrayIter< T >::begin(), ResizeArrayIter< T >::end(), LjPmeSerialForceMsg::energyNonbond, LjPmeSerialForceMsg::energySlow, Results::f, LjPmeSerialForceMsg::forceNonbond, LjPmeSerialForceMsg::forceSlow, SubmitReduction::item(), Results::nbond, ComputeHomePatches::patchList, REDUCTION_LJ_ENERGY, Results::slow, SubmitReduction::submit(), LjPmeSerialForceMsg::virialNonbond, LjPmeSerialForceMsg::virialSlow, Vector::x, Vector::y, and Vector::z.

Referenced by ComputeLjPmeSerialMgr::recvForce().

515 {
517 
518  LjPmeSerialForce *results_Nonbond_ptr = msg->forceNonbond;
519  LjPmeSerialForce *results_Slow_ptr = msg->forceSlow;
520 
521  // add in forces
522  for (ap = ap.begin(); ap != ap.end(); ap++) {
523  Results *r = (*ap).forceBox->open();
524  Force *fSlow = r->f[Results::slow];
525  Force *fNonbond = r->f[Results::nbond];
526  int numAtoms = (*ap).p->getNumAtoms();
527 
528  for(int i=0; i<numAtoms; ++i) {
529  fSlow[i].x += results_Slow_ptr->x;
530  fSlow[i].y += results_Slow_ptr->y;
531  fSlow[i].z += results_Slow_ptr->z;
532  fNonbond[i].x += results_Nonbond_ptr->x;
533  fNonbond[i].y += results_Nonbond_ptr->y;
534  fNonbond[i].z += results_Nonbond_ptr->z;
535  ++results_Slow_ptr;
536  ++results_Nonbond_ptr;
537  }
538 
539  (*ap).forceBox->close(&r);
540  }
541 
542  // reduction->item(REDUCTION_LJ_ENERGY) += msg->energyNonbond;
543  // reduction->item(REDUCTION_ELECT_ENERGY_SLOW) += msg->energySlow;
544 
545  // reduction->item(REDUCTION_VIRIAL_SLOW_XX) += msg->virialSlow[0][0];
546  // reduction->item(REDUCTION_VIRIAL_SLOW_XY) += msg->virialSlow[0][1];
547  // reduction->item(REDUCTION_VIRIAL_SLOW_XZ) += msg->virialSlow[0][2];
548  // reduction->item(REDUCTION_VIRIAL_SLOW_YX) += msg->virialSlow[1][0];
549  // reduction->item(REDUCTION_VIRIAL_SLOW_YY) += msg->virialSlow[1][1];
550  // reduction->item(REDUCTION_VIRIAL_SLOW_YZ) += msg->virialSlow[1][2];
551  // reduction->item(REDUCTION_VIRIAL_SLOW_ZX) += msg->virialSlow[2][0];
552  // reduction->item(REDUCTION_VIRIAL_SLOW_ZY) += msg->virialSlow[2][1];
553  // reduction->item(REDUCTION_VIRIAL_SLOW_ZZ) += msg->virialSlow[2][2];
554 
555  // reduction->item(REDUCTION_VIRIAL_NBOND_XX) += msg->virialNonbond[0][0];
556  // reduction->item(REDUCTION_VIRIAL_NBOND_XY) += msg->virialNonbond[0][1];
557  // reduction->item(REDUCTION_VIRIAL_NBOND_XZ) += msg->virialNonbond[0][2];
558  // reduction->item(REDUCTION_VIRIAL_NBOND_YX) += msg->virialNonbond[1][0];
559  // reduction->item(REDUCTION_VIRIAL_NBOND_YY) += msg->virialNonbond[1][1];
560  // reduction->item(REDUCTION_VIRIAL_NBOND_YZ) += msg->virialNonbond[1][2];
561  // reduction->item(REDUCTION_VIRIAL_NBOND_ZX) += msg->virialNonbond[2][0];
562  // reduction->item(REDUCTION_VIRIAL_NBOND_ZY) += msg->virialNonbond[2][1];
563  // reduction->item(REDUCTION_VIRIAL_NBOND_ZZ) += msg->virialNonbond[2][2];
564 
565  reduction->item(REDUCTION_LJ_ENERGY) += msg->energyNonbond + msg->energySlow;
566 
567  reduction->item(REDUCTION_VIRIAL_NBOND_XX) += msg->virialNonbond[0][0] + msg->virialSlow[0][0];
568  reduction->item(REDUCTION_VIRIAL_NBOND_XY) += msg->virialNonbond[0][1] + msg->virialSlow[0][1];
569  reduction->item(REDUCTION_VIRIAL_NBOND_XZ) += msg->virialNonbond[0][2] + msg->virialSlow[0][2];
570  reduction->item(REDUCTION_VIRIAL_NBOND_YX) += msg->virialNonbond[1][0] + msg->virialSlow[1][0];
571  reduction->item(REDUCTION_VIRIAL_NBOND_YY) += msg->virialNonbond[1][1] + msg->virialSlow[1][1];
572  reduction->item(REDUCTION_VIRIAL_NBOND_YZ) += msg->virialNonbond[1][2] + msg->virialSlow[1][2];
573  reduction->item(REDUCTION_VIRIAL_NBOND_ZX) += msg->virialNonbond[2][0] + msg->virialSlow[2][0];
574  reduction->item(REDUCTION_VIRIAL_NBOND_ZY) += msg->virialNonbond[2][1] + msg->virialSlow[2][1];
575  reduction->item(REDUCTION_VIRIAL_NBOND_ZZ) += msg->virialNonbond[2][2] + msg->virialSlow[2][2];
576  reduction->submit();
577 }
Definition: Vector.h:72
ComputeHomePatchList patchList
BigReal & item(int i)
Definition: ReductionMgr.h:313
BigReal z
Definition: Vector.h:74
LjPmeSerialForce * forceSlow
BigReal virialSlow[3][3]
Force * f[maxNumForces]
Definition: PatchTypes.h:146
LjPmeSerialForce * forceNonbond
BigReal x
Definition: Vector.h:74
BigReal y
Definition: Vector.h:74
void submit(void)
Definition: ReductionMgr.h:324
BigReal virialNonbond[3][3]

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