60#include <boost/variant.hpp>
94#ifdef LENNARD_JONES_GENERIC
183 double const dist,
double const dist2,
IA_parameters const &ia_params,
198 if (!obs_energy.
coulomb.empty() and coulomb_kernel !=
nullptr) {
199 auto const q1q2 = p1.
q() * p2.
q();
200 obs_energy.
coulomb[0] += (*coulomb_kernel)(p1, p2, q1q2, d, dist);
205 if (!obs_energy.
dipolar.empty() and dipoles_kernel !=
nullptr)
206 obs_energy.
dipolar[0] += (*dipoles_kernel)(p1, p2, d, dist, dist2);
210inline std::optional<double>
212 std::span<Particle *> partners,
BoxGeometry const &box_geo,
214 auto const n_partners =
static_cast<int>(partners.size());
216 auto p2 = (n_partners > 0) ? partners[0] :
nullptr;
217 auto p3 = (n_partners > 1) ? partners[1] :
nullptr;
218 auto p4 = (n_partners > 2) ? partners[2] :
nullptr;
220 if (n_partners == 1) {
222 if (
auto const *iap = boost::get<FeneBond>(&iaparams)) {
223 return iap->energy(dx);
225 if (
auto const *iap = boost::get<HarmonicBond>(&iaparams)) {
226 return iap->energy(dx);
228 if (
auto const *iap = boost::get<QuarticBond>(&iaparams)) {
229 return iap->energy(dx);
232 if (
auto const *iap = boost::get<BondedCoulomb>(&iaparams)) {
233 return iap->energy(p1.
q() * p2->q(), dx);
235 if (
auto const *iap = boost::get<BondedCoulombSR>(&iaparams)) {
236 return iap->energy(p1, *p2, dx, *kernel);
239#ifdef BOND_CONSTRAINT
240 if (boost::get<RigidBond>(&iaparams)) {
245 if (
auto const *iap = boost::get<TabulatedDistanceBond>(&iaparams)) {
246 return iap->energy(dx);
249 if (boost::get<VirtualBond>(&iaparams)) {
254 if (n_partners == 2) {
257 if (
auto const *iap = boost::get<AngleHarmonicBond>(&iaparams)) {
258 return iap->energy(vec1, vec2);
260 if (
auto const *iap = boost::get<AngleCosineBond>(&iaparams)) {
261 return iap->energy(vec1, vec2);
263 if (
auto const *iap = boost::get<AngleCossquareBond>(&iaparams)) {
264 return iap->energy(vec1, vec2);
266 if (
auto const *iap = boost::get<TabulatedAngleBond>(&iaparams)) {
267 return iap->energy(vec1, vec2);
269 if (boost::get<IBMTriel>(&iaparams)) {
271 std::to_string(iaparams.which()) +
272 " in energy calculation.";
277 if (n_partners == 3) {
281 auto const v34 = box_geo.
get_mi_vector(p4->pos(), p3->pos());
282 if (
auto const *iap = boost::get<DihedralBond>(&iaparams)) {
283 return iap->energy(v12, v23, v34);
285 if (
auto const *iap = boost::get<TabulatedDihedralBond>(&iaparams)) {
286 return iap->energy(v12, v23, v34);
288 if (boost::get<IBMTribend>(&iaparams)) {
290 std::to_string(iaparams.which()) +
291 " in energy calculation.";
296 if (n_partners == 0) {
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.
boost::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.
Utils::Vector< T, 3 > get_mi_vector(const Utils::Vector< T, 3 > &a, const Utils::Vector< T, 3 > &b) const
Get the minimum-image vector between two coordinates.
Observable for the pressure and energy.
std::span< double > coulomb
Contribution(s) from Coulomb interactions.
void add_non_bonded_contribution(int type1, int type2, int molid1, int molid2, std::span< const double > data)
std::span< double > dipolar
Contribution(s) from dipolar interactions.
This file contains the defaults for ESPResSo.
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.
double calc_kinetic_energy(Particle const &p)
Calculate kinetic energies 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::ShortRangeEnergyKernel::kernel_type const *coulomb_kernel)
Calculate non-bonded energies between a pair of particles.
double rotational_kinetic_energy(Particle const &p)
Calculate kinetic energies from rotation for one particle.
void add_non_bonded_pair_energy(Particle const &p1, Particle const &p2, Utils::Vector3d const &d, double const dist, double const dist2, IA_parameters const &ia_params, BondedInteractionsMap const &bonded_ias, Coulomb::ShortRangeEnergyKernel::kernel_type const *coulomb_kernel, Dipoles::ShortRangeEnergyKernel::kernel_type const *dipoles_kernel, Observable_stat &obs_energy)
Add non-bonded and short-range Coulomb energies between a pair of particles to the energy observable.
This file contains the errorhandling code for severe errors, like a broken bond or illegal parameter ...
#define runtimeWarningMsg()
bool do_nonbonded(Particle const &p1, Particle const &p2)
Determine if the non-bonded interactions between p1 and p2 should be calculated.
Routines to calculate the Gay-Berne potential between particle pairs.
double gb_pair_energy(Utils::Quaternion< double > const &qi, Utils::Quaternion< double > const &qj, 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.
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
Solver::ShortRangeEnergyKernel kernel_type
Parameters for non-bonded interactions.
Struct holding all information for one particle.
auto const & rinertia() const
auto const & mass() const
auto const & quat() const
auto const & omega() const
auto const & type() const
auto const & mol_id() 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::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.