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

#include <ComputeConsForce.h>

Inheritance diagram for ComputeConsForce:
ComputeHomePatch Compute

Public Member Functions

 ComputeConsForce (ComputeID, PatchID)
 
virtual ~ComputeConsForce ()
 
virtual void doForce (FullAtom *, Results *)
 
- Public Member Functions inherited from ComputeHomePatch
 ComputeHomePatch (ComputeID c, PatchID pid)
 
virtual ~ComputeHomePatch ()
 
virtual void initialize ()
 
virtual void atomUpdate ()
 
virtual void doWork ()
 
- 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 ComputeHomePatch
int numAtoms
 
Patchpatch
 
HomePatchhomePatch
 
- Protected Attributes inherited from Compute
int computeType
 
int basePriority
 
int gbisPhase
 
int gbisPhasePriority [3]
 

Detailed Description

Definition at line 7 of file ComputeConsForce.h.

Constructor & Destructor Documentation

◆ ComputeConsForce()

ComputeConsForce::ComputeConsForce ( ComputeID  c,
PatchID  pid 
)

Definition at line 14 of file ComputeConsForce.C.

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

15  : ComputeHomePatch(c,pid)
16 {
18 }
SubmitReduction * willSubmit(int setID, int size=-1)
Definition: ReductionMgr.C:366
static ReductionMgr * Object(void)
Definition: ReductionMgr.h:279
ComputeHomePatch(ComputeID c, PatchID pid)

◆ ~ComputeConsForce()

ComputeConsForce::~ComputeConsForce ( )
virtual

Definition at line 20 of file ComputeConsForce.C.

21 {
22  delete reduction;
23 }

Member Function Documentation

◆ doForce()

void ComputeConsForce::doForce ( FullAtom p,
Results r 
)
virtual

Implements ComputeHomePatch.

Definition at line 25 of file ComputeConsForce.C.

References ADD_TENSOR_OBJECT, ADD_VECTOR_OBJECT, Molecule::consForce, Molecule::consForceIndexes, SimParameters::consForceScaling, DebugM, endi(), Results::f, ComputeHomePatch::homePatch, Patch::lattice, Node::molecule, Results::normal, ComputeHomePatch::numAtoms, Node::Object(), outer(), Lattice::reverse_transform(), Node::simParameters, and SubmitReduction::submit().

26 { int localID,forceID;
27  Molecule *molecule = Node::Object()->molecule;
29  int32 *index = molecule->consForceIndexes; // Indexes into the force array
30  Vector *cf = molecule->consForce; // Force array
31  Vector *forces = r->f[Results::normal];
32  Force extForce = 0.;
33  Tensor extVirial;
34 
35  for (localID=0; localID<numAtoms; ++localID) {
36  // When the index is -1, it means there's no constant force on this atom
37  if ((forceID=index[p[localID].id]) != -1) {
38  Vector sf = scaling * cf[forceID];
39  forces[localID] += sf;
40  extForce += sf;
42  p[localID].position, p[localID].transform );
43  extVirial += outer(sf,vpos);
44  }
45  }
46  DebugM(4, "ComputeConsForce::doForce a extForce " << extForce << " extVirial " << extVirial <<"\n" << endi);
47  ADD_VECTOR_OBJECT(reduction,REDUCTION_EXT_FORCE_NORMAL,extForce);
48  ADD_TENSOR_OBJECT(reduction,REDUCTION_VIRIAL_NORMAL,extVirial);
49  reduction->submit();
50 }
static Node * Object()
Definition: Node.h:86
NAMD_HOST_DEVICE Position reverse_transform(Position data, const Transform &t) const
Definition: Lattice.h:143
Lattice & lattice
Definition: Patch.h:127
NAMD_HOST_DEVICE Tensor outer(const Vector &v1, const Vector &v2)
Definition: Tensor.h:241
Definition: Vector.h:72
#define ADD_TENSOR_OBJECT(R, RL, D)
Definition: ReductionMgr.h:44
SimParameters * simParameters
Definition: Node.h:181
int32_t int32
Definition: common.h:38
#define DebugM(x, y)
Definition: Debug.h:75
std::ostream & endi(std::ostream &s)
Definition: InfoStream.C:54
Molecule stores the structural information for the system.
Definition: Molecule.h:175
Force * f[maxNumForces]
Definition: PatchTypes.h:146
int32 * consForceIndexes
Definition: Molecule.h:646
Definition: Tensor.h:15
#define ADD_VECTOR_OBJECT(R, RL, D)
Definition: ReductionMgr.h:28
Vector * consForce
Definition: Molecule.h:647
void submit(void)
Definition: ReductionMgr.h:324
Molecule * molecule
Definition: Node.h:179
HomePatch * homePatch
double BigReal
Definition: common.h:123
BigReal consForceScaling

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