ESPResSo
Extensible Simulation Package for Research on Soft Matter Systems
Loading...
Searching...
No Matches
velocity_verlet_npt.hpp
Go to the documentation of this file.
1/*
2 * Copyright (C) 2010-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#pragma once
21
22#include <config/config.hpp>
23
24#ifdef ESPRESSO_NPT
25
26#include "PropagationMode.hpp"
28#include "npt.hpp"
29#include "system/System.hpp"
30#include "thermostat.hpp"
31
32#include <utils/math/sqr.hpp>
33
35 int modes;
42
43 bool operator()(int prop) const { return (prop & modes); }
44};
45
47
48/** Special propagator for NpT isotropic for Andersen method.
49 * Propagate the velocities and positions. Integration steps before force
50 * calculation of the Velocity Verlet integrator:
51 * \f[ v(t+0.5 \Delta t) = v(t) + 0.5 \Delta t \cdot F(t)/m \f]
52 * \f[ x(t+\Delta t) = x(t) + \Delta t \cdot v(t+0.5 \Delta t) \f]
53 *
54 * Propagate pressure, box_length (2 times) and positions, rescale
55 * positions and velocities and check Verlet list criterion (only NpT).
56 */
58 IsotropicNptThermostat const &npt_iso,
59 double time_step,
60 System::System &system);
61/** Special propagator for NpT isotropic for MTK approach. */
63 IsotropicNptThermostat const &npt_iso,
64 double time_step, System::System &system);
65
66/** Final integration step of the Velocity Verlet+NpT integrator for Andersen
67 * method. Finalize instantaneous pressure calculation:
68 * \f[ v(t+\Delta t) = v(t+0.5 \Delta t)
69 * + 0.5 \Delta t \cdot F(t+\Delta t)/m \f]
70 */
72 double time_step,
73 System::System &system);
74/** Final integration step of the Velocity Verlet+NpT integrator for Andersen
75 * method. */
77 double time_step, System::System &system);
78
79/**
80 * @brief Propagate the particle's velocity.
81 * @f$ v(t+dt) = v(t+0.5*dt) + 0.5*dt * a(t+dt) @f$
82 */
84 NptIsoParameters const &nptiso, InstantaneousPressure &npt_inst_pressure,
85 ParticleRangeNPT const &particles, double time_step) {
86
87 npt_inst_pressure.p_vel = {};
88 for (auto &p : particles) {
89 for (auto j = 0u; j < 3u; ++j) {
90 if (!p.is_fixed_along(j)) {
92 npt_inst_pressure.p_vel[j] += Utils::sqr(p.v()[j]) * p.mass();
93 }
94 p.v()[j] += p.force()[j] * time_step / (2. * p.mass());
95 }
96 }
97 }
98}
99
100/**
101 * @brief Propagate the particle's velocity.
102 * @f$ v(t+0.5*dt) = v(t) + 0.5*dt * a(t) @f$
103 */
105 NptIsoParameters const &nptiso, InstantaneousPressure &npt_inst_pressure,
106 ParticleRangeNPT const &particles, double time_step) {
107 npt_inst_pressure.p_vel = {};
108
109 for (auto &p : particles) {
110 for (auto j = 0u; j < 3u; ++j) {
111 if (!p.is_fixed_along(j)) {
112 p.v()[j] += p.force()[j] * time_step / (2. * p.mass());
113 if (nptiso.geometry & NptIsoParameters::nptgeom_dir[j]) {
114 npt_inst_pressure.p_vel[j] += Utils::sqr(p.v()[j]) * p.mass();
115 }
116 }
117 }
118 }
119}
120
121#endif // ESPRESSO_NPT
Main system class.
DEVICE_QUALIFIER constexpr T sqr(T x)
Calculates the SQuaRe of x.
Definition sqr.hpp:28
Exports for the NpT code.
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
Thermostat for isotropic NPT dynamics.
Parameters of the isotropic NpT-integration scheme.
Definition npt.hpp:42
int geometry
geometry information for the NpT integrator.
Definition npt.hpp:72
static constexpr std::array< int, 3 > nptgeom_dir
Definition npt.hpp:88
PropagationPredicateNPT(int default_propagation)
bool operator()(int prop) const
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.
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.
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.
void velocity_verlet_npt_Andersen_step_1(ParticleRangeNPT const &particles, IsotropicNptThermostat const &npt_iso, double time_step, System::System &system)
Special propagator for NpT isotropic for 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 for Andersen method.