29#include "communication.hpp"
32#include "system/System.hpp"
33#include "thermostat.hpp"
39#include <boost/mpi/collectives.hpp>
52 for (
auto &p : particles) {
53 auto const noise = friction_therm0_nptiso<2>(npt_iso, p.v(), p.id());
54 for (
unsigned int j = 0; j < 3; j++) {
55 if (!p.is_fixed_along(j)) {
58 p.v()[j] += (p.force()[j] * time_step / 2.0 + noise[j]) / p.mass();
61 p.v()[j] += p.force()[j] * time_step / 2.0 / p.mass();
74 for (
unsigned int i = 0; i < 3; i++) {
95 auto &box_geo = *system.
box_geo;
113 <<
"your choice of piston= " <<
nptiso.
piston <<
", dt= " << time_step
115 <<
" just caused the volume to become negative, decrease dt";
123 scal[0] = 1. / scal[1];
125 boost::mpi::broadcast(
comm_cart, scal, 0);
128 for (
auto &p : particles) {
129 for (
unsigned int j = 0; j < 3; j++) {
130 if (!p.is_fixed_along(j)) {
132 p.pos()[j] = scal[1] * (p.pos()[j] + scal[2] * p.v()[j] * time_step);
133 p.pos_at_last_verlet_update()[j] *= scal[1];
136 p.pos()[j] += p.v()[j] * time_step;
149 new_box = box_geo.length();
151 for (
unsigned int i = 0; i < 3; i++) {
158 boost::mpi::broadcast(
comm_cart, new_box, 0);
160 box_geo.set_length(new_box);
171 for (
auto &p : particles) {
172 for (
unsigned int j = 0; j < 3; j++) {
173 if (!p.is_fixed_along(j)) {
174 auto const noise = friction_therm0_nptiso<1>(npt_iso, p.v(), p.id());
176 p.v()[j] += (p.force()[j] * time_step / 2.0 + noise[j]) / p.mass();
180 p.v()[j] += p.force()[j] * time_step / 2.0 / p.mass();
Vector implementation and trait types for boost qvm interoperability.
void on_boxl_change(bool skip_method_adaption=false)
Called when the box length has changed.
std::shared_ptr< CellStructure > cell_structure
std::shared_ptr< BoxGeometry > box_geo
boost::mpi::communicator comm_cart
The communicator.
int this_node
The number of this node.
This file contains the defaults for ESPResSo.
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.
Exports for the NpT code.
double friction_thermV_nptiso(IsotropicNptThermostat const &npt_iso, double p_diff)
Add p_diff-dependent noise and friction for NpT-sims to NptIsoParameters::p_diff.
Thermostat for isotropic NPT dynamics.
double inv_piston
inverse of piston
int geometry
geometry information for the NpT integrator.
Utils::Vector3d p_vir
virial (short-range) components of p_inst
double p_ext
desired pressure to which the algorithm strives to
bool cubic_box
Set this flag if you want all box dimensions to be identical.
int non_const_dim
An index to one of the non-constant dimensions.
double p_diff
difference between p_ext and p_inst
double p_inst
instantaneous pressure the system currently has
Utils::Vector3d p_vel
ideal gas components of p_inst, derived from the velocities
int dimension
The number of dimensions in which NpT boxlength motion is coupled to particles.
double piston
mass of a virtual piston representing the shaken box
double volume
isotropic volume.
void velocity_verlet_npt_step_2(ParticleRangeNPT const &particles, IsotropicNptThermostat const &npt_iso, double time_step)
Final integration step of the Velocity Verlet+NpT integrator.
void velocity_verlet_npt_step_1(ParticleRangeNPT const &particles, IsotropicNptThermostat const &npt_iso, double time_step, System::System &system)
Special propagator for NpT isotropic.
static constexpr Utils::Vector3i nptgeom_dir
static void velocity_verlet_npt_propagate_pos(ParticleRangeNPT const &particles, IsotropicNptThermostat const &npt_iso, double time_step, System::System &system)
static void velocity_verlet_npt_finalize_p_inst(IsotropicNptThermostat const &npt_iso, double time_step)
Scale and communicate instantaneous NpT pressure.
static void velocity_verlet_npt_propagate_vel(ParticleRangeNPT const &particles, IsotropicNptThermostat const &npt_iso, double time_step)
static void velocity_verlet_npt_propagate_vel_final(ParticleRangeNPT const &particles, IsotropicNptThermostat const &npt_iso, double time_step)