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 <cmath>
#include <numbers>
#include <optional>
#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.
 

Variables

constexpr auto dihe_tiny_length_value {0.0001}
 Tiny length cutoff.
 
constexpr auto dihe_tiny_sin_value {1e-10}
 Tiny angle cutoff for sinus calculations.
 

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 93 of file dihedral.hpp.

References dihe_tiny_length_value, dihe_tiny_sin_value, stream, and vector_product().

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

Variable Documentation

◆ dihe_tiny_length_value

constexpr auto dihe_tiny_length_value {0.0001}
inlineconstexpr

Tiny length cutoff.

Definition at line 41 of file dihedral.hpp.

Referenced by calc_dihedral_angle().

◆ dihe_tiny_sin_value

constexpr auto dihe_tiny_sin_value {1e-10}
inlineconstexpr

Tiny angle cutoff for sinus calculations.

Definition at line 44 of file dihedral.hpp.

Referenced by calc_dihedral_angle(), and DihedralBond::forces().