ESPResSo
Extensible Simulation Package for Research on Soft Matter Systems
Loading...
Searching...
No Matches
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);
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, nptiso.piston, time_step);
56 }
57#endif
58}
59
61 if (thermo_switch & THERMO_LANGEVIN) {
62 langevin->rng_increment();
63 }
64 if (thermo_switch & THERMO_BROWNIAN) {
65 brownian->rng_increment();
66 }
67#ifdef NPT
68 if (thermo_switch & THERMO_NPT_ISO) {
69 npt_iso->rng_increment();
70 }
71#endif
72#ifdef DPD
73 if (thermo_switch & THERMO_DPD) {
74 dpd->rng_increment();
75 }
76#endif
77#ifdef STOKESIAN_DYNAMICS
78 if (thermo_switch & THERMO_SD) {
79 stokesian->rng_increment();
80 }
81#endif
82 if (thermo_switch & THERMO_BOND) {
83 thermalized_bond->rng_increment();
84 }
85}
86
88 if (lb) {
89 if (get_system().lb.is_solver_set() and ::comm_cart.rank() == 0 and
90 lb->gamma > 0.) {
92 << "Recalculating forces, so the LB coupling forces are not "
93 "included in the particle force the first time step. This "
94 "only matters if it happens frequently during sampling.";
95 }
96 lb->couple_to_md = false;
97 }
98}
99
101 for (auto &kv : ::bonded_ia_params) {
102 if (auto *bond = boost::get<ThermalizedBond>(&(*kv.second))) {
103 bond->recalc_prefactors(time_step);
104 }
105 }
106}
@ THERMO_SD
@ THERMO_BROWNIAN
@ THERMO_BOND
@ THERMO_LANGEVIN
@ THERMO_DPD
@ THERMO_NPT_ISO
BondedInteractionsMap bonded_ia_params
Field containing the parameters of the bonded ia types.
Data structures 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:64
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()
NptIsoParameters nptiso
Definition npt.cpp:42
Exports for the NpT code.
double piston
mass of a virtual piston representing the shaken box
Definition npt.hpp:39
void recalc_prefactors(double time_step)
Routines to thermalize the center of mass and distance of a particle pair.