ESPResSo
Extensible Simulation Package for Research on Soft Matter Systems
Loading...
Searching...
No Matches
CoulombP3M.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 P3M
25
26#include "Actor.hpp"
27
29
31
32#include <memory>
33#include <string>
34
35namespace ScriptInterface {
36namespace Coulomb {
37
38class CoulombP3M : public Actor<CoulombP3M, ::CoulombP3M> {
39 bool m_tune;
40
41public:
44 {"alpha_L", AutoParameter::read_only,
45 [this]() { return actor()->p3m.params.alpha_L; }},
46 {"r_cut_iL", AutoParameter::read_only,
47 [this]() { return actor()->p3m.params.r_cut_iL; }},
49 [this]() { return actor()->p3m.params.mesh; }},
50 {"mesh_off", AutoParameter::read_only,
51 [this]() { return actor()->p3m.params.mesh_off; }},
53 [this]() { return actor()->p3m.params.cao; }},
54 {"accuracy", AutoParameter::read_only,
55 [this]() { return actor()->p3m.params.accuracy; }},
56 {"epsilon", AutoParameter::read_only,
57 [this]() { return actor()->p3m.params.epsilon; }},
59 [this]() { return actor()->p3m.params.a; }},
61 [this]() { return actor()->p3m.params.alpha; }},
63 [this]() { return actor()->p3m.params.r_cut; }},
64 {"is_tuned", AutoParameter::read_only,
65 [this]() { return actor()->is_tuned(); }},
66 {"verbose", AutoParameter::read_only,
67 [this]() { return actor()->tune_verbose; }},
68 {"timings", AutoParameter::read_only,
69 [this]() { return actor()->tune_timings; }},
70 {"tune", AutoParameter::read_only, [this]() { return m_tune; }},
71 {"check_complex_residuals", AutoParameter::read_only,
72 [this]() { return actor()->check_complex_residuals; }},
73 });
74 }
75
76 void do_construct(VariantMap const &params) override {
77 m_tune = get_value<bool>(params, "tune");
79 auto p3m = P3MParameters{!get_value_or<bool>(params, "is_tuned", !m_tune),
80 get_value<double>(params, "epsilon"),
81 get_value<double>(params, "r_cut"),
82 get_value<Utils::Vector3i>(params, "mesh"),
83 get_value<Utils::Vector3d>(params, "mesh_off"),
84 get_value<int>(params, "cao"),
85 get_value<double>(params, "alpha"),
86 get_value<double>(params, "accuracy")};
87 m_actor = std::make_shared<CoreActorClass>(
88 std::move(p3m), get_value<double>(params, "prefactor"),
89 get_value<int>(params, "timings"), get_value<bool>(params, "verbose"),
90 get_value<bool>(params, "check_complex_residuals"));
91 });
93 }
94};
95
96} // namespace Coulomb
97} // namespace ScriptInterface
98
99#endif // P3M
void add_parameters(std::vector< AutoParameter > &&params)
virtual void parallel_try_catch(std::function< void()> const &cb) const =0
Common interface for electrostatic actors.
void do_construct(VariantMap const &params) override
Context * context() const
Responsible context.
This file contains the defaults for ESPResSo.
std::unordered_map< std::string, Variant > VariantMap
Definition Variant.hpp:82
P3M algorithm for long-range Coulomb interaction.
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