#include <ComputeConsForce.h>
Inheritance diagram for ComputeConsTorque:

Public Member Functions | |
| ComputeConsTorque (ComputeID, PatchID) | |
| virtual | ~ComputeConsTorque () |
| virtual void | doForce (FullAtom *, Results *) |
|
||||||||||||
|
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 }
|
|
|
Definition at line 57 of file ComputeConsForce.C. 00058 {
00059 delete reduction;
00060 }
|
|
||||||||||||
|
Implements ComputeHomePatch. Definition at line 62 of file ComputeConsForce.C. References ADD_TENSOR_OBJECT, ADD_VECTOR_OBJECT, BigReal, SimParameters::consTorqueGlobVal, Molecule::consTorqueIndexes, Results::f, Force, Molecule::get_constorque_params(), CompAtom::id, int32, Patch::lattice, Vector::length(), Node::molecule, Node::Object(), outer(), Position, 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 }
|
1.3.9.1