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
29
#include "
core/electrostatics/p3m_gpu.hpp
"
30
31
#include "
script_interface/get_value.hpp
"
32
33
#include <memory>
34
#include <string>
35
36
namespace
ScriptInterface
{
37
namespace
Coulomb
{
38
39
class
CoulombP3MGPU
:
public
Actor
<CoulombP3MGPU, ::CoulombP3MGPU> {
40
bool
m_tune;
41
42
public
:
43
CoulombP3MGPU
() {
44
add_parameters
({
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; }},
49
{
"mesh"
,
AutoParameter::read_only
,
50
[
this
]() {
return
actor
()->p3m.params.mesh; }},
51
{
"mesh_off"
,
AutoParameter::read_only
,
52
[
this
]() {
return
actor
()->p3m.params.mesh_off; }},
53
{
"cao"
,
AutoParameter::read_only
,
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; }},
59
{
"a"
,
AutoParameter::read_only
,
60
[
this
]() {
return
actor
()->p3m.params.a; }},
61
{
"alpha"
,
AutoParameter::read_only
,
62
[
this
]() {
return
actor
()->p3m.params.alpha; }},
63
{
"r_cut"
,
AutoParameter::read_only
,
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"
);
79
context
()->
parallel_try_catch
([&]() {
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
});
93
set_charge_neutrality_tolerance
(
params
);
94
}
95
};
96
97
}
// namespace Coulomb
98
}
// namespace ScriptInterface
99
100
#endif
// CUDA
101
#endif
// P3M
ScriptInterface::AutoParameters::add_parameters
void add_parameters(std::vector< AutoParameter > &¶ms)
Definition
AutoParameters.hpp:113
ScriptInterface::Context::parallel_try_catch
virtual void parallel_try_catch(std::function< void()> const &cb) const =0
ScriptInterface::Coulomb::Actor
Common interface for electrostatic actors.
Definition
electrostatics/Actor.hpp:45
ScriptInterface::Coulomb::Actor< CoulombP3MGPU, ::CoulombP3MGPU >::m_actor
std::shared_ptr< CoreActorClass > m_actor
Definition
electrostatics/Actor.hpp:55
ScriptInterface::Coulomb::Actor< CoulombP3MGPU, ::CoulombP3MGPU >::actor
std::shared_ptr< CoreActorClass > actor()
Definition
electrostatics/Actor.hpp:67
ScriptInterface::Coulomb::Actor< CoulombP3MGPU, ::CoulombP3MGPU >::set_charge_neutrality_tolerance
void set_charge_neutrality_tolerance(VariantMap const ¶ms)
Definition
electrostatics/Actor.hpp:71
ScriptInterface::Coulomb::CoulombP3MGPU
Definition
CoulombP3MGPU.hpp:39
ScriptInterface::Coulomb::CoulombP3MGPU::do_construct
void do_construct(VariantMap const ¶ms) override
Definition
CoulombP3MGPU.hpp:77
ScriptInterface::Coulomb::CoulombP3MGPU::CoulombP3MGPU
CoulombP3MGPU()
Definition
CoulombP3MGPU.hpp:43
ScriptInterface::ObjectHandle::context
Context * context() const
Responsible context.
Definition
ObjectHandle.hpp:59
config.hpp
This file contains the defaults for ESPResSo.
get_value.hpp
Actor.hpp
Coulomb
Definition
electrostatics/actor.hpp:30
ScriptInterface
Definition
script_interface/accumulators/AccumulatorBase.hpp:30
ScriptInterface::VariantMap
std::unordered_map< std::string, Variant > VariantMap
Definition
Variant.hpp:82
p3m_gpu.hpp
P3M electrostatics on GPU.
params
static SteepestDescentParameters params
Currently active steepest descent instance.
Definition
steepest_descent.cpp:44
P3MParameters
Structure to hold P3M parameters and some dependent variables.
Definition
common.hpp:67
ScriptInterface::AutoParameter::read_only
static constexpr const ReadOnly read_only
Definition
AutoParameter.hpp:42
src
script_interface
electrostatics
CoulombP3MGPU.hpp
Generated on Sat May 11 2024 01:33:52 for ESPResSo by
1.9.8