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
28
#include "
core/magnetostatics/dp3m.hpp
"
29
30
#include "
script_interface/get_value.hpp
"
31
32
#include <memory>
33
34
namespace
ScriptInterface
{
35
namespace
Dipoles
{
36
37
class
DipolarP3M
:
public
Actor
<DipolarP3M, ::DipolarP3M> {
38
bool
m_tune;
39
40
public
:
41
DipolarP3M
() {
42
add_parameters
({
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; }},
47
{
"mesh"
,
AutoParameter::read_only
,
48
[
this
]() {
return
actor
()->dp3m.params.mesh; }},
49
{
"mesh_off"
,
AutoParameter::read_only
,
50
[
this
]() {
return
actor
()->dp3m.params.mesh_off; }},
51
{
"cao"
,
AutoParameter::read_only
,
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; }},
57
{
"a"
,
AutoParameter::read_only
,
58
[
this
]() {
return
actor
()->dp3m.params.a; }},
59
{
"alpha"
,
AutoParameter::read_only
,
60
[
this
]() {
return
actor
()->dp3m.params.alpha; }},
61
{
"r_cut"
,
AutoParameter::read_only
,
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"
);
75
context
()->
parallel_try_catch
([&]() {
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
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::Dipoles::Actor
Common interface for magnetostatic actors.
Definition
magnetostatics/Actor.hpp:45
ScriptInterface::Dipoles::Actor< DipolarP3M, ::DipolarP3M >::actor
std::shared_ptr< CoreActorClass > actor()
Definition
magnetostatics/Actor.hpp:71
ScriptInterface::Dipoles::Actor< DipolarP3M, ::DipolarP3M >::m_actor
std::shared_ptr< CoreActorClass > m_actor
Definition
magnetostatics/Actor.hpp:54
ScriptInterface::Dipoles::DipolarP3M
Definition
DipolarP3M.hpp:37
ScriptInterface::Dipoles::DipolarP3M::DipolarP3M
DipolarP3M()
Definition
DipolarP3M.hpp:41
ScriptInterface::Dipoles::DipolarP3M::do_construct
void do_construct(VariantMap const ¶ms) override
Definition
DipolarP3M.hpp:73
ScriptInterface::ObjectHandle::context
Context * context() const
Responsible context.
Definition
ObjectHandle.hpp:59
config.hpp
This file contains the defaults for ESPResSo.
dp3m.hpp
P3M algorithm for long-range magnetic dipole-dipole interaction.
get_value.hpp
Actor.hpp
Dipoles
Definition
magnetostatics/actor.hpp:30
ScriptInterface
Definition
script_interface/accumulators/AccumulatorBase.hpp:30
ScriptInterface::VariantMap
std::unordered_map< std::string, Variant > VariantMap
Definition
Variant.hpp:82
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
magnetostatics
DipolarP3M.hpp
Generated on Sat May 11 2024 01:33:53 for ESPResSo by
1.9.8