ESPResSo
Extensible Simulation Package for Research on Soft Matter Systems
Loading...
Searching...
No Matches
npt.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/** \file
22 * Exports for the NpT code.
23 */
24
25#pragma once
26
27#include "config/config.hpp"
28
29#ifdef ESPRESSO_NPT
30
31#include <utils/Vector.hpp>
32
33#include <array>
34#include <cstddef>
35#include <vector>
36
37namespace System {
38class System;
39} // namespace System
40
41/** Parameters of the isotropic NpT-integration scheme. */
43 NptIsoParameters() = default;
44 NptIsoParameters(double ext_pressure, double piston,
45 Utils::Vector<bool, 3> const &rescale, bool cubic_box);
46 /** mass of a virtual piston representing the shaken box */
47 double piston = 0.;
48 /** inverse of \ref piston */
49 double inv_piston = 0.;
50 /** isotropic volume. Note that we use the term volume throughout,
51 * although for a 2d or 1d system we mean Area and Length respectively
52 */
53 double volume = 0.;
54 /** list of particle mass */
55 std::vector<double> mass_list;
56 /** number of particles */
57 std::size_t particle_number = 0ul;
58 /** desired pressure to which the algorithm strives to */
59 double p_ext = 0.;
60 /** conjugate momentum of volume */
61 double p_epsilon = 0.;
62 /** the coefficient of propagater of position for MTK equation*/
63 double half_dt_inv_piston = 0.;
64 /** the coefficient of propagater of momentum for MTK equation*/
66 /** geometry information for the NpT integrator. Holds the vector
67 * < dir, dir, dir > where a positive value for dir indicates that
68 * box movement is allowed in that direction. To check whether a
69 * given direction is turned on, use bitwise comparison with \ref
70 * nptgeom_dir
71 */
72 int geometry = 0;
73 /** The number of dimensions in which NpT boxlength motion is coupled to
74 * particles */
75 int dimension = 0;
76 /** Set this flag if you want all box dimensions to be identical. Needed for
77 * electrostatics and magnetostatics. If the value of \ref dimension is
78 * less than 3, then box length motion in one or more directions will
79 * be decoupled from the particle motion
80 */
81 bool cubic_box = false;
82 /** An index to one of the non-constant dimensions. Handy if you just want
83 * the variable box_l
84 */
85 int non_const_dim = -1;
86 void coulomb_dipole_sanity_checks(System::System const &system) const;
88 static constexpr std::array<int, 3> nptgeom_dir = {1, 2, 4};
89};
90
91/** Instantaneous pressure during force calculation for NPT integration*/
93 /** instantaneous pressure for p_inst[0] and virial pressure for p_inst[1]
94 * the system currently has */
96 /** virial (short-range) components of \ref p_inst */
97 Utils::Vector3d p_vir = {0., 0., 0.};
98 /** ideal gas components of \ref p_inst, derived from the velocities */
99 Utils::Vector3d p_vel = {0., 0., 0.};
100};
101
102#endif // ESPRESSO_NPT
Vector implementation and trait types for boost qvm interoperability.
Main system class.
Instantaneous pressure during force calculation for NPT integration.
Definition npt.hpp:92
Utils::Vector3d p_vel
ideal gas components of p_inst, derived from the velocities
Definition npt.hpp:99
Utils::Vector3d p_vir
virial (short-range) components of p_inst
Definition npt.hpp:97
Utils::Vector2d p_inst
instantaneous pressure for p_inst[0] and virial pressure for p_inst[1] the system currently has
Definition npt.hpp:95
Parameters of the isotropic NpT-integration scheme.
Definition npt.hpp:42
double inv_piston
inverse of piston
Definition npt.hpp:49
std::vector< double > mass_list
list of particle mass
Definition npt.hpp:55
void coulomb_dipole_sanity_checks(System::System const &system) const
Definition npt.cpp:49
std::size_t particle_number
number of particles
Definition npt.hpp:57
int geometry
geometry information for the NpT integrator.
Definition npt.hpp:72
static constexpr std::array< int, 3 > nptgeom_dir
Definition npt.hpp:88
double half_dt_inv_piston_and_Nf
the coefficient of propagater of momentum for MTK equation
Definition npt.hpp:65
double half_dt_inv_piston
the coefficient of propagater of position for MTK equation
Definition npt.hpp:63
double p_ext
desired pressure to which the algorithm strives to
Definition npt.hpp:59
bool cubic_box
Set this flag if you want all box dimensions to be identical.
Definition npt.hpp:81
int non_const_dim
An index to one of the non-constant dimensions.
Definition npt.hpp:85
Utils::Vector< bool, 3 > get_direction() const
Definition npt.cpp:94
NptIsoParameters()=default
int dimension
The number of dimensions in which NpT boxlength motion is coupled to particles.
Definition npt.hpp:75
double piston
mass of a virtual piston representing the shaken box
Definition npt.hpp:47
double p_epsilon
conjugate momentum of volume
Definition npt.hpp:61
double volume
isotropic volume.
Definition npt.hpp:53