ESPResSo
Extensible Simulation Package for Research on Soft Matter Systems
Loading...
Searching...
No Matches
DipolarP3M.hpp
Go to the documentation of this file.
1/*
2 * Copyright (C) 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#pragma once
21
22#include "config/config.hpp"
23
24#ifdef DP3M
25
26#include "Actor.hpp"
27
29
31
32#include <memory>
33
34namespace ScriptInterface {
35namespace Dipoles {
36
37class DipolarP3M : public Actor<DipolarP3M, ::DipolarP3M> {
38 bool m_tune;
39
40public:
43 {"alpha_L", AutoParameter::read_only,
44 [this]() { return actor()->dp3m.params.alpha_L; }},
45 {"r_cut_iL", AutoParameter::read_only,
46 [this]() { return actor()->dp3m.params.r_cut_iL; }},
48 [this]() { return actor()->dp3m.params.mesh; }},
49 {"mesh_off", AutoParameter::read_only,
50 [this]() { return actor()->dp3m.params.mesh_off; }},
52 [this]() { return actor()->dp3m.params.cao; }},
53 {"accuracy", AutoParameter::read_only,
54 [this]() { return actor()->dp3m.params.accuracy; }},
55 {"epsilon", AutoParameter::read_only,
56 [this]() { return actor()->dp3m.params.epsilon; }},
58 [this]() { return actor()->dp3m.params.a; }},
60 [this]() { return actor()->dp3m.params.alpha; }},
62 [this]() { return actor()->dp3m.params.r_cut; }},
63 {"is_tuned", AutoParameter::read_only,
64 [this]() { return actor()->is_tuned(); }},
65 {"verbose", AutoParameter::read_only,
66 [this]() { return actor()->tune_verbose; }},
67 {"timings", AutoParameter::read_only,
68 [this]() { return actor()->tune_timings; }},
69 {"tune", AutoParameter::read_only, [this]() { return m_tune; }},
70 });
71 }
72
73 void do_construct(VariantMap const &params) override {
74 m_tune = get_value<bool>(params, "tune");
76 auto p3m = P3MParameters{!get_value_or<bool>(params, "is_tuned", !m_tune),
77 get_value<double>(params, "epsilon"),
78 get_value<double>(params, "r_cut"),
79 get_value<Utils::Vector3i>(params, "mesh"),
80 get_value<Utils::Vector3d>(params, "mesh_off"),
81 get_value<int>(params, "cao"),
82 get_value<double>(params, "alpha"),
83 get_value<double>(params, "accuracy")};
84 m_actor = std::make_shared<CoreActorClass>(
85 std::move(p3m), get_value<double>(params, "prefactor"),
86 get_value<int>(params, "timings"),
87 get_value<bool>(params, "verbose"));
88 });
89 }
90};
91
92} // namespace Dipoles
93} // namespace ScriptInterface
94
95#endif // DP3M
void add_parameters(std::vector< AutoParameter > &&params)
virtual void parallel_try_catch(std::function< void()> const &cb) const =0
Common interface for magnetostatic actors.
void do_construct(VariantMap const &params) override
Context * context() const
Responsible context.
This file contains the defaults for ESPResSo.
P3M algorithm for long-range magnetic dipole-dipole interaction.
std::unordered_map< std::string, Variant > VariantMap
Definition Variant.hpp:82
static SteepestDescentParameters params
Currently active steepest descent instance.
Structure to hold P3M parameters and some dependent variables.
Definition common.hpp:67
static constexpr const ReadOnly read_only