ESPResSo
Extensible Simulation Package for Research on Soft Matter Systems
Loading...
Searching...
No Matches
dihedral.hpp File Reference

Routines to calculate the dihedral energy or/and force for a particle quadruple. More...

#include "config/config.hpp"
#include <utils/Vector.hpp>
#include <utils/constants.hpp>
#include <boost/optional.hpp>
#include <cmath>
#include <tuple>
+ Include dependency graph for dihedral.hpp:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  DihedralBond
 Parameters for four-body angular potential (dihedral-angle potentials). More...
 

Functions

bool calc_dihedral_angle (Utils::Vector3d const &a, Utils::Vector3d const &b, Utils::Vector3d const &c, Utils::Vector3d &aXb, double &l_aXb, Utils::Vector3d &bXc, double &l_bXc, double &cosphi, double &phi)
 Calculates the dihedral angle between particle quadruple p1, p2, p3 and p4.
 

Detailed Description

Routines to calculate the dihedral energy or/and force for a particle quadruple.

Note that usage of dihedrals increases the interaction range of bonded interactions to 2 times the maximal bond length!

Definition in file dihedral.hpp.

Function Documentation

◆ calc_dihedral_angle()

bool calc_dihedral_angle ( Utils::Vector3d const &  a,
Utils::Vector3d const &  b,
Utils::Vector3d const &  c,
Utils::Vector3d aXb,
double &  l_aXb,
Utils::Vector3d bXc,
double &  l_bXc,
double &  cosphi,
double &  phi 
)
inline

Calculates the dihedral angle between particle quadruple p1, p2, p3 and p4.

The dihedral angle is the angle between the planes specified by the particle triples (p1,p2,p3) and (p2,p3,p4). Vectors a, b and c are the bond vectors between consecutive particles. If the a,b or b,c are parallel the dihedral angle is not defined in which case the function returns true. Calling functions should check for that.

Parameters
[in]aVector from p1 to p2
[in]bVector from p2 to p3
[in]cVector from p3 to p4
[out]aXbVector product of a and b
[out]l_aXb|aXB|
[out]bXcVector product of b and c
[out]l_bXc|bXc|
[out]cosphiCosine of the dihedral angle
[out]phiDihedral angle in the range [0, pi]
Returns
Whether the angle is undefined.

Definition at line 97 of file dihedral.hpp.

References Utils::Vector< T, N >::norm(), Utils::pi(), TINY_LENGTH_VALUE, TINY_SIN_VALUE, and vector_product().

Referenced by TabulatedDihedralBond::energy(), DihedralBond::energy(), TabulatedDihedralBond::forces(), and DihedralBond::forces().