faunus
Public Types | Public Member Functions | Public Attributes | List of all members
Faunus::pairpotential::BondData Struct Referenceabstract

Base class for bonded potentials. More...

#include <bonds.h>

Inheritance diagram for Faunus::pairpotential::BondData:
Inheritance graph
[legend]

Public Types

enum  Variant {
  HARMONIC = 0, FENE, FENEWCA, HARMONIC_TORSION,
  GROMOS_TORSION, PERIODIC_DIHEDRAL, HARMONIC_DIHEDRAL, INVALID
}
 
using IndexAndForce = std::pair< int, Point >
 Force (second) on particle w. absolute index (first)
 

Public Member Functions

virtual void from_json (const json &)=0
 
virtual void to_json (json &) const =0
 
virtual int numindex () const =0
 Required number of atom indices for bond.
 
virtual Variant type () const =0
 Returns bond type (sett Variant enum)
 
virtual std::shared_ptr< BondDataclone () const =0
 Make shared pointer copy of data.
 
virtual void setEnergyFunction (const ParticleVector &particles)=0
 Set energy function; store particles ref.
 
bool hasEnergyFunction () const
 test if energy function has been set
 
bool hasForceFunction () const
 test if force function has been set
 
void shiftIndices (int offset)
 Add offset to particle indices.
 
 BondData (const std::vector< int > &indices)
 

Public Attributes

std::vector< int > indices
 Absolute indiced of participating particles.
 
std::function< double(Geometry::DistanceFunction)> energyFunc = nullptr
 Calculates potential energy of bonded atoms(kT)
 
std::function< std::vector< IndexAndForce >Geometry::DistanceFunction)> forceFunc = nullptr
 Calculates forces on bonded atoms (kT/Å)
 

Detailed Description

Base class for bonded potentials.

This stores data on the bond type; atom indices; json keywords; and potentially also the energyFunc functor (nullptr per default).

The forceFunc functor returns a vector of forces acting on the participating atoms.

Todo:
Memory inefficient to store energy and force functors. Virtual functions?

The documentation for this struct was generated from the following files: