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

#include <ComputeConsForce.h>

Inheritance diagram for ComputeConsTorque:
ComputeHomePatch Compute

Public Member Functions

 ComputeConsTorque (ComputeID, PatchID)
 
virtual ~ComputeConsTorque ()
 
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 17 of file ComputeConsForce.h.

Constructor & Destructor Documentation

ComputeConsTorque::ComputeConsTorque ( ComputeID  c,
PatchID  pid 
)

Definition at line 51 of file ComputeConsForce.C.

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

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

Definition at line 57 of file ComputeConsForce.C.

58 {
59  delete reduction;
60 }

Member Function Documentation

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

Implements ComputeHomePatch.

Definition at line 62 of file ComputeConsForce.C.

References ADD_TENSOR_OBJECT, ADD_VECTOR_OBJECT, SimParameters::consTorqueGlobVal, Molecule::consTorqueIndexes, cross(), Results::f, forces, Molecule::get_constorque_params(), ComputeHomePatch::homePatch, Patch::lattice, Vector::length(), Node::molecule, Results::normal, ComputeHomePatch::numAtoms, Node::Object(), outer(), CompAtom::position, Lattice::reverse_transform(), Node::simParameters, simParams, and SubmitReduction::submit().

63 { int localID,torqueID;
64  Molecule *molecule = Node::Object()->molecule;
66 
67  int32 *index = molecule->consTorqueIndexes; // Indexes into the torque array
69  Force extForce = 0.;
70  Tensor extVirial;
71  const BigReal consTorqueGlobVal = simParams->consTorqueGlobVal;
72  BigReal consTorqueVal;
73  Vector consTorqueAxis, consTorquePivot;
74  Vector atomRadius;
75  Vector torque;
76 
77  for (localID=0; localID<numAtoms; ++localID) {
78  // When the index is -1, it means there's no constant torque on this atom
79  if ((torqueID=index[p[localID].id]) != -1) {
80  // compute the torqueing force and add it to the net force
81  molecule->get_constorque_params(consTorqueVal, consTorqueAxis, consTorquePivot, p[localID].id);
82  consTorqueAxis /= consTorqueAxis.length();
83  atomRadius = p[localID].position - consTorquePivot;
84  torque = cross(consTorqueAxis, atomRadius) * consTorqueVal * consTorqueGlobVal;
85  forces[localID] += torque;
86  extForce += torque;
88  p[localID].position, p[localID].transform );
89  extVirial += outer(torque,vpos);
90  }
91  }
92 
93  ADD_VECTOR_OBJECT(reduction,REDUCTION_EXT_FORCE_NORMAL,extForce);
94  ADD_TENSOR_OBJECT(reduction,REDUCTION_VIRIAL_NORMAL,extVirial);
95  reduction->submit();
96 }
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
__device__ __forceinline__ float3 cross(const float3 v1, const float3 v2)
Position position
Definition: NamdTypes.h:53
BigReal length(void) const
Definition: Vector.h:169
void get_constorque_params(BigReal &v, Vector &a, Vector &p, int atomnum) const
Definition: Molecule.h:1336
int32 * consTorqueIndexes
Definition: Molecule.h:615
Force * f[maxNumForces]
Definition: PatchTypes.h:67
Tensor outer(const Vector &v1, const Vector &v2)
Definition: Tensor.h:241
BigReal consTorqueGlobVal
#define simParams
Definition: Output.C:127
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
void submit(void)
Definition: ReductionMgr.h:323
Molecule * molecule
Definition: Node.h:176
HomePatch * homePatch
double BigReal
Definition: common.h:112

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