ESPResSo
Extensible Simulation Package for Research on Soft Matter Systems
Loading...
Searching...
No Matches
script_interface/collision_detection/BindAtPointOfCollision.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#ifdef VIRTUAL_SITES_RELATIVE
26
27#include "Protocol.hpp"
28
30
33
34#include <memory>
35#include <variant>
36
38
41
42public:
45 {"bond_centers", AutoParameter::read_only,
46 [this]() {
48 std::get<CoreClass>(*m_protocol).bond_centers);
49 }},
50 {"distance", AutoParameter::read_only,
51 [this]() { return std::get<CoreClass>(*m_protocol).distance; }},
52 {"bond_vs", AutoParameter::read_only,
53 [this]() {
55 std::get<CoreClass>(*m_protocol).bond_vs);
56 }},
57 {"vs_placement", AutoParameter::read_only,
58 [this]() { return std::get<CoreClass>(*m_protocol).vs_placement; }},
59 {"part_type_vs", AutoParameter::read_only,
60 [this]() { return std::get<CoreClass>(*m_protocol).part_type_vs; }},
61 {"_bond_centers", AutoParameter::read_only,
62 [this]() { return std::get<CoreClass>(*m_protocol).bond_centers; }},
63 {"_bond_vs", AutoParameter::read_only,
64 [this]() { return std::get<CoreClass>(*m_protocol).bond_vs; }},
65 });
66 }
67 std::shared_ptr<::CollisionDetection::ActiveProtocol> protocol() override {
68 return m_protocol;
69 }
70
71private:
72 std::shared_ptr<::CollisionDetection::ActiveProtocol> m_protocol;
73
74protected:
75 void do_initialize(VariantMap const &params) override {
76 auto const bond_center = find_bond_id(params.contains("_bond_centers")
77 ? params.at("_bond_centers")
78 : params.at("bond_centers"));
79 auto const bond_vs =
80 find_bond_id(params.contains("_bond_vs") ? params.at("_bond_vs")
81 : params.at("bond_vs"));
82 m_protocol = std::make_shared<::CollisionDetection::ActiveProtocol>(
83 CoreClass(get_value<double>(params, "distance"), bond_center, bond_vs,
84 get_value<double>(params, "vs_placement"),
85 get_value<int>(params, "part_type_vs")));
86 }
87};
88
89} // namespace ScriptInterface::CollisionDetection
90
91#endif // VIRTUAL_SITES_RELATIVE
92#endif // COLLISION_DETECTION
void add_parameters(std::vector< AutoParameter > &&params)
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