ESPResSo
Extensible Simulation Package for Research on Soft Matter Systems
Loading...
Searching...
No Matches
sd_interface.hpp
Go to the documentation of this file.
1/*
2 * Copyright (C) 2010-2025 The ESPResSo project
3 *
4 * This file is part of ESPResSo.
5 *
6 * ESPResSo is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * ESPResSo is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20#pragma once
21
22/** @file
23 * See @cite durlofsky87a for the Stokesian dynamics method used here.
24 * See @cite banchio03a and @cite brady88a for the thermalization method.
25 */
26
27#include <config/config.hpp>
28
29#ifdef ESPRESSO_STOKESIAN_DYNAMICS
30
31#include "PropagationMode.hpp"
33#include "thermostat.hpp"
34
35#include <unordered_map>
36
38 int modes;
45
46 bool operator()(int prop) const { return (prop & modes); }
47};
48
51
53 double viscosity = 0.;
54 std::unordered_map<int, double> radii = {};
55 int flags = 0;
56 StokesianDynamics() = default;
57 StokesianDynamics(double viscosity, std::unordered_map<int, double> radii,
58 int flags);
59
60 /**
61 * Take the forces and torques on all particles and compute velocities.
62 * Act globally on particles on all nodes; i.e. particle data is
63 * gathered from all nodes and their velocities and angular velocities
64 * are set according to the Stokesian Dynamics method.
65 */
66 void propagate_vel_pos(ParticleRangeStokesian const &particles,
67 StokesianThermostat const &stokesian, double time_step,
68 double kT) const;
69
70private:
71 /**
72 * Buffer that holds the (translational and angular) velocities of the local
73 * particles on each node, used for returning results.
74 */
75 mutable std::vector<double> v_sd = {};
76 mutable std::vector<double> x_host = {};
77 mutable std::vector<double> f_host = {};
78 mutable std::vector<double> a_host = {};
79};
80
81enum class sd_flags : int {
82 NONE = 0,
83 SELF_MOBILITY = 1 << 0,
84 PAIR_MOBILITY = 1 << 1,
85 LUBRICATION = 1 << 2,
86 FTS = 1 << 3
87};
88
89#endif // ESPRESSO_STOKESIAN_DYNAMICS
sd_flags
bool operator()(int prop) const
PropagationPredicateStokesian(int default_propagation)
StokesianDynamics()=default
void propagate_vel_pos(ParticleRangeStokesian const &particles, StokesianThermostat const &stokesian, double time_step, double kT) const
Take the forces and torques on all particles and compute velocities.
std::unordered_map< int, double > radii
Thermostat for Stokesian dynamics.