ESPResSo
Extensible Simulation Package for Research on Soft Matter Systems
Loading...
Searching...
No Matches
script_interface/collision_detection/BindCenters.hpp
Go to the documentation of this file.
1/*
2 * Copyright (C) 2021-2024 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#pragma once
21
22#include <config/config.hpp>
23
24#ifdef COLLISION_DETECTION
25
26#include "Protocol.hpp"
27
29
32
33#include <memory>
34#include <variant>
35
37
38class BindCenters : public Protocol {
40
41public:
44 {{"bond_centers", AutoParameter::read_only,
45 [this]() {
47 std::get<CoreClass>(*m_protocol).bond_centers);
48 }},
49 {"_bond_centers", AutoParameter::read_only,
50 [this]() { return std::get<CoreClass>(*m_protocol).bond_centers; }},
51 {"distance", AutoParameter::read_only,
52 [this]() { return std::get<CoreClass>(*m_protocol).distance; }}});
53 }
54 std::shared_ptr<::CollisionDetection::ActiveProtocol> protocol() override {
55 return m_protocol;
56 }
57
58private:
59 std::shared_ptr<::CollisionDetection::ActiveProtocol> m_protocol;
60
61protected:
62 void do_initialize(VariantMap const &params) override {
63 auto const bond_center = find_bond_id(params.contains("_bond_centers")
64 ? params.at("_bond_centers")
65 : params.at("bond_centers"));
66 m_protocol = std::make_shared<::CollisionDetection::ActiveProtocol>(
67 CoreClass(get_value<double>(params, "distance"), bond_center));
68 }
69};
70
71} // namespace ScriptInterface::CollisionDetection
72
73#endif // COLLISION_DETECTION
void add_parameters(std::vector< AutoParameter > &&params)
std::shared_ptr<::CollisionDetection::ActiveProtocol > protocol() override
This file contains the defaults for ESPResSo.
std::unordered_map< std::string, Variant > VariantMap
Definition Variant.hpp:69
static SteepestDescentParameters params
Currently active steepest descent instance.
static constexpr const ReadOnly read_only