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-2026 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
"
32
#include "
PropagationPredicate.hpp
"
33
#include "thermostat.hpp"
34
35
#include <unordered_map>
36
37
struct
PropagationPredicateStokesian
{
38
int
modes
;
39
PropagationPredicateStokesian
(
int
default_propagation) {
40
modes
=
PropagationMode::TRANS_STOKESIAN
;
41
if
(default_propagation &
PropagationMode::TRANS_STOKESIAN
) {
42
modes
|=
PropagationMode::SYSTEM_DEFAULT
;
43
}
44
}
45
46
bool
operator()
(
int
prop)
const
{
return
(prop &
modes
); }
47
};
48
49
using
ParticleRangeStokesian
=
50
ParticleRangeFiltered<PropagationPredicateStokesian>
;
51
52
struct
StokesianDynamics
{
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
void
sanity_checks
(
ParticleRangeStokesian
const
&particles)
const
;
70
71
private
:
72
/**
73
* Buffer that holds the (translational and angular) velocities of the local
74
* particles on each node, used for returning results.
75
*/
76
mutable
std::vector<double> v_sd = {};
77
mutable
std::vector<double> x_host = {};
78
mutable
std::vector<double> f_host = {};
79
mutable
std::vector<double> a_host = {};
80
};
81
82
enum class
sd_flags
:
int
{
83
NONE
= 0,
84
SELF_MOBILITY
= 1 << 0,
85
PAIR_MOBILITY
= 1 << 1,
86
LUBRICATION
= 1 << 2,
87
FTS
= 1 << 3
88
};
89
90
#endif
// ESPRESSO_STOKESIAN_DYNAMICS
PropagationMode.hpp
PropagationPredicate.hpp
ParticleRangeFiltered
Definition
PropagationPredicate.hpp:40
config.hpp
PropagationMode::TRANS_STOKESIAN
@ TRANS_STOKESIAN
Definition
PropagationMode.hpp:34
PropagationMode::SYSTEM_DEFAULT
@ SYSTEM_DEFAULT
Definition
PropagationMode.hpp:26
sd_flags
sd_flags
Definition
sd_interface.hpp:82
sd_flags::NONE
@ NONE
sd_flags::LUBRICATION
@ LUBRICATION
sd_flags::PAIR_MOBILITY
@ PAIR_MOBILITY
sd_flags::SELF_MOBILITY
@ SELF_MOBILITY
sd_flags::FTS
@ FTS
PropagationPredicateStokesian
Definition
sd_interface.hpp:37
PropagationPredicateStokesian::modes
int modes
Definition
sd_interface.hpp:38
PropagationPredicateStokesian::operator()
bool operator()(int prop) const
Definition
sd_interface.hpp:46
PropagationPredicateStokesian::PropagationPredicateStokesian
PropagationPredicateStokesian(int default_propagation)
Definition
sd_interface.hpp:39
StokesianDynamics
Definition
sd_interface.hpp:52
StokesianDynamics::flags
int flags
Definition
sd_interface.hpp:55
StokesianDynamics::StokesianDynamics
StokesianDynamics()=default
StokesianDynamics::propagate_vel_pos
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.
Definition
sd_interface.cpp:137
StokesianDynamics::viscosity
double viscosity
Definition
sd_interface.hpp:53
StokesianDynamics::sanity_checks
void sanity_checks(ParticleRangeStokesian const &particles) const
Definition
sd_interface.cpp:117
StokesianDynamics::radii
std::unordered_map< int, double > radii
Definition
sd_interface.hpp:54
StokesianThermostat
Thermostat for Stokesian dynamics.
Definition
core/thermostat.hpp:374
src
core
stokesian_dynamics
sd_interface.hpp
Generated on Mon Sep 7 2026 01:24:52 for ESPResSo by
1.9.8