ESPResSo
Extensible Simulation Package for Research on Soft Matter Systems
Loading...
Searching...
No Matches
thermalized_bond.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#pragma once
23
24/** \file
25 * Routines to thermalize the center of mass and distance of a particle pair.
26 */
27
28#include "Particle.hpp"
29
30#include <utils/Vector.hpp>
31
32#include <cassert>
33#include <cmath>
34#include <memory>
35#include <optional>
36#include <tuple>
37
38namespace Thermostat {
39class Thermostat;
40}
41
42/** Parameters for Thermalized bond */
44 double temp_com;
45 double gamma_com;
48 double r_cut;
49 double pref1_com;
50 double pref2_com;
51 double pref1_dist;
52 double pref2_dist;
53
54 double cutoff() const { return r_cut; }
55
56 static constexpr int num = 1;
57
59 double gamma_distance, double r_cut) {
60 this->temp_com = temp_com;
61 this->gamma_com = gamma_com;
62 this->temp_distance = temp_distance;
63 this->gamma_distance = gamma_distance;
64 this->r_cut = r_cut;
65
66 pref1_com = -1.;
67 pref2_com = -1.;
68 pref1_dist = -1.;
69 pref2_dist = -1.;
70 }
71
72 void recalc_prefactors(double time_step) {
74 pref2_com = std::sqrt(24. * gamma_com / time_step * temp_com);
76 pref2_dist = std::sqrt(24. * gamma_distance / time_step * temp_distance);
77 }
78
80 std::weak_ptr<Thermostat::Thermostat const> const &thermostat) {
81 m_thermostat = thermostat;
82 }
83
84 void unset_thermostat_view() { m_thermostat.reset(); }
85
86 std::optional<std::tuple<Utils::Vector3d, Utils::Vector3d>>
87 forces(Particle const &p1, Particle const &p2,
88 Utils::Vector3d const &dx) const;
89
90private:
91 std::weak_ptr<Thermostat::Thermostat const> m_thermostat;
92};
Vector implementation and trait types for boost qvm interoperability.
Struct holding all information for one particle.
Definition Particle.hpp:395
Parameters for Thermalized bond.
ThermalizedBond(double temp_com, double gamma_com, double temp_distance, double gamma_distance, double r_cut)
static constexpr int num
void set_thermostat_view(std::weak_ptr< Thermostat::Thermostat const > const &thermostat)
double cutoff() const
std::optional< std::tuple< Utils::Vector3d, Utils::Vector3d > > forces(Particle const &p1, Particle const &p2, Utils::Vector3d const &dx) const
Separately thermalizes the com and distance of a particle pair.
void recalc_prefactors(double time_step)