49#include "system/Leaf.hpp"
59#include <unordered_map>
65 static constexpr int num = 0;
71 static constexpr int num = 1;
90 using container_type =
91 std::unordered_map<int, std::shared_ptr<Bonded_IA_Parameters>>;
109 if (m_params.contains(
key)) {
113 next_key = std::max(next_key,
key + 1);
119 auto const key = next_key++;
125 if (m_params.contains(
key)) {
128 auto &&
obj = m_params.erase(
key);
136 bool empty()
const {
return m_params.empty(); }
137 auto size()
const {
return m_params.size(); }
141 return contains(bond_id) ?
static_cast<int>(
at(bond_id)->index()) : 0;
145 assert(n_thermalized_bonds >= 0);
146 return n_thermalized_bonds;
148#ifdef ESPRESSO_BOND_CONSTRAINT
151 assert(n_rigid_bonds >= 0);
152 return n_rigid_bonds;
167 for (
auto const &[bond_id,
bond] : m_params) {
198 template <
typename BondType>
200 auto const &bonds = p.
bonds();
202 bonds.begin(), bonds.end(),
204 auto const &bond_ptr = at(bond.bond_id());
205 return std::holds_alternative<BondType>(*bond_ptr.get()) and
206 (bond.partner_ids()[0] == partner_id);
217 template <
typename BondType>
231 container_type m_params = {};
233 int n_thermalized_bonds = 0;
234#ifdef ESPRESSO_BOND_CONSTRAINT
235 int n_rigid_bonds = 0;
241 return std::visit([]<
typename T>(T
const &) {
return T::num; },
iaparams);
Vector implementation and trait types for boost qvm interoperability.
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.
DEVICE_QUALIFIER auto get_n_rigid_bonds() const
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_zero_based_type(int bond_id) const
const_iterator begin() const
container_type::value_type value_type
bool contains(key_type const &key) const
mapped_type const & at(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
DEVICE_QUALIFIER auto get_n_thermalized_bonds() const
std::optional< key_type > find_bond_id(mapped_type const &target_bond) 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
container_type::key_type key_type
std::vector< Utils::Vector9d > rigid_bond_virial
Per-bond-type RATTLE constraint virial.
container_type::mapped_type mapped_type
DEVICE_QUALIFIER auto get_next_key() const
auto erase(key_type const &key)
Abstract class that represents a component of the system.
cudaStream_t stream[1]
CUDA streams for parallel computing on CPU and GPU.
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.
constexpr 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.