ESPResSo
Extensible Simulation Package for Research on Soft Matter Systems
Loading...
Searching...
No Matches
CoulombP3MGPU.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#ifdef CUDA
26
27#include "Actor.hpp"
28
30
32
33#include <memory>
34#include <string>
35
36namespace ScriptInterface {
37namespace Coulomb {
38
39class CoulombP3MGPU : public Actor<CoulombP3MGPU, ::CoulombP3MGPU> {
40 bool m_tune;
41
42public:
45 {"alpha_L", AutoParameter::read_only,
46 [this]() { return actor()->p3m.params.alpha_L; }},
47 {"r_cut_iL", AutoParameter::read_only,
48 [this]() { return actor()->p3m.params.r_cut_iL; }},
50 [this]() { return actor()->p3m.params.mesh; }},
51 {"mesh_off", AutoParameter::read_only,
52 [this]() { return actor()->p3m.params.mesh_off; }},
54 [this]() { return actor()->p3m.params.cao; }},
55 {"accuracy", AutoParameter::read_only,
56 [this]() { return actor()->p3m.params.accuracy; }},
57 {"epsilon", AutoParameter::read_only,
58 [this]() { return actor()->p3m.params.epsilon; }},
60 [this]() { return actor()->p3m.params.a; }},
62 [this]() { return actor()->p3m.params.alpha; }},
64 [this]() { return actor()->p3m.params.r_cut; }},
65 {"is_tuned", AutoParameter::read_only,
66 [this]() { return actor()->is_tuned(); }},
67 {"verbose", AutoParameter::read_only,
68 [this]() { return actor()->tune_verbose; }},
69 {"timings", AutoParameter::read_only,
70 [this]() { return actor()->tune_timings; }},
71 {"tune", AutoParameter::read_only, [this]() { return m_tune; }},
72 {"check_complex_residuals", AutoParameter::read_only,
73 [this]() { return actor()->check_complex_residuals; }},
74 });
75 }
76
77 void do_construct(VariantMap const &params) override {
78 m_tune = get_value<bool>(params, "tune");
80 auto p3m = P3MParameters{!get_value_or<bool>(params, "is_tuned", !m_tune),
81 get_value<double>(params, "epsilon"),
82 get_value<double>(params, "r_cut"),
83 get_value<Utils::Vector3i>(params, "mesh"),
84 get_value<Utils::Vector3d>(params, "mesh_off"),
85 get_value<int>(params, "cao"),
86 get_value<double>(params, "alpha"),
87 get_value<double>(params, "accuracy")};
88 m_actor = std::make_shared<CoreActorClass>(
89 std::move(p3m), get_value<double>(params, "prefactor"),
90 get_value<int>(params, "timings"), get_value<bool>(params, "verbose"),
91 get_value<bool>(params, "check_complex_residuals"));
92 });
94 }
95};
96
97} // namespace Coulomb
98} // namespace ScriptInterface
99
100#endif // CUDA
101#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 electrostatics on GPU.
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