71#ifdef ESPRESSO_LENNARD_JONES
81#ifdef ESPRESSO_LENNARD_JONES_GENERIC
86#ifdef ESPRESSO_SMOOTH_STEP
91#ifdef ESPRESSO_HERTZIAN
96#ifdef ESPRESSO_GAUSSIAN
101#ifdef ESPRESSO_BMHTF_NACL
111#ifdef ESPRESSO_BUCKINGHAM
116#ifdef ESPRESSO_SOFT_SPHERE
126#ifdef ESPRESSO_LJCOS2
131#ifdef ESPRESSO_TABULATED
173#ifdef ESPRESSO_GAY_BERNE
186 if (
auto const *iap = std::get_if<FeneBond>(&iaparams)) {
187 return iap->energy(dx);
189 if (
auto const *iap = std::get_if<HarmonicBond>(&iaparams)) {
190 return iap->energy(dx);
192 if (
auto const *iap = std::get_if<QuarticBond>(&iaparams)) {
193 return iap->energy(dx);
195#ifdef ESPRESSO_ELECTROSTATICS
196 if (
auto const *iap = std::get_if<BondedCoulomb>(&iaparams)) {
197 return iap->energy(q1q2, dx);
199 if (
auto const *iap = std::get_if<BondedCoulombSR>(&iaparams)) {
200 return iap->energy(pos1, pos2, dx, *kernel);
203#ifdef ESPRESSO_BOND_CONSTRAINT
204 if (std::get_if<RigidBond>(&iaparams)) {
208#ifdef ESPRESSO_TABULATED
209 if (
auto const *iap = std::get_if<TabulatedDistanceBond>(&iaparams)) {
210 return iap->energy(dx);
213 if (std::get_if<VirtualBond>(&iaparams)) {
219inline std::optional<double>
223 if (
auto const *iap = std::get_if<AngleHarmonicBond>(&iaparams)) {
224 return iap->energy(vec1, vec2);
226 if (
auto const *iap = std::get_if<AngleCosineBond>(&iaparams)) {
227 return iap->energy(vec1, vec2);
229 if (
auto const *iap = std::get_if<AngleCossquareBond>(&iaparams)) {
230 return iap->energy(vec1, vec2);
232 if (
auto const *iap = std::get_if<TabulatedAngleBond>(&iaparams)) {
233 return iap->energy(vec1, vec2);
235 if (std::get_if<IBMTriel>(&iaparams)) {
237 std::to_string(iaparams.index()) +
238 " in energy calculation.";
247 if (
auto const *iap = std::get_if<DihedralBond>(&iaparams)) {
248 return iap->energy(v12, v23, v34);
250 if (
auto const *iap = std::get_if<TabulatedDihedralBond>(&iaparams)) {
251 return iap->energy(v12, v23, v34);
253 if (std::get_if<IBMTribend>(&iaparams)) {
255 std::to_string(iaparams.index()) +
256 " in energy calculation.";
262inline std::optional<double>
264 std::span<Particle *> partners,
BoxGeometry const &box_geo,
266 auto const n_partners =
static_cast<int>(partners.size());
268 auto p2 = (n_partners > 0) ? partners[0] :
nullptr;
269 auto p3 = (n_partners > 1) ? partners[1] :
nullptr;
270 auto p4 = (n_partners > 2) ? partners[2] :
nullptr;
272 if (n_partners == 1) {
275#ifdef ESPRESSO_ELECTROSTATICS
276 p1.
q() * p2->q(), kernel
282 if (n_partners == 2) {
287 if (n_partners == 3) {
291 auto const v34 = box_geo.
get_mi_vector(p4->pos(), p3->pos());
294 if (n_partners == 0) {
312#ifdef ESPRESSO_ROTATION
313 return (p.can_rotate() and not p.is_virtual())
314 ? 0.5 * (hadamard_product(p.omega(), p.omega()) * p.rinertia())
Vector implementation and trait types for boost qvm interoperability.
Routines to calculate the Born-Meyer-Huggins-Tosi-Fumi potential between particle pairs.
double BMHTF_pair_energy(IA_parameters const &ia_params, double dist)
Calculate BMHTF potential energy.
Data structures for bonded interactions.
std::variant< NoneBond, FeneBond, HarmonicBond, QuarticBond, BondedCoulomb, BondedCoulombSR, AngleHarmonicBond, AngleCosineBond, AngleCossquareBond, DihedralBond, TabulatedDistanceBond, TabulatedAngleBond, TabulatedDihedralBond, ThermalizedBond, RigidBond, IBMTriel, IBMVolCons, IBMTribend, OifGlobalForcesBond, OifLocalForcesBond, VirtualBond > Bonded_IA_Parameters
Variant in which to store the parameters of an individual bonded interaction.
Routines to calculate the Buckingham potential between particle pairs.
double buck_pair_energy(IA_parameters const &ia_params, double dist)
Calculate Buckingham energy.
container for bonded interactions.
ESPRESSO_ATTR_ALWAYS_INLINE Utils::Vector3< T > get_mi_vector(Utils::Vector3< T > const &a, Utils::Vector3< T > const &b) const
Get the minimum-image vector between two coordinates.
Routines to calculate the Gaussian potential between particle pairs.
double gaussian_pair_energy(IA_parameters const &ia_params, double dist)
Calculate Gaussian energy.
std::optional< double > calc_bonded_energy(Bonded_IA_Parameters const &iaparams, Particle const &p1, std::span< Particle * > partners, BoxGeometry const &box_geo, Coulomb::ShortRangeEnergyKernel::kernel_type const *kernel)
double translational_kinetic_energy(Particle const &p)
Calculate kinetic energies from translation for one particle.
std::optional< double > calc_dihedral_bonded_energy(Bonded_IA_Parameters const &iaparams, Utils::Vector3d const &v12, Utils::Vector3d const &v23, Utils::Vector3d const &v34)
double calc_central_radial_energy(IA_parameters const &ia_params, double const dist)
std::optional< double > calc_pair_bonded_energy(Bonded_IA_Parameters const &iaparams, Utils::Vector3d const &dx, Utils::Vector3d const &pos1, Utils::Vector3d const &pos2, double q1q2, Coulomb::ShortRangeEnergyKernel::kernel_type const *kernel)
std::optional< double > calc_angle_bonded_energy(Bonded_IA_Parameters const &iaparams, Utils::Vector3d const &vec1, Utils::Vector3d const &vec2)
double rotational_kinetic_energy(Particle const &p)
Calculate kinetic energies from rotation for one particle.
double calc_non_bonded_pair_energy(Particle const &p1, Particle const &p2, IA_parameters const &ia_params, Utils::Vector3d const &d, double const dist, BondedInteractionsMap const &bonded_ias, Coulomb::Solver const &coulomb, Coulomb::ShortRangeEnergyKernel::kernel_type const *coulomb_kernel)
Calculate non-bonded energies between a pair of particles.
This file contains the errorhandling code for severe errors, like a broken bond or illegal parameter ...
#define runtimeWarningMsg()
Routines to calculate the Gay-Berne potential between particle pairs.
double gb_pair_energy(Utils::Vector3d const &ui, Utils::Vector3d const &uj, IA_parameters const &ia_params, Utils::Vector3d const &d, double dist)
Calculate Gay-Berne energy.
Routines to calculate the hat potential between particle pairs.
double hat_pair_energy(IA_parameters const &ia_params, double dist)
Calculate hat energy.
Routines to calculate the Hertzian potential between particle pairs.
double hertzian_pair_energy(IA_parameters const &ia_params, double dist)
Calculate Hertzian energy.
Routines to calculate the Lennard-Jones potential between particle pairs.
double lj_pair_energy(IA_parameters const &ia_params, double dist)
Calculate Lennard-Jones energy.
Routines to calculate the Lennard-Jones with cosine tail potential between particle pairs.
double ljcos2_pair_energy(IA_parameters const &ia_params, double dist)
Calculate Lennard-Jones cosine squared energy.
Routines to calculate the Lennard-Jones+cosine potential between particle pairs.
double ljcos_pair_energy(IA_parameters const &ia_params, double dist)
Calculate Lennard-Jones cosine energy.
Routines to calculate the generalized Lennard-Jones potential between particle pairs.
double ljgen_pair_energy(IA_parameters const &ia_params, double dist)
Calculate Lennard-Jones energy.
Routines to calculate the Morse potential between particle pairs.
double morse_pair_energy(IA_parameters const &ia_params, double dist)
Calculate Morse energy.
Various procedures concerning interactions between particles.
constexpr unsigned pair_potential_bit(PairPotential p)
Bitmask for a pair potential.
Routines to calculate the energy and/or force for particle pairs via interpolation of lookup tables.
double tabulated_pair_energy(IA_parameters const &ia_params, double dist)
Calculate a non-bonded pair energy by linear interpolation from a table.
Routines to calculate the smooth step potential between particle pairs.
double SmSt_pair_energy(IA_parameters const &ia_params, double dist)
Calculate smooth step energy.
Routines to calculate the soft-sphere potential between particle pairs.
double soft_pair_energy(IA_parameters const &ia_params, double dist)
Calculate soft-sphere energy.
Exception indicating that a bond with an unexpected number of partners was encountered.
Exception indicating that a bond type was unknown.
Solver::ShortRangeEnergyKernel kernel_type
Parameters for non-bonded interactions.
unsigned active_pair_mask
Bitmask of pair potentials active for this type pair.
Struct holding all information for one particle.
auto const & mass() const
auto const & quat() const
Routines to calculate the Thole damping potential between particle pairs.
double thole_pair_energy(Particle const &p1, Particle const &p2, IA_parameters const &ia_params, Utils::Vector3d const &d, double dist, BondedInteractionsMap const &bonded_ias, Coulomb::Solver const &coulomb, Coulomb::ShortRangeEnergyKernel::kernel_type const *kernel)
Calculate Thole energy.
Routines to calculate the Weeks-Chandler-Andersen potential between particle pairs.
double wca_pair_energy(IA_parameters const &ia_params, double dist)
Calculate WCA energy.