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
thermostat.cpp
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/** \file
22 * Implementation of \ref thermostat.hpp.
23 */
24
25#include "config/config.hpp"
26
29#include "communication.hpp"
30#include "dpd.hpp"
31#include "errorhandling.hpp"
32#include "npt.hpp"
33#include "system/System.hpp"
34#include "thermostat.hpp"
35
36#include <boost/variant.hpp>
37
39 if (thermalized_bond) {
40 thermalized_bond->recalc_prefactors(time_step, *(get_system().bonded_ias));
41 }
42 if (langevin) {
43 langevin->recalc_prefactors(kT, time_step);
44 }
45 if (brownian) {
46 brownian->recalc_prefactors(kT);
47 }
48#ifdef DPD
49 if (dpd) {
50 dpd_init(kT, time_step);
51 }
52#endif
53#ifdef NPT
54 if (npt_iso) {
55 npt_iso->recalc_prefactors(kT, get_system().nptiso->piston,
56 get_system().nptiso->mass_list, time_step);
57 }
58#endif
59}
60
62 if (thermo_switch & THERMO_LANGEVIN) {
63 langevin->rng_increment();
64 }
65 if (thermo_switch & THERMO_BROWNIAN) {
66 brownian->rng_increment();
67 }
68#ifdef NPT
69 if (thermo_switch & THERMO_NPT_ISO) {
70 npt_iso->rng_increment();
71 }
72#endif
73#ifdef DPD
74 if (thermo_switch & THERMO_DPD) {
75 dpd->rng_increment();
76 }
77#endif
78#ifdef STOKESIAN_DYNAMICS
79 if (thermo_switch & THERMO_SD) {
80 stokesian->rng_increment();
81 }
82#endif
83 if (thermo_switch & THERMO_BOND) {
84 thermalized_bond->rng_increment();
85 }
86}
87
89 if (lb) {
90 if (get_system().lb.is_solver_set() and ::comm_cart.rank() == 0 and
91 lb->gamma > 0.) {
93 << "Recalculating forces, so the LB coupling forces are not "
94 "included in the particle force the first time step. This "
95 "only matters if it happens frequently during sampling.";
96 }
97 lb->couple_to_md = false;
98 }
99}
100
102 double time_step, BondedInteractionsMap &bonded_ias) {
103 for (auto &kv : bonded_ias) {
104 if (auto *bond = boost::get<ThermalizedBond>(&(*kv.second))) {
105 bond->recalc_prefactors(time_step);
106 }
107 }
108}
@ THERMO_SD
@ THERMO_BROWNIAN
@ THERMO_BOND
@ THERMO_LANGEVIN
@ THERMO_DPD
@ THERMO_NPT_ISO
Data structures for bonded interactions.
container for bonded interactions.
void philox_counter_increment()
Increment RNG counters.
void recalc_prefactors(double time_step)
Initialize constants of all thermostats.
This file contains the defaults for ESPResSo.
void dpd_init(double kT, double time_step)
Definition dpd.cpp:63
Routines to use DPD as thermostat or pair force .
This file contains the errorhandling code for severe errors, like a broken bond or illegal parameter ...
#define runtimeWarningMsg()
Exports for the NpT code.
void recalc_prefactors(double time_step, BondedInteractionsMap &bonded_ias)
Routines to thermalize the center of mass and distance of a particle pair.