ComputeConsTorque Class Reference

#include <ComputeConsForce.h>

Inheritance diagram for ComputeConsTorque:

ComputeHomePatch Compute List of all members.

Public Member Functions

 ComputeConsTorque (ComputeID, PatchID)
virtual ~ComputeConsTorque ()
virtual void doForce (FullAtom *, Results *)

Detailed Description

Definition at line 17 of file ComputeConsForce.h.


Constructor & Destructor Documentation

ComputeConsTorque::ComputeConsTorque ( ComputeID  ,
PatchID   
)

Definition at line 51 of file ComputeConsForce.C.

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

00052   : ComputeHomePatch(c,pid)
00053 {
00054   reduction = ReductionMgr::Object()->willSubmit(REDUCTIONS_BASIC);
00055 }

ComputeConsTorque::~ComputeConsTorque (  )  [virtual]

Definition at line 57 of file ComputeConsForce.C.

00058 {
00059   delete reduction;
00060 }


Member Function Documentation

void ComputeConsTorque::doForce ( FullAtom ,
Results  
) [virtual]

Implements ComputeHomePatch.

Definition at line 62 of file ComputeConsForce.C.

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

00063 { int localID,torqueID;
00064   Molecule *molecule = Node::Object()->molecule;
00065   SimParameters *simParams = Node::Object()->simParameters;
00066 
00067   int32 *index = molecule->consTorqueIndexes;  // Indexes into the torque array
00068   Vector *forces = r->f[Results::normal];
00069   Force extForce = 0.;
00070   Tensor extVirial;
00071   const BigReal consTorqueGlobVal = simParams->consTorqueGlobVal;
00072   BigReal consTorqueVal;
00073   Vector consTorqueAxis, consTorquePivot;  
00074   Vector atomRadius;
00075   Vector torque;
00076 
00077   for (localID=0; localID<numAtoms; ++localID) {
00078     // When the index is -1, it means there's no constant torque on this atom
00079     if ((torqueID=index[p[localID].id]) != -1) {
00080       // compute the torqueing force and add it to the net force
00081       molecule->get_constorque_params(consTorqueVal, consTorqueAxis, consTorquePivot, p[localID].id);
00082       consTorqueAxis /= consTorqueAxis.length();
00083       atomRadius = p[localID].position - consTorquePivot;
00084       torque = cross(consTorqueAxis, atomRadius) * consTorqueVal * consTorqueGlobVal;
00085       forces[localID] += torque;
00086       extForce += torque;
00087       Position vpos = homePatch->lattice.reverse_transform(
00088                 p[localID].position, p[localID].transform );
00089       extVirial += outer(torque,vpos);
00090     }
00091   }
00092 
00093   ADD_VECTOR_OBJECT(reduction,REDUCTION_EXT_FORCE_NORMAL,extForce);
00094   ADD_TENSOR_OBJECT(reduction,REDUCTION_VIRIAL_NORMAL,extVirial);
00095   reduction->submit();
00096 }


The documentation for this class was generated from the following files:
Generated on Tue Nov 21 01:17:17 2017 for NAMD by  doxygen 1.4.7