ESPResSo
Extensible Simulation Package for Research on Soft Matter Systems
Loading...
Searching...
No Matches
dpd.hpp
Go to the documentation of this file.
1/*
2 * Copyright (C) 2010-2026 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 use DPD as thermostat or pair force @cite soddemann03a
26 *
27 * Implementation in @ref dpd.cpp.
28 */
29
30#include <config/config.hpp>
31
32#ifdef ESPRESSO_DPD
33
34#include "BoxGeometry.hpp"
35#include "Particle.hpp"
37#include "system/System.hpp"
38#include "thermostat.hpp"
39
40#include <utils/Vector.hpp>
41
42#include <cmath>
43
44// Forward declaration
45namespace boost::mpi {
46class communicator;
47}
48
50 Utils::Vector3d const &v, double dist,
51 Utils::Vector3d const &noise) {
52 if (dist < params.cutoff) {
53 auto const r_cut = params.cutoff;
54 auto const calc_xk = [&]() {
55 auto const x = dist / r_cut;
56 if (params.k == 1.)
57 return x;
58 if (params.k == 2.)
59 return x * x;
60 return std::pow(x, params.k);
61 };
62 auto const omega = params.wf ? 1. - calc_xk() : 1.;
63 auto const f_d = params.gamma * (omega * omega) * v;
64 auto const f_r = params.pref * omega * noise;
65 return f_r - f_d;
66 }
67 return {};
68}
69
71 Utils::Vector3d const &p1_position, Utils::Vector3d const &p1_velocity,
72 int p1_id, Utils::Vector3d const &p2_position,
73 Utils::Vector3d const &p2_velocity, int p2_id, DPDThermostat const &dpd,
74 BoxGeometry const &box_geo, IA_parameters const &ia_params,
75 Utils::Vector3d const &d, double dist, double dist2);
76
78 boost::mpi::communicator const &comm);
79
80/**
81 * @brief Local contribution to the pressure tensor.
82 * Needs to be rescaled by the box volume.
83 */
85
86#endif // ESPRESSO_DPD
Vector implementation and trait types for boost qvm interoperability.
Main system class.
Communicator communicator
Utils::Vector3d dpd_pair_force(DPDParameters const &params, Utils::Vector3d const &v, double dist, Utils::Vector3d const &noise)
Definition dpd.hpp:49
Utils::Vector9d dpd_stress(System::System &system, boost::mpi::communicator const &comm)
Viscous stress tensor of the DPD interaction.
Definition dpd.cpp:154
Utils::Vector9d dpd_pressure_local(System::System &system)
Local contribution to the pressure tensor.
Definition dpd.cpp:134
Various procedures concerning interactions between particles.
Thermostat for dissipative particle dynamics.
Parameters for non-bonded interactions.