48#include "system/Leaf.hpp"
50#include <boost/variant.hpp>
57#include <unordered_map>
67 static constexpr int num = 0;
73 static constexpr int num = 1;
82 template <
typename T>
int operator()(T
const &)
const {
return T::num; }
100 using container_type =
101 std::unordered_map<int, std::shared_ptr<Bonded_IA_Parameters>>;
104 using key_type =
typename container_type::key_type;
107 using iterator =
typename container_type::iterator;
119 if (m_params.contains(key)) {
123 next_key = std::max(next_key, key + 1);
129 auto const key = next_key++;
135 if (m_params.contains(key)) {
138 auto &&obj = m_params.erase(key);
147 bool empty()
const {
return m_params.empty(); }
148 auto size()
const {
return m_params.size(); }
151 return contains(bond_id) ?
at(bond_id)->which() : 0;
154#ifdef BOND_CONSTRAINT
158 for (
auto const &kv : m_params) {
159 if (kv.second == bond) {
189 template <
typename BondType>
191 auto const &bonds = p.
bonds();
193 bonds.begin(), bonds.end(),
194 [
this, partner_id = p_partner.
id()](
BondView const &bond) {
195 auto const &bond_ptr = at(bond.bond_id());
196 return (boost::get<BondType>(bond_ptr.get()) != nullptr) and
197 (bond.partner_ids()[0] == partner_id);
208 template <
typename BondType>
215 return pair_bond_exists_on<BondType>(p1, p2) or
216 pair_bond_exists_on<BondType>(p2, p1);
222 container_type m_params = {};
224 int n_thermalized_bonds = 0;
225#ifdef BOND_CONSTRAINT
226 int n_rigid_bonds = 0;
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.
static constexpr double BONDED_INACTIVE_CUTOFF
int number_of_partners(Bonded_IA_Parameters const &iaparams)
Get the number of bonded partners for the specified bond.
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 energy and/or force for particle bonds, angles and dihedrals via interpolat...
Visitor to get the number of bound partners from the bond parameter variant.
int operator()(T const &) const
Immutable view on a bond.
container for bonded interactions.
typename container_type::key_type key_type
std::optional< key_type > find_bond_id(mapped_type const &bond) const
virtual void activate_bond(mapped_type const &ptr)
auto count(key_type const &key) const
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
bool contains(key_type const &key) const
virtual ~BondedInteractionsMap()=default
void insert(key_type const &key, mapped_type const &ptr)
typename container_type::const_iterator const_iterator
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
typename container_type::mapped_type mapped_type
auto erase(key_type const &key)
typename container_type::iterator iterator
typename container_type::value_type value_type
Abstract class that represents a component of the system.
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.