Loading [MathJax]/extensions/TeX/AMSmath.js
ESPResSo
Extensible Simulation Package for Research on Soft Matter Systems
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages Concepts
VelocityVerletIsoNPT.cpp
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#include "config/config.hpp"
21
22#ifdef NPT
23
25
27
30#include "core/npt.hpp"
31
32#include <utils/Vector.hpp>
33
34#include <memory>
35#include <string>
36
37namespace ScriptInterface {
38namespace Integrators {
39
42 {"ext_pressure", AutoParameter::read_only,
43 [this]() { return get_instance().p_ext; }},
44 {"piston", AutoParameter::read_only,
45 [this]() { return get_instance().piston; }},
46 {"direction", AutoParameter::read_only,
47 [this]() { return get_instance().get_direction(); }},
48 {"cubic_box", AutoParameter::read_only,
49 [this]() { return get_instance().cubic_box; }},
50 });
51}
52
54 auto const ext_pressure = get_value<double>(params, "ext_pressure");
55 auto const piston = get_value<double>(params, "piston");
56 auto const cubic_box = get_value_or<bool>(params, "cubic_box", false);
57 auto const direction = get_value_or<Utils::Vector3b>(
58 params, "direction", Utils::Vector3b::broadcast(true));
59
60 context()->parallel_try_catch([&]() {
61 m_instance = std::make_shared<::NptIsoParameters>(ext_pressure, piston,
62 direction, cubic_box);
63 });
64}
65
67 context()->parallel_try_catch(
68 [this]() { m_instance->coulomb_dipole_sanity_checks(get_system()); });
69 get_system().nptiso = m_instance;
70 get_system().propagation->set_integ_switch(INTEG_METHOD_NPT_ISO);
71 get_system().on_thermostat_param_change();
72}
73
74} // namespace Integrators
75} // namespace ScriptInterface
76
77#endif // NPT
@ INTEG_METHOD_NPT_ISO
Vector implementation and trait types for boost qvm interoperability.
void do_construct(VariantMap const &params) override
std::shared_ptr< NptIsoParameters > nptiso
std::shared_ptr< Propagation > propagation
static DEVICE_QUALIFIER constexpr Vector< T, N > broadcast(typename Base::value_type const &value) noexcept
Create a vector that has all entries set to the same value.
Definition Vector.hpp:111
This file contains the defaults for ESPResSo.
T get_value(Variant const &v)
Extract value of specific type T from a Variant.
std::unordered_map< std::string, Variant > VariantMap
Definition Variant.hpp:69
Exports for the NpT code.
static SteepestDescentParameters params
Currently active steepest descent instance.
double p_ext
desired pressure to which the algorithm strives to
Definition npt.hpp:56
bool cubic_box
Set this flag if you want all box dimensions to be identical.
Definition npt.hpp:74
Utils::Vector< bool, 3 > get_direction() const
Definition npt.cpp:92
double piston
mass of a virtual piston representing the shaken box
Definition npt.hpp:46
static constexpr const ReadOnly read_only