ESPResSo
Extensible Simulation Package for Research on Soft Matter Systems
Loading...
Searching...
No Matches
electrostatics/solver.hpp
Go to the documentation of this file.
1/*
2 * Copyright (C) 2010-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#include "actor/optional.hpp"
25#include "actor/traits.hpp"
26
27#include "Particle.hpp"
28#include "ParticleRange.hpp"
29
30#include <utils/Vector.hpp>
31
32#include <functional>
33#include <memory>
34#include <optional>
35#include <type_traits>
36
37namespace Coulomb {
38
39struct Solver {
40#ifdef ELECTROSTATICS
41 struct Implementation;
42 /// @brief Pointer-to-implementation.
43 std::unique_ptr<Implementation> impl;
44 /// @brief Whether to reinitialize the solver on observable calculation.
46
48 calc_pressure_long_range(ParticleRange const &particles) const;
49
50 void sanity_checks() const;
51 double cutoff() const;
52
53 void on_observable_calc();
54 void on_coulomb_change();
55 void on_boxl_change();
60
61 void calc_long_range_force(ParticleRange const &particles) const;
62 double calc_energy_long_range(ParticleRange const &particles) const;
63 Solver();
64#else // ELECTROSTATICS
65 Solver() = default;
66#endif // ELECTROSTATICS
67
69 std::function<Utils::Vector3d(double, Utils::Vector3d const &, double)>;
71 std::function<void(Particle &, Particle &, double)>;
72 using ShortRangePressureKernel = std::function<Utils::Matrix<double, 3, 3>(
73 double, Utils::Vector3d const &, double)>;
75 std::function<double(Particle const &, Particle const &, double,
76 Utils::Vector3d const &, double)>;
77
78 inline std::optional<ShortRangeForceKernel> pair_force_kernel() const;
79 inline std::optional<ShortRangePressureKernel> pair_pressure_kernel() const;
80 inline std::optional<ShortRangeEnergyKernel> pair_energy_kernel() const;
81 inline std::optional<ShortRangeForceCorrectionsKernel>
83};
84
85#ifdef ELECTROSTATICS
86Solver const &get_coulomb();
87#endif
88
89} // namespace Coulomb
Vector implementation and trait types for boost qvm interoperability.
A range of particles.
This file contains the defaults for ESPResSo.
Solver const & get_coulomb()
Definition coulomb.cpp:66
VectorXd< 3 > Vector3d
Definition Vector.hpp:164
void on_observable_calc()
Definition coulomb.cpp:193
double cutoff() const
Definition coulomb.cpp:172
std::optional< ShortRangePressureKernel > pair_pressure_kernel() const
std::function< Utils::Matrix< double, 3, 3 >(double, Utils::Vector3d const &, double)> ShortRangePressureKernel
void sanity_checks() const
Definition coulomb.cpp:68
std::function< Utils::Vector3d(double, Utils::Vector3d const &, double)> ShortRangeForceKernel
void on_cell_structure_change()
Definition coulomb.cpp:100
std::function< double(Particle const &, Particle const &, double, Utils::Vector3d const &, double)> ShortRangeEnergyKernel
std::optional< ShortRangeForceKernel > pair_force_kernel() const
std::function< void(Particle &, Particle &, double)> ShortRangeForceCorrectionsKernel
void on_periodicity_change()
Definition coulomb.cpp:93
void calc_long_range_force(ParticleRange const &particles) const
Definition coulomb.cpp:256
void on_node_grid_change()
Definition coulomb.cpp:87
Utils::Vector9d calc_pressure_long_range(ParticleRange const &particles) const
Definition coulomb.cpp:138
void on_coulomb_change()
Definition coulomb.cpp:74
std::unique_ptr< Implementation > impl
Pointer-to-implementation.
void on_boxl_change()
Definition coulomb.cpp:81
std::optional< ShortRangeEnergyKernel > pair_energy_kernel() const
bool reinit_on_observable_calc
Whether to reinitialize the solver on observable calculation.
std::optional< ShortRangeForceCorrectionsKernel > pair_force_elc_kernel() const
double calc_energy_long_range(ParticleRange const &particles) const
Definition coulomb.cpp:262
Struct holding all information for one particle.
Definition Particle.hpp:395