Loading [MathJax]/extensions/TeX/AMSmath.js
ESPResSo
Extensible Simulation Package for Research on Soft Matter Systems
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages Concepts
npt_inline.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
22#ifndef THERMOSTATS_NPT_INLINE_HPP
23#define THERMOSTATS_NPT_INLINE_HPP
24
25#include "config/config.hpp"
26
27#ifdef NPT
28
29#include "random.hpp"
30#include "thermostat.hpp"
31
32#include <utils/Vector.hpp>
33
34#include <cstddef>
35
36/** Add velocity-dependent noise and friction for NpT-sims to the particle's
37 * velocity;
38 * @f$ p(t) = p(t) \exp(- \gamma_0 dt / m)
39 * + \sqrt{k_B T (1 - \exp(-2 \gamma_0 dt)}N(0,1) @f$
40 *
41 * @param npt_iso Parameters
42 * @param vel particle velocity
43 * @param mass particle mass
44 * @param p_identity particle identity
45 * @return velocity added noise
46 */
47inline Utils::Vector3d
49 Utils::Vector3d const &vel, double mass,
50 int p_identity) {
51 if (npt_iso.gamma0 > 0.0) {
52 return npt_iso.pref_rescale_0.at(mass) * vel +
53 npt_iso.pref_noise_0.at(mass) *
54 Random::noise_gaussian<RNGSalt::NPTISO_PARTICLE>(
55 npt_iso.rng_counter(), npt_iso.rng_seed(), p_identity);
56 }
57 return npt_iso.pref_rescale_0.at(mass) * vel;
58}
59
60/** Added noise and friction for NpT-sims to \ref NptIsoParameters::p_epsilon;
61 * @f$ p_{\epsilon} = p_{epsilon}(t) \exp(- \gamma_V dt / W)
62 * + \sqrt{k_B T (1 - \exp(-2 \gamma_V dt / W)}N(0,1) @f$
63 *
64 * @param npt_iso Parameters
65 * @param p_epsilon conjugate momentum of volume
66 * @param piston piston mass
67 * @return conjugate momentum of volume added noise
68 */
70 double p_epsilon, double piston) {
71 if (npt_iso.gammav > 0.0) {
72 return npt_iso.pref_rescale_V * p_epsilon +
73 npt_iso.pref_noise_V *
74 Random::noise_gaussian<RNGSalt::NPTISO_VOLUME, 1>(
75 npt_iso.rng_counter(), npt_iso.rng_seed(), 0)[0];
76 }
77 return npt_iso.pref_rescale_V * p_epsilon;
78}
79
80#endif // NPT
81#endif
Vector implementation and trait types for boost qvm interoperability.
cudaStream_t stream[1]
CUDA streams for parallel computing on CPU and GPU.
This file contains the defaults for ESPResSo.
double propagate_thermV_nptiso(IsotropicNptThermostat const &npt_iso, double p_epsilon, double piston)
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; .
Random number generation using Philox.
uint64_t rng_counter() const
Get current value of the RNG.
uint32_t rng_seed() const
Thermostat for isotropic NPT dynamics.
std::unordered_map< double, double > pref_noise_0
Particle velocity rescaling noise standard deviation for Orstein-Uhlenbeck equation.
double pref_rescale_V
Volume rescaling at half the time step.
double gamma0
Friction coefficient of the particles .
double gammav
Friction coefficient for the box .
double pref_noise_V
Volume rescaling noise standard deviation for Orstein-Uhlenbeck equation Stores .
std::unordered_map< double, double > pref_rescale_0
Particle velocity rescaling at the time step for Orstein-Uhlenbeck equation.