52#include "utils/Constants.hpp"
65 RealType d21 = r21.
length();
67 RealType d21inv = 1.0 / d21;
71 RealType d23 = r23.
length();
73 RealType d23inv = 1.0 / d23;
75 RealType cosTheta =
dot(r21, r23) / (d21 * d23);
80 }
else if (cosTheta < -1.0) {
84 RealType theta = acos(cosTheta);
88 bendType_->calcForce(theta, potential_, dVdTheta);
90 RealType sinTheta = sqrt(1.0 - cosTheta * cosTheta);
92 if (fabs(sinTheta) < 1.0E-6) { sinTheta = 1.0E-6; }
94 RealType commonFactor1 = dVdTheta / sinTheta * d21inv;
95 RealType commonFactor2 = dVdTheta / sinTheta * d23inv;
97 Vector3d force1 = commonFactor1 * (r23 * d23inv - r21 * d21inv * cosTheta);
98 Vector3d force3 = commonFactor2 * (r21 * d21inv - r23 * d23inv * cosTheta);
102 atoms_[0]->addFrc(force1);
103 ghostAtom->
addFrc(-force1);
107 atoms_[0]->addParticlePot(potential_);
111 angle = theta / Constants::PI * 180.0;
BendType * bendType_
bend type
virtual void calcForce(RealType &angle, bool doParticlePot)
Vector< Real, Col > getColumn(unsigned int col)
Returns a column of this matrix as a vector.
void wrapVector(Vector3d &v)
Wrapping the vector according to periodic boundary condition.
Snapshot * getCurrentSnapshot()
Returns the pointer of current snapshot.
RotMat3x3d getA()
Returns the current rotation matrix of this stuntDouble.
Vector3d getPos()
Returns the current position of this stuntDouble.
void addTrq(const Vector3d &trq)
Adds torque into the current torque of this stuntDouble.
void addParticlePot(const RealType &particlePot)
Adds particlePot into the current particlePot of this stuntDouble.
void addFrc(const Vector3d &frc)
Adds force into the current force of this stuntDouble.
Real length()
Returns the length of this vector.
This basic Periodic Table class was originally taken from the data.cpp file in OpenBabel.
Vector3< Real > cross(const Vector3< Real > &v1, const Vector3< Real > &v2)
Returns the cross product of two Vectors.
Real dot(const DynamicVector< Real > &v1, const DynamicVector< Real > &v2)
Returns the dot product of two DynamicVectors.