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 ( ComputeID  c,
PatchID  pid 
)

Definition at line 11 of file ComputeConsForce.C.

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

12  : ComputeHomePatch(c,pid)
13 {
15 }
SubmitReduction * willSubmit(int setID, int size=-1)
Definition: ReductionMgr.C:365
static ReductionMgr * Object(void)
Definition: ReductionMgr.h:278
ComputeHomePatch(ComputeID c, PatchID pid)
ComputeConsForce::~ComputeConsForce ( )
virtual

Definition at line 17 of file ComputeConsForce.C.

18 {
19  delete reduction;
20 }

Member Function Documentation

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

Implements ComputeHomePatch.

Definition at line 22 of file ComputeConsForce.C.

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

23 { int localID,forceID;
24  Molecule *molecule = Node::Object()->molecule;
26  int32 *index = molecule->consForceIndexes; // Indexes into the force array
27  Vector *cf = molecule->consForce; // Force array
29  Force extForce = 0.;
30  Tensor extVirial;
31 
32  for (localID=0; localID<numAtoms; ++localID) {
33  // When the index is -1, it means there's no constant force on this atom
34  if ((forceID=index[p[localID].id]) != -1) {
35  Vector sf = scaling * cf[forceID];
36  forces[localID] += sf;
37  extForce += sf;
39  p[localID].position, p[localID].transform );
40  extVirial += outer(sf,vpos);
41  }
42  }
43 
44  ADD_VECTOR_OBJECT(reduction,REDUCTION_EXT_FORCE_NORMAL,extForce);
45  ADD_TENSOR_OBJECT(reduction,REDUCTION_VIRIAL_NORMAL,extVirial);
46  reduction->submit();
47 }
static Node * Object()
Definition: Node.h:86
short int32
Definition: dumpdcd.c:24
Lattice & lattice
Definition: Patch.h:126
Definition: Vector.h:64
#define ADD_TENSOR_OBJECT(R, RL, D)
Definition: ReductionMgr.h:43
SimParameters * simParameters
Definition: Node.h:178
static __thread float4 * forces
Force * f[maxNumForces]
Definition: PatchTypes.h:67
Tensor outer(const Vector &v1, const Vector &v2)
Definition: Tensor.h:241
int32 * consForceIndexes
Definition: Molecule.h:613
Position reverse_transform(Position data, const Transform &t) const
Definition: Lattice.h:138
Definition: Tensor.h:15
#define ADD_VECTOR_OBJECT(R, RL, D)
Definition: ReductionMgr.h:27
Vector * consForce
Definition: Molecule.h:614
void submit(void)
Definition: ReductionMgr.h:323
Molecule * molecule
Definition: Node.h:176
HomePatch * homePatch
double BigReal
Definition: common.h:114
BigReal consForceScaling

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