ESPResSo
Extensible Simulation Package for Research on Soft Matter Systems
Loading...
Searching...
No Matches
electrostatics/actor.hpp
Go to the documentation of this file.
1/*
2 * Copyright (C) 2022-2023 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 ELECTROSTATICS
25
26#include "system/Leaf.hpp"
27
28#include <stdexcept>
29
30namespace Coulomb {
31
32/** @brief Check if the system is charge-neutral. */
34 double relative_tolerance);
35
36template <typename Class> class Actor : public System::Leaf<Actor<Class>> {
37public:
38 static auto constexpr charge_neutrality_tolerance_default = 2e-12;
39 /**
40 * @brief Electrostatics prefactor.
41 */
42 double prefactor = 0.;
43 /**
44 * @brief Relative tolerance for the charge excess during neutrality checks.
45 * To deactivate neutrality checks, set this value to -1.
46 */
48
49 void set_prefactor(double new_prefactor) {
50 if (new_prefactor <= 0.) {
51 throw std::domain_error("Parameter 'prefactor' must be > 0");
52 }
53 prefactor = new_prefactor;
54 }
55
62};
63
64} // namespace Coulomb
65
66#endif // ELECTROSTATICS
void set_prefactor(double new_prefactor)
double prefactor
Electrostatics prefactor.
void sanity_checks_charge_neutrality() const
static auto constexpr charge_neutrality_tolerance_default
double charge_neutrality_tolerance
Relative tolerance for the charge excess during neutrality checks.
Abstract class that represents a component of the system.
Main system class.
This file contains the defaults for ESPResSo.
void check_charge_neutrality(System::System const &system, double relative_tolerance)
Check if the system is charge-neutral.
Definition coulomb.cpp:287