ESPResSo
Extensible Simulation Package for Research on Soft Matter Systems
Loading...
Searching...
No Matches
core/electrostatics/scafacos.hpp
Go to the documentation of this file.
1
/*
2
* Copyright (C) 2010-2022 The ESPResSo project
3
* Copyright (C) 2002,2003,2004,2005,2006,2007,2008,2009,2010
4
* Max-Planck-Institute for Polymer Research, Theory Group
5
*
6
* This file is part of ESPResSo.
7
*
8
* ESPResSo is free software: you can redistribute it and/or modify
9
* it under the terms of the GNU General Public License as published by
10
* the Free Software Foundation, either version 3 of the License, or
11
* (at your option) any later version.
12
*
13
* ESPResSo is distributed in the hope that it will be useful,
14
* but WITHOUT ANY WARRANTY; without even the implied warranty of
15
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
* GNU General Public License for more details.
17
*
18
* You should have received a copy of the GNU General Public License
19
* along with this program. If not, see <http://www.gnu.org/licenses/>.
20
*/
21
22
#pragma once
23
24
#include "
config/config.hpp
"
25
26
#ifdef SCAFACOS
27
28
#include "
electrostatics/actor.hpp
"
29
30
#include "
scafacos/ScafacosContextBase.hpp
"
31
32
#include <
utils/Vector.hpp
>
33
34
#include <memory>
35
#include <string>
36
37
struct
CoulombScafacos
:
virtual
public
ScafacosContextBase
,
38
public
Coulomb::Actor
<CoulombScafacos> {
39
~CoulombScafacos
()
override
=
default
;
40
41
void
on_activation
() {
42
update_system_params
();
43
sanity_checks
();
44
tune
();
45
}
46
/** @brief Recalculate all box-length-dependent parameters. */
47
void
on_boxl_change
() {
update_system_params
(); }
48
void
on_node_grid_change
()
const
{}
49
void
on_periodicity_change
() {
update_system_params
(); }
50
void
on_cell_structure_change
()
const
{}
51
void
init
()
const
{}
52
53
void
sanity_checks
()
const override
{
sanity_checks_charge_neutrality
(); }
54
55
bool
is_tuned
()
const
{
return
m_is_tuned; }
56
void
tune
() {
57
if
(not
is_tuned
()) {
58
tune_impl
();
59
}
60
}
61
virtual
double
get_r_cut
()
const
= 0;
62
virtual
double
get_pair_force
(
double
dist)
const
= 0;
63
virtual
double
get_pair_energy
(
double
dist)
const
= 0;
64
virtual
void
set_near_field_delegation
(
bool
delegate) = 0;
65
virtual
bool
get_near_field_delegation
()
const
= 0;
66
67
/** @brief Calculate near-field pair force. */
68
Utils::Vector3d
pair_force
(
double
q1q2,
Utils::Vector3d
const
&d,
69
double
dist)
const
{
70
if
(dist >
get_r_cut
())
71
return
{};
72
73
return
d * (-q1q2 *
prefactor
*
get_pair_force
(dist) / dist);
74
}
75
76
/** @brief Calculate near-field pair energy. */
77
double
pair_energy
(
double
q1q2,
double
dist)
const
{
78
if
(dist >
get_r_cut
())
79
return
0.;
80
81
return
q1q2 *
prefactor
*
get_pair_energy
(dist);
82
}
83
84
protected
:
85
virtual
void
tune_impl
() = 0;
86
87
private
:
88
bool
m_is_tuned =
false
;
89
};
90
91
std::shared_ptr<CoulombScafacos>
92
make_coulomb_scafacos
(std::string
const
&method, std::string
const
¶meters);
93
94
#endif
// SCAFACOS
ScafacosContextBase.hpp
ScafacosContextBase provides the public interface of the ScaFaCoS bridge.
Vector.hpp
Vector implementation and trait types for boost qvm interoperability.
Coulomb::Actor
Definition
electrostatics/actor.hpp:36
Coulomb::Actor< CoulombScafacos >::prefactor
double prefactor
Electrostatics prefactor.
Definition
electrostatics/actor.hpp:42
Coulomb::Actor< CoulombScafacos >::sanity_checks_charge_neutrality
void sanity_checks_charge_neutrality() const
Definition
electrostatics/actor.hpp:56
Utils::Vector
Definition
Vector.hpp:48
config.hpp
This file contains the defaults for ESPResSo.
make_coulomb_scafacos
std::shared_ptr< CoulombScafacos > make_coulomb_scafacos(std::string const &method, std::string const ¶meters)
Definition
electrostatics/scafacos_impl.cpp:47
actor.hpp
CoulombScafacos
Definition
core/electrostatics/scafacos.hpp:38
CoulombScafacos::~CoulombScafacos
~CoulombScafacos() override=default
CoulombScafacos::get_r_cut
virtual double get_r_cut() const =0
CoulombScafacos::set_near_field_delegation
virtual void set_near_field_delegation(bool delegate)=0
CoulombScafacos::init
void init() const
Definition
core/electrostatics/scafacos.hpp:51
CoulombScafacos::on_periodicity_change
void on_periodicity_change()
Definition
core/electrostatics/scafacos.hpp:49
CoulombScafacos::on_cell_structure_change
void on_cell_structure_change() const
Definition
core/electrostatics/scafacos.hpp:50
CoulombScafacos::sanity_checks
void sanity_checks() const override
Definition
core/electrostatics/scafacos.hpp:53
CoulombScafacos::tune
void tune()
Definition
core/electrostatics/scafacos.hpp:56
CoulombScafacos::tune_impl
virtual void tune_impl()=0
CoulombScafacos::on_activation
void on_activation()
Definition
core/electrostatics/scafacos.hpp:41
CoulombScafacos::on_boxl_change
void on_boxl_change()
Recalculate all box-length-dependent parameters.
Definition
core/electrostatics/scafacos.hpp:47
CoulombScafacos::is_tuned
bool is_tuned() const
Definition
core/electrostatics/scafacos.hpp:55
CoulombScafacos::on_node_grid_change
void on_node_grid_change() const
Definition
core/electrostatics/scafacos.hpp:48
CoulombScafacos::get_near_field_delegation
virtual bool get_near_field_delegation() const =0
CoulombScafacos::get_pair_energy
virtual double get_pair_energy(double dist) const =0
CoulombScafacos::pair_energy
double pair_energy(double q1q2, double dist) const
Calculate near-field pair energy.
Definition
core/electrostatics/scafacos.hpp:77
CoulombScafacos::pair_force
Utils::Vector3d pair_force(double q1q2, Utils::Vector3d const &d, double dist) const
Calculate near-field pair force.
Definition
core/electrostatics/scafacos.hpp:68
CoulombScafacos::get_pair_force
virtual double get_pair_force(double dist) const =0
ScafacosContextBase
Public interface to the ScaFaCoS context.
Definition
ScafacosContextBase.hpp:47
ScafacosContextBase::update_system_params
virtual void update_system_params()=0
Reinitialize number of particles, box shape and periodicity.
src
core
electrostatics
scafacos.hpp
Generated on Thu Dec 19 2024 02:13:16 for ESPResSo by
1.9.8