ESPResSo
Extensible Simulation Package for Research on Soft Matter Systems
Loading...
Searching...
No Matches
script_interface/reaction_methods/ReactionEnsemble.hpp
Go to the documentation of this file.
1/*
2 * Copyright (C) 2021-2022 The ESPResSo project
3 *
4 * This file is part of ESPResSo.
5 *
6 * ESPResSo is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * ESPResSo is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20#ifndef SCRIPT_INTERFACE_REACTION_METHODS_REACTION_ENSEMBLE_HPP
21#define SCRIPT_INTERFACE_REACTION_METHODS_REACTION_ENSEMBLE_HPP
22
23#include "ReactionAlgorithm.hpp"
24
26
29
30#include <memory>
31#include <unordered_map>
32
33namespace ScriptInterface {
34namespace ReactionMethods {
35
37public:
38 std::shared_ptr<::ReactionMethods::ReactionAlgorithm> RE() override {
39 return m_re;
40 }
41 std::shared_ptr<::ReactionMethods::ReactionAlgorithm> const
42 RE() const override {
43 return m_re;
44 }
45
46 void do_construct(VariantMap const &params) override {
48 m_re = std::make_shared<::ReactionMethods::ReactionEnsemble>(
49 context()->get_comm(), get_value<int>(params, "seed"),
50 get_value<double>(params, "kT"),
51 get_value<double>(params, "exclusion_range"),
52 get_value_or<std::unordered_map<int, double>>(
53 params, "exclusion_radius_per_type", {}));
54 });
55 do_set_parameter("search_algorithm",
56 Variant{get_value_or<std::string>(
57 params, "search_algorithm", "order_n")});
58 }
59
60private:
61 std::shared_ptr<::ReactionMethods::ReactionEnsemble> m_re;
62};
63} /* namespace ReactionMethods */
64} /* namespace ScriptInterface */
65
66#endif
void do_set_parameter(const std::string &name, const Variant &value) final
virtual void parallel_try_catch(std::function< void()> const &cb) const =0
Context * context() const
Responsible context.
std::shared_ptr<::ReactionMethods::ReactionAlgorithm > RE() override
std::shared_ptr<::ReactionMethods::ReactionAlgorithm > const RE() const override
std::unordered_map< std::string, Variant > VariantMap
Definition Variant.hpp:69
T get_value_or(VariantMap const &vals, std::string const &name, T const &default_)
Get a value from a VariantMap by name, or return a default value if it does not exist.
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.
Definition Variant.hpp:67
static SteepestDescentParameters params
Currently active steepest descent instance.