50#include "system/Leaf.hpp"
57#include <unordered_map>
63 static constexpr int num = 0;
69 static constexpr int num = 1;
88 using container_type =
89 std::unordered_map<int, std::shared_ptr<Bonded_IA_Parameters>>;
107 if (m_params.contains(key)) {
111 next_key = std::max(next_key, key + 1);
117 auto const key = next_key++;
123 if (m_params.contains(key)) {
126 auto &&obj = m_params.erase(key);
134 bool empty()
const {
return m_params.empty(); }
135 auto size()
const {
return m_params.size(); }
138 return contains(bond_id) ?
static_cast<int>(
at(bond_id)->index()) : 0;
141 assert(n_thermalized_bonds >= 0);
142 return n_thermalized_bonds;
144#ifdef ESPRESSO_BOND_CONSTRAINT
146 assert(n_rigid_bonds >= 0);
147 return n_rigid_bonds;
151 for (
auto const &[bond_id, bond] : m_params) {
152 if (bond == target_bond) {
182 template <
typename BondType>
184 auto const &bonds = p.
bonds();
186 bonds.begin(), bonds.end(),
187 [
this, partner_id = p_partner.
id()](
BondView const &bond) {
188 auto const &bond_ptr = at(bond.bond_id());
189 return std::holds_alternative<BondType>(*bond_ptr.get()) and
190 (bond.partner_ids()[0] == partner_id);
201 template <
typename BondType>
208 return pair_bond_exists_on<BondType>(p1, p2) or
209 pair_bond_exists_on<BondType>(p2, p1);
215 container_type m_params = {};
217 int n_thermalized_bonds = 0;
218#ifdef ESPRESSO_BOND_CONSTRAINT
219 int n_rigid_bonds = 0;
225 return std::visit([]<
typename T>(T
const &) {
return T::num; }, iaparams);
Common code for functions calculating angle forces.
Routines to calculate the angle energy or/and and force for a particle triple using the potential des...
Routines to calculate the angle energy or/and and force for a particle triple using the potential des...
Routines to calculate the angle energy or/and and force for a particle triple using the potential des...
Routines to calculate the bonded Coulomb potential between particle pairs.
Routines to calculate the short-range part of the bonded Coulomb potential between particle pairs.
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 energy and/or force for particle bonds, angles and dihedrals via interpolat...
Immutable view on a bond.
container for bonded interactions.
virtual void activate_bond(mapped_type const &ptr)
key_type insert(mapped_type const &ptr)
virtual void deactivate_bond(mapped_type const &ptr)
auto get_n_rigid_bonds() const
mapped_type at(key_type const &key) const
auto get_zero_based_type(int bond_id) const
const_iterator begin() const
container_type::value_type value_type
bool contains(key_type const &key) const
virtual ~BondedInteractionsMap()=default
void insert(key_type const &key, mapped_type const &ptr)
container_type::const_iterator const_iterator
container_type::iterator iterator
std::optional< key_type > find_bond_id(mapped_type const &target_bond) const
auto get_next_key() const
bool pair_bond_exists_between(Particle const &p1, Particle const &p2) const
Checks both particles for a specific bond, even on ghost particles.
const_iterator end() const
bool pair_bond_exists_on(Particle const &p, Particle const &p_partner) const
Checks both particles for a specific bond, even on ghost particles.
double maximal_cutoff() const
Calculate the maximal cutoff of bonded interactions, required to determine the cell size for communic...
BondedInteractionsMap()=default
auto get_n_thermalized_bonds() const
container_type::key_type key_type
container_type::mapped_type mapped_type
auto erase(key_type const &key)
Abstract class that represents a component of the system.
constexpr double bonded_inactive_cutoff
Special cutoff value for an inactive bond.
Routines to calculate the dihedral energy or/and force for a particle quadruple.
Routines to calculate the FENE potential between particle pairs.
Routines to calculate the harmonic bond potential between particle pairs.
Routines to calculate the OIF local forces for a particle quadruple (two neighboring triangles with c...
Routines to calculate the quartic potential between particle pairs.
Definition of the rigid bond data type for the Rattle algorithm.
Parameters for three-body angular potential (cosine).
Parameters for three-body angular potential (cossquare).
Parameters for three-body angular potential (harmonic).
Parameters for Coulomb bond short-range Potential.
Parameters for Coulomb bond Potential.
Parameters for four-body angular potential (dihedral-angle potentials).
Parameters for FENE bond Potential.
Parameters for harmonic bond Potential.
Parameters for IBM tribend.
Parameters for IBM elastic triangle (triel)
Parameters for IBM volume conservation bond.
Interaction type for unused bonded interaction slots.
Parameters for OIF global forces.
Parameters for OIF local forces.
Struct holding all information for one particle.
auto const & bonds() const
Parameters for quartic bond Potential.
Parameters for the rigid_bond/SHAKE/RATTLE ALGORITHM.
Parameters for 3-body tabulated potential.
Parameters for 4-body tabulated potential.
Parameters for 2-body tabulated potential.
Parameters for Thermalized bond.
Interaction type for virtual bonds.
Routines to thermalize the center of mass and distance of a particle pair.