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"
33#include "npt.hpp"
34#include "system/System.hpp"
35#include "thermostat.hpp"
36
37#include <variant>
38
39#include <ranges>
40
42 if (thermalized_bond) {
43 thermalized_bond->recalc_prefactors(time_step, *(get_system().bonded_ias));
44 }
45 if (langevin) {
46 langevin->recalc_prefactors(kT, time_step);
47 }
48 if (brownian) {
49 brownian->recalc_prefactors(kT);
50 }
51#ifdef ESPRESSO_DPD
52 if (dpd) {
53 get_system().nonbonded_ias->dpd_init(kT, time_step);
54 }
55#endif
56#ifdef ESPRESSO_NPT
57 if (npt_iso) {
58 npt_iso->recalc_prefactors(kT, get_system().nptiso->piston,
59 get_system().nptiso->mass_list, time_step);
60 }
61#endif
62}
63
65 if (thermo_switch & THERMO_LANGEVIN) {
66 langevin->rng_increment();
67 }
68 if (thermo_switch & THERMO_BROWNIAN) {
69 brownian->rng_increment();
70 }
71#ifdef ESPRESSO_NPT
72 if (thermo_switch & THERMO_NPT_ISO) {
73 npt_iso->rng_increment();
74 }
75#endif
76#ifdef ESPRESSO_DPD
77 if (thermo_switch & THERMO_DPD) {
78 dpd->rng_increment();
79 }
80#endif
81#ifdef ESPRESSO_STOKESIAN_DYNAMICS
82 if (thermo_switch & THERMO_SD) {
83 stokesian->rng_increment();
84 }
85#endif
86 if (thermo_switch & THERMO_BOND) {
87 thermalized_bond->rng_increment();
88 }
89}
90
92 if (lb) {
93 if (get_system().lb.is_solver_set() and ::comm_cart.rank() == 0 and
94 lb->gamma > 0.) {
96 << "Recalculating forces, so the LB coupling forces are not "
97 "included in the particle force the first time step. This "
98 "only matters if it happens frequently during sampling.";
99 }
100 lb->couple_to_md = false;
101 }
102}
103
105 double time_step, BondedInteractionsMap &bonded_ias) {
106 for (auto &handle : std::views::elements<1>(bonded_ias)) {
107 if (auto *bond = std::get_if<ThermalizedBond>(handle.get())) {
108 bond->recalc_prefactors(time_step);
109 }
110 }
111}
@ THERMO_SD
@ THERMO_BROWNIAN
@ THERMO_BOND
@ THERMO_LANGEVIN
@ THERMO_DPD
@ THERMO_NPT_ISO
Data structures for bonded interactions.
container for bonded interactions.
std::shared_ptr< InteractionsNonBonded > nonbonded_ias
void philox_counter_increment()
Increment RNG counters.
void recalc_prefactors(double time_step)
Initialize constants of all thermostats.
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()
Various procedures concerning interactions between particles.
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.