48 std::shared_ptr<TabulatedPotential>
pot;
58 TabulatedBond(
double min,
double max, std::vector<double>
const &energy,
59 std::vector<double>
const &force) {
60 pot = std::make_shared<TabulatedPotential>(min, max, force, energy);
68 static constexpr int num = 1;
71 std::vector<double>
const &
energy,
72 std::vector<double>
const &
force)
74 this->
pot->minval = min;
75 this->
pot->maxval = max;
86 static constexpr int num = 2;
89 std::vector<double>
const &force)
91 this->
pot->minval = 0.;
95 std::tuple<Utils::Vector3d, Utils::Vector3d, Utils::Vector3d>
104 static constexpr int num = 3;
107 std::vector<double>
const &
energy,
108 std::vector<double>
const &force)
110 this->
pot->minval = 0.;
131inline std::optional<Utils::Vector3d>
133 auto const dist =
dx.norm();
150inline std::optional<double>
152 auto const dist =
dx.norm();
165inline std::tuple<Utils::Vector3d, Utils::Vector3d, Utils::Vector3d>
248inline std::optional<double>
Vector implementation and trait types for boost qvm interoperability.
Common code for functions calculating angle forces.
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.
double calc_cosine(Utils::Vector3d const &vec1, Utils::Vector3d const &vec2, bool sanitize_cosine=false)
Compute the cosine of the angle between three particles.
cudaStream_t stream[1]
CUDA streams for parallel computing on CPU and GPU.
constexpr auto round_error_prec
Precision below which a double-precision float is assumed to be zero.
Routines to calculate the dihedral energy or/and force for a particle quadruple.
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 sqr(T x)
Calculates the SQuaRe of x.
Parameters for 3-body tabulated potential.
TabulatedAngleBond(double min, double max, std::vector< double > const &energy, std::vector< double > const &force)
double energy(Utils::Vector3d const &vec1, Utils::Vector3d const &vec2) const
Compute the three-body angle interaction energy.
std::tuple< Utils::Vector3d, Utils::Vector3d, Utils::Vector3d > forces(Utils::Vector3d const &vec1, Utils::Vector3d const &vec2) const
Compute the three-body angle interaction force.
Base class for n-body tabulated potential (n=2,3,4).
std::shared_ptr< TabulatedPotential > pot
TabulatedBond(double min, double max, std::vector< double > const &energy, std::vector< double > const &force)
Set the parameters of a bonded tabulated potential.
Parameters for 4-body tabulated potential.
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.
TabulatedDihedralBond(double min, double max, std::vector< double > const &energy, std::vector< double > const &force)
std::optional< double > energy(Utils::Vector3d const &v12, Utils::Vector3d const &v23, Utils::Vector3d const &v34) const
Compute the four-body dihedral interaction energy.
Parameters for 2-body tabulated potential.
std::optional< Utils::Vector3d > force(Utils::Vector3d const &dx) const
Compute a tabulated bond length force.
std::optional< double > energy(Utils::Vector3d const &dx) const
Compute a tabulated bond length energy.
TabulatedDistanceBond(double min, double max, std::vector< double > const &energy, std::vector< double > const &force)