29#include "communication.hpp"
35#include <boost/mpi/collectives.hpp>
53 npt_inst_pressure.
p_inst = {0., 0.};
55 for (
auto i = 0u; i < 3u; ++i) {
57 npt_inst_pressure.
p_inst[0] +=
58 npt_inst_pressure.
p_vir[i] + npt_inst_pressure.
p_vel[i];
59 npt_inst_pressure.
p_inst[1] += npt_inst_pressure.
p_vir[i];
65 std::plus<Utils::Vector2d>(), 0);
71 (npt_inst_pressure.
p_inst[0] - nptiso.
p_ext) * 1.5 *
75 (p_sum[0] - p_sum[1]) *
87 for (
auto &p : particles) {
88 for (
auto j = 0u; j < 3u; ++j) {
89 if (!p.is_fixed_along(j)) {
90 p.pos()[j] = p.pos()[j] + p.v()[j] * 0.5 * time_step;
102 auto const propagator =
105 for (
auto &p : particles) {
106 for (
auto j = 0u; j < 3u; ++j) {
107 if (!p.is_fixed_along(j)) {
109 p.pos()[j] *= propagator;
128 auto &box_geo = *system.
box_geo;
130 auto &nptiso = *system.
nptiso;
141 for (
auto &p : particles) {
144 for (
unsigned int j = 0; j < 3; j++) {
145 if (!p.is_fixed_along(j)) {
147 p.v()[j] = v_therm[j];
163 std::exp(1.5 * nptiso.inv_piston * nptiso.p_epsilon * time_step);
166 std::exp(1.5 * nptiso.inv_piston * nptiso.p_epsilon * time_step);
167 L_new = pow(nptiso.volume, 1.0 / nptiso.dimension);
181 new_box = box_geo.length();
182 for (
auto i = 0u; i < 3u; ++i) {
183 if (nptiso.cubic_box ||
192 box_geo.set_length(new_box);
205 npt_inst_pressure.
p_vel = {};
206 auto const propagater =
209 for (
auto &p : particles) {
210 for (
auto j = 0u; j < 3u; ++j) {
211 if (!p.is_fixed_along(j)) {
213 p.v()[j] *= propagater;
224 auto &nptiso = *system.
nptiso;
236 auto &nptiso = *system.
nptiso;
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< InstantaneousPressure > npt_inst_pressure
std::shared_ptr< NptIsoParameters > nptiso
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 errorhandling code for severe errors, like a broken bond or illegal parameter ...
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.
std::size_t particle_number
number of particles
int geometry
geometry information for the NpT integrator.
static constexpr std::array< int, 3 > nptgeom_dir
double half_dt_inv_piston_and_Nf
the coefficient of propagater of momentum for MTK equation
double half_dt_inv_piston
the coefficient of propagater of position for MTK equation
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(NptIsoParameters const &nptiso, InstantaneousPressure &npt_inst_pressure, ParticleRangeNPT const &particles, double time_step)
Propagate the particle's velocity.
void velocity_verlet_npt_MTK_step_1(ParticleRangeNPT const &particles, IsotropicNptThermostat const &npt_iso, double time_step, System::System &system)
Special propagator for NpT isotropic for MTK approach.
static void velocity_verlet_npt_propagate_vel_MTK(NptIsoParameters const &nptiso, InstantaneousPressure &npt_inst_pressure, ParticleRangeNPT const &particles)
static void velocity_verlet_npt_propagate_p_eps(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_MTK(ParticleRangeNPT const &particles, IsotropicNptThermostat const &npt_iso, double time_step, System::System &system)
propagete positions and the volume and add thermal fluctuation.
static void velocity_verlet_npt_propagate_pos_MTK(NptIsoParameters &nptiso, ParticleRangeNPT const &particles)
static constexpr Utils::Vector3i nptgeom_dir
void velocity_verlet_npt_MTK_step_2(ParticleRangeNPT const &particles, double time_step, System::System &system)
Final integration step of the Velocity Verlet+NpT integrator for Andersen method.
static void velocity_verlet_npt_propagate_pos(ParticleRangeNPT const &particles, double time_step)