52#ifndef PRIMITIVES_TORSION_HPP
53#define PRIMITIVES_TORSION_HPP
58#include "primitives/ShortRangeInteraction.hpp"
84 virtual void calcForce(RealType& angle,
bool doParticlePot);
87 Vector3d pos1 = atoms_[0]->getPos(snapshotNo);
88 Vector3d pos2 = atoms_[1]->getPos(snapshotNo);
89 Vector3d pos3 = atoms_[2]->getPos(snapshotNo);
90 Vector3d pos4 = atoms_[3]->getPos(snapshotNo);
93 snapshotMan_->getSnapshot(snapshotNo)->
wrapVector(r21);
95 snapshotMan_->getSnapshot(snapshotNo)->
wrapVector(r32);
97 snapshotMan_->getSnapshot(snapshotNo)->
wrapVector(r43);
111 if (rA * rB < OpenMD::epsilon)
return numeric_limits<double>::quiet_NaN();
117 RealType cos_phi =
dot(A, B);
118 if (cos_phi > 1.0) cos_phi = 1.0;
119 if (cos_phi < -1.0) cos_phi = -1.0;
120 return acos(cos_phi);
123 RealType getPotential() {
return potential_; }
125 Atom* getAtomA() {
return atoms_[0]; }
127 Atom* getAtomB() {
return atoms_[1]; }
129 Atom* getAtomC() {
return atoms_[2]; }
131 Atom* getAtomD() {
return atoms_[3]; }
133 TorsionType* getTorsionType() {
return torsionType_; }
135 virtual std::string
getName() {
return name_; }
137 virtual void setName(
const std::string& name) { name_ = name; }
A ShortRangeInteraction holds some bookeeping data for bonded interactions (e.g.
virtual RealType getValue()
Returns the current value of this ShortRangeInteraction.
virtual RealType getPrevValue()
Returns the previous value of this ShortRangeInteraction.
void wrapVector(Vector3d &v)
Wrapping the vector according to periodic boundary condition.
void accept(BaseVisitor *v)
virtual std::string getName()
Returns the name of this ShortRangeInteraction.
virtual void setName(const std::string &name)
Sets the name of this torsion for selections.
RealType getValue(int snapshotNo)
Returns the value of this ShortRangeInteraction in specified snapshot.
Real length()
Returns the length of this vector.
void normalize()
Normalizes this vector in place.
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.