ComputeConsForce Class Reference

#include <ComputeConsForce.h>

Inheritance diagram for ComputeConsForce:

ComputeHomePatch Compute List of all members.

Public Member Functions

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

Detailed Description

Definition at line 7 of file ComputeConsForce.h.


Constructor & Destructor Documentation

ComputeConsForce::ComputeConsForce ( ComputeID  ,
PatchID   
)

Definition at line 11 of file ComputeConsForce.C.

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

00012   : ComputeHomePatch(c,pid)
00013 {
00014   reduction = ReductionMgr::Object()->willSubmit(REDUCTIONS_BASIC);
00015 }

ComputeConsForce::~ComputeConsForce (  )  [virtual]

Definition at line 17 of file ComputeConsForce.C.

00018 {
00019   delete reduction;
00020 }


Member Function Documentation

void ComputeConsForce::doForce ( FullAtom ,
Results  
) [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(), REDUCTION_EXT_FORCE_NORMAL, REDUCTION_VIRIAL_NORMAL, Lattice::reverse_transform(), Node::simParameters, and SubmitReduction::submit().

00023 { int localID,forceID;
00024   Molecule *molecule = Node::Object()->molecule;
00025   BigReal scaling = Node::Object()->simParameters->consForceScaling;
00026   int32 *index = molecule->consForceIndexes;  // Indexes into the force array
00027   Vector *cf = molecule->consForce;  // Force array
00028   Vector *forces = r->f[Results::normal];
00029   Force extForce = 0.;
00030   Tensor extVirial;
00031 
00032   for (localID=0; localID<numAtoms; ++localID) {
00033     // When the index is -1, it means there's no constant force on this atom
00034     if ((forceID=index[p[localID].id]) != -1) {
00035       Vector sf = scaling * cf[forceID];
00036       forces[localID] += sf;
00037       extForce += sf;
00038       Position vpos = homePatch->lattice.reverse_transform(
00039                 p[localID].position, p[localID].transform );
00040       extVirial += outer(sf,vpos);
00041     }
00042   }
00043 
00044   ADD_VECTOR_OBJECT(reduction,REDUCTION_EXT_FORCE_NORMAL,extForce);
00045   ADD_TENSOR_OBJECT(reduction,REDUCTION_VIRIAL_NORMAL,extVirial);
00046   reduction->submit();
00047 }


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