52#ifndef PRIMITIVES_BEND_HPP
53#define PRIMITIVES_BEND_HPP
56#include "primitives/ShortRangeInteraction.hpp"
71 class Bend :
public ShortRangeInteraction {
75 Bend(Atom* atom1, Atom* atom2, Atom* atom3, BendType* bt) :
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);
92 snapshotMan_->getSnapshot(snapshotNo)->
wrapVector(r21);
93 RealType d21 = r21.
length();
96 snapshotMan_->getSnapshot(snapshotNo)->
wrapVector(r23);
97 RealType d23 = r23.
length();
99 RealType cosTheta =
dot(r21, r23) / (d21 * d23);
102 if (cosTheta > 1.0) {
104 }
else if (cosTheta < -1.0) {
108 return acos(cosTheta);
111 RealType getPotential() {
return potential_; }
113 Atom* getAtomA() {
return atoms_[0]; }
115 Atom* getAtomB() {
return atoms_[1]; }
117 Atom* getAtomC() {
return atoms_[2]; }
119 BendType* getBendType() {
return bendType_; }
121 virtual std::string
getName() {
return name_; }
123 virtual void setName(
const std::string& name) { name_ = name; }
128 RealType potential_ {};
virtual std::string getName()
Returns the name of this ShortRangeInteraction.
virtual void calcForce(RealType &angle, bool doParticlePot)
BendType * bendType_
bend type
RealType getValue(int snapshotNo)
Returns the value of this ShortRangeInteraction in specified snapshot.
void accept(BaseVisitor *v)
virtual void setName(const std::string &name)
Sets the name of this bend for selections.
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.
Real length()
Returns the length of this vector.
This basic Periodic Table class was originally taken from the data.cpp file in OpenBabel.
Real dot(const DynamicVector< Real > &v1, const DynamicVector< Real > &v2)
Returns the dot product of two DynamicVectors.