36#include <boost/optional.hpp>
49 static constexpr int num = 3;
67 friend boost::serialization::access;
68 template <
typename Archive>
69 void serialize(Archive &ar,
long int ) {
101 double &l_bXc,
double &cosphi,
double &phi) {
124 cosphi = std::round(cosphi);
148 double l_v12Xv23, l_v23Xv34;
150 double phi, cos_phi, sin_mphi_over_sin_phi;
154 v12, v23, v34, v12Xv23, l_v12Xv23, v23Xv34, l_v23Xv34, cos_phi, phi);
156 if (angle_is_undefined) {
160 auto const f1 = (v23Xv34 - cos_phi * v12Xv23) / l_v12Xv23;
161 auto const f4 = (v12Xv23 - cos_phi * v23Xv34) / l_v23Xv34;
174 sin_mphi_over_sin_phi =
mult * cos(
mult * phi -
phase) / cos_phi;
176 sin_mphi_over_sin_phi = sin(
mult * phi -
phase) / sin(phi);
179 fac *= sin_mphi_over_sin_phi;
182 auto const force1 = fac * v23Xf1;
183 auto const force2 = fac * (v34Xf4 - v12Xf1 - v23Xf1);
184 auto const force3 = fac * (v12Xf1 - v23Xf4 - v34Xf4);
186 return std::make_tuple(force2, force1, force3, -(force1 + force2 + force3));
196inline boost::optional<double>
201 double l_v12Xv23, l_v23Xv34;
206 v12, v23, v34, v12Xv23, l_v12Xv23, v23Xv34, l_v23Xv34, cos_phi, phi);
208 if (angle_is_undefined) {
Vector implementation and trait types for boost qvm interoperability.
This file contains the defaults for ESPResSo.
#define TINY_LENGTH_VALUE
Tiny length cutoff.
#define TINY_SIN_VALUE
Tiny angle cutoff for sinus calculations.
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.
__device__ void vector_product(float const *a, float const *b, float *out)
DEVICE_QUALIFIER constexpr T pi()
Ratio of diameter and circumference of a circle.
Parameters for four-body angular potential (dihedral-angle potentials).
boost::optional< double > energy(Utils::Vector3d const &v12, Utils::Vector3d const &v23, Utils::Vector3d const &v34) const
Compute the four-body dihedral interaction energy.
DihedralBond(int mult, double bend, double phase)
boost::optional< std::tuple< Utils::Vector3d, Utils::Vector3d, Utils::Vector3d, Utils::Vector3d > > forces(Utils::Vector3d const &v12, Utils::Vector3d const &v23, Utils::Vector3d const &v34) const
Compute the four-body dihedral interaction force.