ESPResSo
Extensible Simulation Package for Research on Soft Matter Systems
Loading...
Searching...
No Matches
script_interface/collision_detection/GlueToSurface.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
39class GlueToSurface : public Protocol {
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 {"part_type_vs", AutoParameter::read_only,
58 [this]() { return std::get<CoreClass>(*m_protocol).part_type_vs; }},
59 {"distance_glued_particle_to_vs", AutoParameter::read_only,
60 [this]() {
61 return std::get<CoreClass>(*m_protocol).dist_glued_part_to_vs;
62 }},
63 {"part_type_to_be_glued", AutoParameter::read_only,
64 [this]() {
65 return std::get<CoreClass>(*m_protocol).part_type_to_be_glued;
66 }},
67 {"part_type_to_attach_vs_to", AutoParameter::read_only,
68 [this]() {
69 return std::get<CoreClass>(*m_protocol).part_type_to_attach_vs_to;
70 }},
71 {"part_type_after_glueing", AutoParameter::read_only,
72 [this]() {
73 return std::get<CoreClass>(*m_protocol).part_type_after_glueing;
74 }},
75 {"_bond_centers", AutoParameter::read_only,
76 [this]() { return std::get<CoreClass>(*m_protocol).bond_centers; }},
77 {"_bond_vs", AutoParameter::read_only,
78 [this]() { return std::get<CoreClass>(*m_protocol).bond_vs; }},
79 });
80 }
81 std::shared_ptr<::CollisionDetection::ActiveProtocol> protocol() override {
82 return m_protocol;
83 }
84
85private:
86 std::shared_ptr<::CollisionDetection::ActiveProtocol> m_protocol;
87
88protected:
89 void do_initialize(VariantMap const &params) override {
90 auto const bond_center = find_bond_id(params.contains("_bond_centers")
91 ? params.at("_bond_centers")
92 : params.at("bond_centers"));
93 auto const bond_vs =
94 find_bond_id(params.contains("_bond_vs") ? params.at("_bond_vs")
95 : params.at("bond_vs"));
96 m_protocol = std::make_shared<::CollisionDetection::ActiveProtocol>(
97 CoreClass(get_value<double>(params, "distance"), bond_center, bond_vs,
98 get_value<int>(params, "part_type_vs"),
99 get_value<double>(params, "distance_glued_particle_to_vs"),
100 get_value<int>(params, "part_type_to_be_glued"),
101 get_value<int>(params, "part_type_to_attach_vs_to"),
102 get_value<int>(params, "part_type_after_glueing")));
103 }
104};
105
106} // namespace ScriptInterface::CollisionDetection
107
108#endif // COLLISION_DETECTION
109#endif // VIRTUAL_SITES_RELATIVE
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