ESPResSo
Extensible Simulation Package for Research on Soft Matter Systems
Loading...
Searching...
No Matches
magnetostatics/solver.hpp
Go to the documentation of this file.
1/*
2 * Copyright (C) 2010-2026 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
29#include <utils/Vector.hpp>
30#include <utils/matrix.hpp>
31
32#include <functional>
33#include <memory>
34#include <optional>
35#include <type_traits>
36
37namespace Dipoles {
38
39struct Solver {
40#ifdef ESPRESSO_DIPOLES
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
47 void sanity_checks() const;
48 double cutoff() const;
49
50 void on_observable_calc();
51 void on_dipoles_change();
52 void on_boxl_change();
57
59 void calc_long_range_force() const;
60 double calc_energy_long_range() const;
61 Solver();
62#else // ESPRESSO_DIPOLES
63 Solver() = default;
64 constexpr double cutoff() const { return inactive_cutoff; }
65#endif // ESPRESSO_DIPOLES
66
67 using ShortRangeForceKernel = std::function<ParticleForce(
68 double, Utils::Vector3d const &, Utils::Vector3d const &,
71#endif
72 Utils::Vector3d const &, double, double)>;
74 std::function<double(Utils::Vector3d const &, Utils::Vector3d const &,
75 Utils::Vector3d const &, double, double)>;
76 using ShortRangePressureKernel = std::function<Utils::Matrix<double, 3, 3>(
77 double, Utils::Vector3d const &, Utils::Vector3d const &,
78 Utils::Vector3d const &, double, double)>;
79
80 inline std::optional<ShortRangeForceKernel> pair_force_kernel() const;
81 inline std::optional<ShortRangeEnergyKernel> pair_energy_kernel() const;
82 inline std::optional<ShortRangePressureKernel> pair_pressure_kernel() const;
83};
84
85} // namespace Dipoles
Vector implementation and trait types for boost qvm interoperability.
cudaStream_t stream[1]
CUDA streams for parallel computing on CPU and GPU.
constexpr double inactive_cutoff
Special cutoff value for an inactive interaction.
Definition config.hpp:53
Matrix implementation and trait types for boost qvm interoperability.
std::function< ParticleForce(double, Utils::Vector3d const &, Utils::Vector3d const &, Utils::Vector3d &, Utils::Vector3d &, Utils::Vector3d const &, double, double)> ShortRangeForceKernel
void sanity_checks() const
Definition dipoles.cpp:46
std::optional< ShortRangeForceKernel > pair_force_kernel() const
double cutoff() const
Definition dipoles.cpp:102
std::function< double(Utils::Vector3d const &, Utils::Vector3d const &, Utils::Vector3d const &, double, double)> ShortRangeEnergyKernel
void on_cell_structure_change()
Definition dipoles.cpp:78
Utils::Vector9d calc_pressure_long_range() const
Definition dipoles.cpp:140
std::unique_ptr< Implementation > impl
Pointer-to-implementation.
std::optional< ShortRangePressureKernel > pair_pressure_kernel() const
void on_boxl_change()
Definition dipoles.cpp:59
void on_periodicity_change()
Definition dipoles.cpp:71
bool reinit_on_observable_calc
Whether to reinitialize the solver on observable calculation.
void on_observable_calc()
Definition dipoles.cpp:113
void calc_long_range_force() const
Definition dipoles.cpp:147
void on_dipoles_change()
Definition dipoles.cpp:52
std::optional< ShortRangeEnergyKernel > pair_energy_kernel() const
void on_node_grid_change()
Definition dipoles.cpp:65
std::function< Utils::Matrix< double, 3, 3 >(double, Utils::Vector3d const &, Utils::Vector3d const &, Utils::Vector3d const &, double, double)> ShortRangePressureKernel
double calc_energy_long_range() const
Definition dipoles.cpp:153
Force information on a particle.
Definition Particle.hpp:331