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

Common code for functions calculating angle forces. More...

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

Go to the source code of this file.

Functions

double calc_cosine (Utils::Vector3d const &vec1, Utils::Vector3d const &vec2, bool sanitize_cosine=false)
 Compute the cosine of the angle between three particles.
 
template<typename ForceFactor >
std::tuple< Utils::Vector3d, Utils::Vector3d, Utils::Vector3dangle_generic_force (Utils::Vector3d const &vec1, Utils::Vector3d const &vec2, ForceFactor forceFactor, bool sanitize_cosine)
 Compute a three-body angle interaction force.
 

Detailed Description

Common code for functions calculating angle forces.

Definition in file angle_common.hpp.

Function Documentation

◆ angle_generic_force()

template<typename ForceFactor >
std::tuple< Utils::Vector3d, Utils::Vector3d, Utils::Vector3d > angle_generic_force ( Utils::Vector3d const &  vec1,
Utils::Vector3d const &  vec2,
ForceFactor  forceFactor,
bool  sanitize_cosine 
)

Compute a three-body angle interaction force.

See the details in General expressions for the forces. The \( K(\theta_{ijk}) \) term is provided as a lambda function in forceFactor.

Parameters
[in]vec1Vector from central particle to left particle.
[in]vec2Vector from central particle to right particle.
[in]forceFactorAngle force term.
[in]sanitize_cosineSanitize the cosine of the angle.
Template Parameters
ForceFactorFunction evaluating the angle force term for a given angle.
Returns
Forces on the second, first and third particles, in that order.

Definition at line 81 of file angle_common.hpp.

References Utils::Vector< T, N >::norm().

Referenced by AngleCosineBond::forces(), AngleCossquareBond::forces(), AngleHarmonicBond::forces(), and TabulatedAngleBond::forces().

◆ calc_cosine()

double calc_cosine ( Utils::Vector3d const &  vec1,
Utils::Vector3d const &  vec2,
bool  sanitize_cosine = false 
)
inline

Compute the cosine of the angle between three particles.

Parameters
[in]vec1Vector from central particle to left particle.
[in]vec2Vector from central particle to right particle.
[in]sanitize_cosineSanitize the cosine of the angle.
Returns
\( \vec{r_{ij}} \), \( \vec{r_{kj}} \), \( \left\|\vec{r_{ij}}\right\|^{-1} \), \( \left\|\vec{r_{kj}}\right\|^{-1} \), \( \cos(\theta_{ijk}) \)

Definition at line 55 of file angle_common.hpp.

References Utils::Vector< T, N >::norm2().

Referenced by AngleCosineBond::energy(), AngleCossquareBond::energy(), AngleHarmonicBond::energy(), and TabulatedAngleBond::energy().