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
28
#include "
core/electrostatics/p3m.hpp
"
29
30
#include "
script_interface/get_value.hpp
"
31
32
#include <memory>
33
#include <string>
34
35
namespace
ScriptInterface
{
36
namespace
Coulomb
{
37
38
class
CoulombP3M
:
public
Actor
<CoulombP3M, ::CoulombP3M> {
39
bool
m_tune;
40
41
public
:
42
CoulombP3M
() {
43
add_parameters
({
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; }},
48
{
"mesh"
,
AutoParameter::read_only
,
49
[
this
]() {
return
actor
()->p3m.params.mesh; }},
50
{
"mesh_off"
,
AutoParameter::read_only
,
51
[
this
]() {
return
actor
()->p3m.params.mesh_off; }},
52
{
"cao"
,
AutoParameter::read_only
,
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; }},
58
{
"a"
,
AutoParameter::read_only
,
59
[
this
]() {
return
actor
()->p3m.params.a; }},
60
{
"alpha"
,
AutoParameter::read_only
,
61
[
this
]() {
return
actor
()->p3m.params.alpha; }},
62
{
"r_cut"
,
AutoParameter::read_only
,
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"
);
78
context
()->
parallel_try_catch
([&]() {
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
});
92
set_charge_neutrality_tolerance
(
params
);
93
}
94
};
95
96
}
// namespace Coulomb
97
}
// namespace ScriptInterface
98
99
#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< CoulombP3M, ::CoulombP3M >::m_actor
std::shared_ptr< CoreActorClass > m_actor
Definition
electrostatics/Actor.hpp:55
ScriptInterface::Coulomb::Actor< CoulombP3M, ::CoulombP3M >::actor
std::shared_ptr< CoreActorClass > actor()
Definition
electrostatics/Actor.hpp:67
ScriptInterface::Coulomb::Actor< CoulombP3M, ::CoulombP3M >::set_charge_neutrality_tolerance
void set_charge_neutrality_tolerance(VariantMap const ¶ms)
Definition
electrostatics/Actor.hpp:71
ScriptInterface::Coulomb::CoulombP3M
Definition
CoulombP3M.hpp:38
ScriptInterface::Coulomb::CoulombP3M::do_construct
void do_construct(VariantMap const ¶ms) override
Definition
CoulombP3M.hpp:76
ScriptInterface::Coulomb::CoulombP3M::CoulombP3M
CoulombP3M()
Definition
CoulombP3M.hpp:42
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.hpp
P3M algorithm for long-range Coulomb interaction.
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
CoulombP3M.hpp
Generated on Sat May 11 2024 01:33:52 for ESPResSo by
1.9.8