48 static constexpr int num = 3;
91 double &l_bXc,
double &cosphi,
double &phi) {
114 cosphi = std::round(cosphi);
119 phi = 2. * std::numbers::pi - phi;
138 double l_v12Xv23, l_v23Xv34;
140 double phi, cos_phi, sin_mphi_over_sin_phi;
144 v12, v23, v34, v12Xv23, l_v12Xv23, v23Xv34, l_v23Xv34, cos_phi, phi);
146 if (angle_is_undefined) {
150 auto const f1 = (v23Xv34 - cos_phi * v12Xv23) / l_v12Xv23;
151 auto const f4 = (v12Xv23 - cos_phi * v23Xv34) / l_v23Xv34;
164 sin_mphi_over_sin_phi =
mult * cos(
mult * phi -
phase) / cos_phi;
166 sin_mphi_over_sin_phi = sin(
mult * phi -
phase) / sin(phi);
169 fac *= sin_mphi_over_sin_phi;
172 auto const force1 = fac * v23Xf1;
173 auto const force2 = fac * (v34Xf4 - v12Xf1 - v23Xf1);
174 auto const force3 = fac * (v12Xf1 - v23Xf4 - v34Xf4);
176 return std::make_tuple(force2, force1, force3, -(force1 + force2 + force3));
186inline std::optional<double>
191 double l_v12Xv23, l_v23Xv34;
196 v12, v23, v34, v12Xv23, l_v12Xv23, v23Xv34, l_v23Xv34, cos_phi, phi);
198 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)
Parameters for four-body angular potential (dihedral-angle potentials).
std::optional< double > energy(Utils::Vector3d const &v12, Utils::Vector3d const &v23, Utils::Vector3d const &v34) const
Compute the four-body dihedral interaction energy.
std::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.
DihedralBond(int mult, double bend, double phase)