76#ifdef ESPRESSO_SHARED_MEMORY_PARALLELISM
85#ifdef ESPRESSO_LENNARD_JONES
93#ifdef ESPRESSO_LENNARD_JONES_GENERIC
97#ifdef ESPRESSO_SMOOTH_STEP
101#ifdef ESPRESSO_HERTZIAN
105#ifdef ESPRESSO_GAUSSIAN
109#ifdef ESPRESSO_BMHTF_NACL
113#ifdef ESPRESSO_BUCKINGHAM
121#ifdef ESPRESSO_SOFT_SPHERE
133#ifdef ESPRESSO_LJCOS2
137#ifdef ESPRESSO_TABULATED
151#ifdef ESPRESSO_GAY_BERNE
160#ifdef ESPRESSO_ROTATION
164 if (
pf.torque[0] != 0. ||
pf.torque[1] != 0. ||
pf.torque[2] != 0.) {
192#ifdef ESPRESSO_EXCLUSIONS
200#ifdef ESPRESSO_EXCLUSIONS
212 *
virial += hadamard_product(
pf.f, d);
220#ifdef ESPRESSO_ELECTROSTATICS
222 if (q1q2 != 0.
and coulomb_kernel !=
nullptr) {
223 pf.f += (*coulomb_kernel)(q1q2, d,
dist);
226 (*virial)[0] += (*coulomb_u_kernel)(
p1.pos(),
p2.pos(), q1q2, d,
dist);
253#ifdef ESPRESSO_DIPOLES
255 if (dipoles_kernel) {
256 auto const d1d2 =
p1.dipm() *
p2.dipm();
259 (*dipoles_kernel)(
d1d2,
p1.calc_dip(),
p2.calc_dip(), d,
dist, dist2);
298#ifdef ESPRESSO_EXCLUSIONS
305#ifdef ESPRESSO_EXCLUSIONS
309#ifdef ESPRESSO_EXCLUSIONS
315 p1,
p2,
pf,
p1f_asym,
p2f_asym, d,
dist, dist2, q1q2,
ia_params,
317 coulomb_kernel, dipoles_kernel, elc_kernel, coulomb_u_kernel);
339 if (
auto const *
iap = std::get_if<FeneBond>(&
iaparams)) {
340 return iap->force(
dx);
342 if (
auto const *
iap = std::get_if<HarmonicBond>(&
iaparams)) {
343 return iap->force(
dx);
345 if (
auto const *
iap = std::get_if<QuarticBond>(&
iaparams)) {
346 return iap->force(
dx);
348#ifdef ESPRESSO_ELECTROSTATICS
349 if (
auto const *
iap = std::get_if<BondedCoulomb>(&
iaparams)) {
352 if (
auto const *
iap = std::get_if<BondedCoulombSR>(&
iaparams)) {
353 return iap->force(
dx, *kernel);
356#ifdef ESPRESSO_BOND_CONSTRAINT
357 if (std::get_if<RigidBond>(&
iaparams)) {
361#ifdef ESPRESSO_TABULATED
362 if (
auto const *
iap = std::get_if<TabulatedDistanceBond>(&
iaparams)) {
363 return iap->force(
dx);
366 if (std::get_if<VirtualBond>(&
iaparams)) {
378 if (
auto const *
iap = std::get_if<ThermalizedBond>(&
iaparams)) {
381 auto const &forces = result.value();
383 p1.force() += std::get<0>(forces);
384 p2.force() += std::get<1>(forces);
391 p1.force() += result.value();
392 p2.force() -= result.value();
396 *
virial += hadamard_product(result.value(),
dx);
406 std::tuple<Utils::Vector3d, Utils::Vector3d, Utils::Vector3d>>
412 if (
auto const *
iap = std::get_if<AngleHarmonicBond>(&
iaparams)) {
415 if (
auto const *
iap = std::get_if<AngleCosineBond>(&
iaparams)) {
418 if (
auto const *
iap = std::get_if<AngleCossquareBond>(&
iaparams)) {
421#ifdef ESPRESSO_TABULATED
422 if (
auto const *
iap = std::get_if<TabulatedAngleBond>(&
iaparams)) {
426 if (
auto const *
iap = std::get_if<IBMTriel>(&
iaparams)) {
436 if (std::get_if<OifGlobalForcesBond>(&
iaparams)) {
442 auto const &forces = result.value();
444 p1.force() += std::get<0>(forces);
445 p2.force() += std::get<1>(forces);
446 p3.force() += std::get<2>(forces);
459 if (
auto const *
iap = std::get_if<OifLocalForcesBond>(&
iaparams)) {
462 if (
auto const *
iap = std::get_if<IBMTribend>(&
iaparams)) {
469 if (
auto const *
iap = std::get_if<DihedralBond>(&
iaparams)) {
472#ifdef ESPRESSO_TABULATED
473 if (
auto const *
iap = std::get_if<TabulatedDihedralBond>(&
iaparams)) {
487 auto const &forces = result.value();
489 p1.force() += std::get<0>(forces);
490 p2.force() += std::get<1>(forces);
491 p3.force() += std::get<2>(forces);
492 p4.force() += std::get<3>(forces);
512 p1.id(), {{partners[0]->id(), std::nullopt}}, bond_id, d)) {
519 if (bond_breakage.check_and_handle_breakage(
520 p1.id(), {{partners[0]->id(), partners[1]->id()}}, bond_id, d)) {
#define ESPRESSO_ATTR_ALWAYS_INLINE
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_force_factor(IA_parameters const &ia_params, double dist)
Calculate BMHTF force factor.
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.
int number_of_partners(Bonded_IA_Parameters const &iaparams)
Get the number of bonded partners for the specified bond.
Routines to calculate the Buckingham potential between particle pairs.
double buck_pair_force_factor(IA_parameters const &ia_params, double dist)
Calculate Buckingham force factor.
bool check_and_handle_breakage(int particle_id, BondPartners const &bond_partners, int bond_type, double distance)
Check if the bond between the particles should break, if yes, queue it.
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.
std::shared_ptr< DPDThermostat > dpd
int thermo_switch
Bitmask of currently active thermostats.
cudaStream_t stream[1]
CUDA streams for parallel computing on CPU and GPU.
Routines to calculate the Gaussian potential between particle pairs.
double gaussian_pair_force_factor(IA_parameters const &ia_params, double dist)
Calculate Gaussian force factor.
__device__ void vector_product(float const *a, float const *b, float *out)
Utils::Vector3d dpd_pair_force(Utils::Vector3d const &p1_position, Utils::Vector3d const &p1_velocity, int const &p1_id, Utils::Vector3d const &p2_position, Utils::Vector3d const &p2_velocity, int const &p2_id, DPDThermostat const &dpd, BoxGeometry const &box_geo, IA_parameters const &ia_params, Utils::Vector3d const &d, double dist, double dist2)
Routines to use DPD as thermostat or pair force .
This file contains the errorhandling code for severe errors, like a broken bond or illegal parameter ...
bool do_nonbonded(Particle const &p1, Particle const &p2)
Determine if the non-bonded interactions between p1 and p2 should be calculated.
void add_non_bonded_pair_force_with_p(Particle &p1, Particle &p2, ParticleForce &pf, ParticleForce &p1f_asym, ParticleForce &p2f_asym, Utils::Vector3d const &d, double dist, double dist2, double q1q2, IA_parameters const &ia_params, bool do_nonbonded_flag, Thermostat::Thermostat const &thermostat, BoxGeometry const &box_geo, BondedInteractionsMap const &bonded_ias, Utils::Vector3d *const virial, Coulomb::ShortRangeForceKernel::kernel_type const *coulomb_kernel, Dipoles::ShortRangeForceKernel::kernel_type const *dipoles_kernel, Coulomb::ShortRangeForceCorrectionsKernel::kernel_type const *elc_kernel, Coulomb::ShortRangeEnergyKernel::kernel_type const *coulomb_u_kernel)
For interactions which need particle information.
void add_non_bonded_pair_force(Particle &p1, Particle &p2, Utils::Vector3d const &d, double dist, double dist2, double q1q2, IA_parameters const &ia_params, Thermostat::Thermostat const &thermostat, BoxGeometry const &box_geo, BondedInteractionsMap const &bonded_ias, Utils::Vector3d *const virial, Coulomb::ShortRangeForceKernel::kernel_type const *coulomb_kernel, Dipoles::ShortRangeForceKernel::kernel_type const *dipoles_kernel, Coulomb::ShortRangeForceCorrectionsKernel::kernel_type const *elc_kernel, Coulomb::ShortRangeEnergyKernel::kernel_type const *coulomb_u_kernel)
Calculate non-bonded forces between a pair of particles and update their forces and torques.
std::optional< Utils::Vector3d > calc_bond_pair_force(Bonded_IA_Parameters const &iaparams, Particle const &p1, Particle const &p2, Utils::Vector3d const &dx, Coulomb::ShortRangeForceKernel::kernel_type const *kernel)
Compute the bonded interaction force between particle pairs.
ParticleForce calc_opposing_force(ParticleForce const &pf, Utils::Vector3d const &d)
std::optional< std::tuple< Utils::Vector3d, Utils::Vector3d, Utils::Vector3d, Utils::Vector3d > > calc_bonded_four_body_force(Bonded_IA_Parameters const &iaparams, BoxGeometry const &box_geo, Particle const &p1, Particle const &p2, Particle const &p3, Particle const &p4)
bool add_bonded_three_body_force(Bonded_IA_Parameters const &iaparams, BoxGeometry const &box_geo, Particle &p1, Particle &p2, Particle &p3)
bool add_bonded_four_body_force(Bonded_IA_Parameters const &iaparams, BoxGeometry const &box_geo, Particle &p1, Particle &p2, Particle &p3, Particle &p4)
ParticleForce calc_non_central_force(Particle const &p1, Particle const &p2, IA_parameters const &ia_params, Utils::Vector3d const &d, double const dist)
bool add_bonded_two_body_force(Bonded_IA_Parameters const &iaparams, BoxGeometry const &box_geo, Particle &p1, Particle &p2, Utils::Vector3d *const virial, Coulomb::ShortRangeForceKernel::kernel_type const *kernel)
std::optional< std::tuple< Utils::Vector3d, Utils::Vector3d, Utils::Vector3d > > calc_bonded_three_body_force(Bonded_IA_Parameters const &iaparams, BoxGeometry const &box_geo, Particle const &p1, Particle const &p2, Particle const &p3)
ESPRESSO_ATTR_ALWAYS_INLINE Utils::Vector3d calc_central_radial_force(IA_parameters const &ia_params, Utils::Vector3d const &d, double const dist)
bool add_bonded_force(Particle &p1, int bond_id, std::span< Particle * > partners, BondedInteractionsMap const &bonded_ia_params, BondBreakage::BondBreakage &bond_breakage, BoxGeometry const &box_geo, Utils::Vector3d *const virial, Coulomb::ShortRangeForceKernel::kernel_type const *kernel)
Routines to calculate the Gay-Berne potential between particle pairs.
ParticleForce gb_pair_force(Utils::Vector3d const &ui, Utils::Vector3d const &uj, IA_parameters const &ia_params, Utils::Vector3d const &d, double dist)
Calculate Gay-Berne force and torques.
Routines to calculate the hat potential between particle pairs.
double hat_pair_force_factor(IA_parameters const &ia_params, double dist)
Calculate hat force factor.
Routines to calculate the Hertzian potential between particle pairs.
double hertzian_pair_force_factor(IA_parameters const &ia_params, double dist)
Calculate Hertzian force factor.
Routines to calculate the Lennard-Jones potential between particle pairs.
double lj_pair_force_factor(IA_parameters const &ia_params, double dist)
Calculate Lennard-Jones force factor.
Routines to calculate the Lennard-Jones with cosine tail potential between particle pairs.
double ljcos2_pair_force_factor(IA_parameters const &ia_params, double dist)
Calculate Lennard-Jones cosine squared force factor.
Routines to calculate the Lennard-Jones+cosine potential between particle pairs.
double ljcos_pair_force_factor(IA_parameters const &ia_params, double dist)
Calculate Lennard-Jones cosine force factor.
Routines to calculate the generalized Lennard-Jones potential between particle pairs.
double ljgen_pair_force_factor(IA_parameters const &ia_params, double dist)
Calculate Lennard-Jones force factor.
Routines to calculate the Morse potential between particle pairs.
double morse_pair_force_factor(IA_parameters const &ia_params, double dist)
Calculate Morse force factor.
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_force_factor(IA_parameters const &ia_params, double dist)
Calculate a non-bonded pair force factor by linear interpolation from a table.
Routines to calculate the OIF global forces for a particle triple (triangle from mesh).
Routines to calculate the OIF local forces for a particle quadruple (two neighboring triangles with c...
Routines to calculate the smooth step potential between particle pairs.
double SmSt_pair_force_factor(IA_parameters const &ia_params, double dist)
Calculate smooth step force factor.
Routines to calculate the soft-sphere potential between particle pairs.
double soft_pair_force_factor(IA_parameters const &ia_params, double dist)
Calculate soft-sphere force factor.
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::ShortRangeForceCorrectionsKernel kernel_type
Solver::ShortRangeForceKernel kernel_type
Solver::ShortRangeForceKernel kernel_type
Parameters for non-bonded interactions.
Force information on a particle.
Struct holding all information for one particle.
Routines to calculate the Thole damping potential between particle pairs.
Utils::Vector3d thole_pair_force(Particle const &p1, Particle const &p2, IA_parameters const &ia_params, Utils::Vector3d const &d, double dist, BondedInteractionsMap const &bonded_ias, Coulomb::ShortRangeForceKernel::kernel_type const *kernel)
Calculate Thole force.
Routines to calculate the Weeks-Chandler-Andersen potential between particle pairs.
double wca_pair_force_factor(IA_parameters const &ia_params, double dist)
Calculate WCA force factor.