52#ifndef PRIMITIVES_BOND_HPP
53#define PRIMITIVES_BOND_HPP
56#include "primitives/ShortRangeInteraction.hpp"
72 void calcForce(
bool doParticlePot) {
78 r12 = atoms_[1]->getPos() - atoms_[0]->getPos();
81 bondType_->calcForce(len, potential_, dvdr);
83 force = r12 * (-dvdr / len);
85 atoms_[0]->addFrc(-force);
86 atoms_[1]->addFrc(force);
88 atoms_[0]->addParticlePot(potential_);
89 atoms_[1]->addParticlePot(potential_);
94 Vector3d r12 = atoms_[1]->getPos(snap) - atoms_[0]->getPos(snap);
95 snapshotMan_->getSnapshot(snap)->
wrapVector(r12);
99 RealType getPotential() {
return potential_; }
101 Atom* getAtomA() {
return atoms_[0]; }
103 Atom* getAtomB() {
return atoms_[1]; }
105 BondType* getBondType() {
return bondType_; }
107 virtual std::string
getName() {
return name_; }
109 virtual void setName(
const std::string& name) { name_ = name; }
114 RealType potential_ {};
virtual std::string getName()
Returns the name of this ShortRangeInteraction.
void accept(BaseVisitor *v)
virtual void setName(const std::string &name)
Sets the name of this bond for selections.
RealType getValue(int snap)
Returns the value of this ShortRangeInteraction in specified snapshot.
BondType class is responsible for calculating the force and energy of the bond.
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.
Snapshot * getCurrentSnapshot()
Returns the pointer of current snapshot.
Real length()
Returns the length of this vector.
This basic Periodic Table class was originally taken from the data.cpp file in OpenBabel.