33#include <unordered_map>
38namespace Interactions {
40 using container_type =
41 std::unordered_map<int, std::shared_ptr<BondedInteraction>>;
44 using key_type =
typename container_type::key_type;
58 container_type m_bonds;
64 m_bonds[key] = std::move(obj_ptr);
71 m_bonds[key] = std::move(obj_ptr);
82 if (name ==
"get_size") {
86 if (name ==
"get_bond_ids") {
87 std::vector<int> bond_ids;
89 bond_ids.push_back(kv.first);
93 if (name ==
"has_bond") {
95 return {m_bonds.count(bond_id) != 0};
98 if (name ==
"get_bond") {
102 if (not context()->is_head_node())
105 if (m_bonds.count(bond_id) == 0) {
106 throw std::out_of_range(
"The bond with id " + std::to_string(bond_id) +
107 " is not yet defined.");
109 return {m_bonds.at(bond_id)};
112 if (name ==
"get_zero_based_type") {
114 return ::bonded_ia_params.get_zero_based_type(bond_id);
The ScriptInterface counterparts of the bonded interactions parameters structs from the core are defi...
BondedInteractionsMap bonded_ia_params
Field containing the parameters of the bonded ia types.
Data structures for bonded interactions.
auto count(key_type const &key) const
void insert(key_type const &key, mapped_type const &ptr)
auto erase(key_type const &key)
void insert_in_core(key_type const &key, mapped_type const &obj_ptr) override
Variant do_call_method(std::string const &name, VariantMap const ¶ms) override
typename container_type::key_type key_type
void erase_in_core(key_type const &key) override
void before_do_construct() override
key_type insert_in_core(mapped_type const &obj_ptr) override
typename container_type::mapped_type mapped_type
Owning map of ObjectHandles.
int get_key(Variant const &key) const
Variant do_call_method(std::string const &method, VariantMap const ¶meters) override
std::unordered_map< std::string, Variant > VariantMap
auto make_unordered_map_of_variants(std::unordered_map< K, V > const &v)
boost::make_recursive_variant< None, bool, int, std::size_t, double, std::string, ObjectRef, Utils::Vector3b, Utils::Vector3i, Utils::Vector2d, Utils::Vector3d, Utils::Vector4d, std::vector< int >, std::vector< double >, std::vector< boost::recursive_variant_ >, std::unordered_map< int, boost::recursive_variant_ >, std::unordered_map< std::string, boost::recursive_variant_ > >::type Variant
Possible types for parameters.
static SteepestDescentParameters params
Currently active steepest descent instance.
static constexpr const ReadOnly read_only