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 <boost/optional.hpp>
33
34#include <cmath>
35#include <tuple>
36
37/** Parameters for Thermalized bond */
39 double temp_com;
40 double gamma_com;
43 double r_cut;
44 double pref1_com;
45 double pref2_com;
46 double pref1_dist;
47 double pref2_dist;
48
49 double cutoff() const { return r_cut; }
50
51 static constexpr int num = 1;
52
54 double gamma_distance, double r_cut) {
55 this->temp_com = temp_com;
56 this->gamma_com = gamma_com;
57 this->temp_distance = temp_distance;
58 this->gamma_distance = gamma_distance;
59 this->r_cut = r_cut;
60
61 pref1_com = -1.;
62 pref2_com = -1.;
63 pref1_dist = -1.;
64 pref2_dist = -1.;
65 }
66
67 void recalc_prefactors(double time_step) {
69 pref2_com = std::sqrt(24. * gamma_com / time_step * temp_com);
71 pref2_dist = std::sqrt(24. * gamma_distance / time_step * temp_distance);
72 }
73
74 boost::optional<std::tuple<Utils::Vector3d, Utils::Vector3d>>
75 forces(Particle const &p1, Particle const &p2,
76 Utils::Vector3d const &dx) const;
77
78private:
79 friend boost::serialization::access;
80 template <typename Archive>
81 void serialize(Archive &ar, long int /* version */) {
82 ar & temp_com;
83 ar & gamma_com;
84 ar & temp_distance;
85 ar & gamma_distance;
86 ar & r_cut;
87 ar & pref1_com;
88 ar & pref2_com;
89 ar & pref1_dist;
90 ar & pref2_dist;
91 }
92};
Vector implementation and trait types for boost qvm interoperability.
Struct holding all information for one particle.
Definition Particle.hpp:393
Parameters for Thermalized bond.
ThermalizedBond(double temp_com, double gamma_com, double temp_distance, double gamma_distance, double r_cut)
boost::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.
static constexpr int num
double cutoff() const
void recalc_prefactors(double time_step)