28#include "communication.hpp"
30#include "system/System.hpp"
35#include <boost/mpi/collectives.hpp>
51 npt_inst_pressure.
p_inst = {0., 0.};
52 for (
auto i = 0
u; i < 3u; ++i) {
54 npt_inst_pressure.
p_inst[0] +=
55 npt_inst_pressure.
p_vir[i] + npt_inst_pressure.
p_vel[i];
56 npt_inst_pressure.
p_inst[1] += npt_inst_pressure.
p_vir[i];
62 std::plus<Utils::Vector2d>(), 0);
68 (npt_inst_pressure.
p_inst[0] - nptiso.
p_ext) * 0.5 * time_step;
74 if (nptiso.volume < 0.) {
76 <<
", time_step=" << time_step
77 <<
", p_epsilon=" << nptiso.p_epsilon
78 <<
" just caused the volume to become negative."
79 <<
" The system is now in an indeterminate state."
80 <<
" Restart the simulation with a smaller time_step.";
81 nptiso.volume = box_geo.volume();
97 auto &box_geo = *
system.box_geo;
98 auto &cell_structure = *
system.cell_structure;
99 auto &npt_inst_pressure = *
system.npt_inst_pressure;
100 auto &nptiso = *
system.nptiso;
116 nptiso.volume += nptiso.inv_piston * nptiso.p_epsilon * 0.5 * time_step;
121 std::pow(nptiso.volume, 2.0 / nptiso.dimension);
122 L_halfdt = std::pow(nptiso.volume, 1.0 / nptiso.dimension);
125 scal[1] =
L_halfdt * box_geo.length_inv()[nptiso.non_const_dim];
135 for (
auto &p : particles) {
136 for (
auto j = 0
u;
j < 3u; ++
j) {
137 if (!p.is_fixed_along(
j)) {
140 scal[1] * (p.pos()[
j] +
scal[2] * p.v()[
j] * 0.5 * time_step);
141 p.pos_at_last_verlet_update()[
j] *=
scal[1];
144 p.pos()[
j] += p.v()[
j] * 0.5 * time_step;
159 nptiso.volume += nptiso.inv_piston * nptiso.p_epsilon * 0.5 * time_step;
161 L_dt = std::pow(nptiso.volume, 1.0 / nptiso.dimension);
176 for (
auto &p : particles) {
179 for (
auto j = 0
u;
j < 3u; ++
j) {
180 if (!p.is_fixed_along(
j)) {
184 scal[1] * (p.pos()[
j] +
scal[2] * p.v()[
j] * 0.5 * time_step);
185 p.pos_at_last_verlet_update()[
j] *=
scal[1];
188 p.pos()[
j] += p.v()[
j] * 0.5 * time_step;
202 for (
auto i = 0
u; i < 3u; ++i) {
203 if (nptiso.cubic_box ||
214 system.on_boxl_change(
true);
221 auto &nptiso = *
system.nptiso;
222 auto &npt_inst_pressure = *
system.npt_inst_pressure;
232 auto &nptiso = *
system.nptiso;
233 auto &npt_inst_pressure = *
system.npt_inst_pressure;
Vector implementation and trait types for boost qvm interoperability.
cudaStream_t stream[1]
CUDA streams for parallel computing on CPU and GPU.
boost::mpi::communicator comm_cart
The communicator.
int this_node
The number of this node.
This file contains the errorhandling code for severe errors, like a broken bond or illegal parameter ...
#define runtimeErrorMsg()
DEVICE_QUALIFIER constexpr T sqr(T x)
Calculates the SQuaRe of x.
double propagate_thermV_nptiso(IsotropicNptThermostat const &npt_iso, double p_epsilon)
Added noise and friction for NpT-sims to NptIsoParameters::p_epsilon; .
Utils::Vector3d propagate_therm0_nptiso(IsotropicNptThermostat const &npt_iso, Utils::Vector3d const &vel, double mass, int p_identity)
Add velocity-dependent noise and friction for NpT-sims to the particle's velocity; .
Instantaneous pressure during force calculation for NPT integration.
Utils::Vector3d p_vel
ideal gas components of p_inst, derived from the velocities
Utils::Vector3d p_vir
virial (short-range) components of p_inst
Utils::Vector2d p_inst
instantaneous pressure for p_inst[0] and virial pressure for p_inst[1] the system currently has
Thermostat for isotropic NPT dynamics.
Parameters of the isotropic NpT-integration scheme.
int geometry
geometry information for the NpT integrator.
static constexpr std::array< int, 3 > nptgeom_dir
double p_ext
desired pressure to which the algorithm strives to
int dimension
The number of dimensions in which NpT boxlength motion is coupled to particles.
double p_epsilon
conjugate momentum of volume
double volume
isotropic volume.
void velocity_verlet_npt_propagate_vel_final(NptIsoParameters const &nptiso, InstantaneousPressure &npt_inst_pressure, ParticleRangeNPT const &particles, double time_step)
Propagate the particle's velocity.
void velocity_verlet_npt_propagate_vel(NptIsoParameters const &nptiso, InstantaneousPressure &npt_inst_pressure, ParticleRangeNPT const &particles, double time_step)
Propagate the particle's velocity.
static void velocity_verlet_npt_finalize_p_inst(NptIsoParameters &nptiso, InstantaneousPressure &npt_inst_pressure, double time_step)
Scale and communicate instantaneous NpT pressure and propagate the conjugate momentum for volume.
static void velocity_verlet_npt_propagate_AVOVA_And(ParticleRangeNPT const &particles, IsotropicNptThermostat const &npt_iso, double time_step, System::System &system)
propagate positions and the volume and add thermal fluctuation.
static void handle_negative_volume(auto &nptiso, auto const &box_geo, double time_step)
void velocity_verlet_npt_Andersen_step_1(ParticleRangeNPT const &particles, IsotropicNptThermostat const &npt_iso, double time_step, System::System &system)
Special propagator for velocity Verlet NpT with the Andersen method.
void velocity_verlet_npt_Andersen_step_2(ParticleRangeNPT const &particles, double time_step, System::System &system)
Final integration step of the velocity Verlet NpT integrator with the Andersen method.