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

Public Member Functions | |
| ComputeConsForce (ComputeID, PatchID) | |
| virtual | ~ComputeConsForce () |
| virtual void | doForce (FullAtom *, Results *) |
|
||||||||||||
|
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 }
|
|
|
Definition at line 17 of file ComputeConsForce.C. 00018 {
00019 delete reduction;
00020 }
|
|
||||||||||||
|
Implements ComputeHomePatch. Definition at line 22 of file ComputeConsForce.C. References ADD_TENSOR_OBJECT, ADD_VECTOR_OBJECT, BigReal, Molecule::consForce, Molecule::consForceIndexes, SimParameters::consForceScaling, Results::f, Force, CompAtomExt::id, int32, Patch::lattice, Node::molecule, Node::Object(), outer(), Position, 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 }
|
1.3.9.1