ESPResSo
Extensible Simulation Package for Research on Soft Matter Systems
Loading...
Searching...
No Matches
LeesEdwardsBC.hpp
Go to the documentation of this file.
1
/*
2
* Copyright (C) 2021-2022 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
#include <
utils/Vector.hpp
>
23
24
#include <bitset>
25
#include <cmath>
26
#include <initializer_list>
27
28
struct
LeesEdwardsBC
{
29
static
auto
constexpr
invalid_dir
= 3u;
30
double
pos_offset
= 0.;
31
double
shear_velocity
= 0.;
32
unsigned
int
shear_direction
=
invalid_dir
;
33
unsigned
int
shear_plane_normal
=
invalid_dir
;
34
Utils::Vector3d
distance
(
Utils::Vector3d
const
&d,
Utils::Vector3d
const
&l,
35
Utils::Vector3d
const
&,
36
Utils::Vector3d
const
&l_inv,
37
std::bitset<3>
const
periodic)
const
{
38
39
Utils::Vector3d
n_jumps{};
40
Utils::Vector3d
res = d;
41
42
auto
const
le_plane_normal =
static_cast<
unsigned
int
>
(
shear_plane_normal
);
43
auto
const
le_direction =
static_cast<
unsigned
int
>
(
shear_direction
);
44
auto
const
n_le_crossings =
45
std::round(res[le_plane_normal] * l_inv[le_plane_normal]);
46
if
(n_le_crossings >= 1.)
47
res[le_direction] +=
pos_offset
;
48
if
(n_le_crossings <= -1.)
49
res[le_direction] -=
pos_offset
;
50
51
for
(
auto
const
i : {0u, 1u, 2u}) {
52
if
(periodic[i]) {
53
n_jumps[i] = std::round(res[i] * l_inv[i]);
54
res[i] -= n_jumps[i] * l[i];
55
}
56
}
57
58
return
res;
59
}
60
};
Vector.hpp
Vector implementation and trait types for boost qvm interoperability.
Utils::Vector
Definition
Vector.hpp:48
LeesEdwardsBC
Definition
LeesEdwardsBC.hpp:28
LeesEdwardsBC::invalid_dir
static auto constexpr invalid_dir
Definition
LeesEdwardsBC.hpp:29
LeesEdwardsBC::shear_velocity
double shear_velocity
Definition
LeesEdwardsBC.hpp:31
LeesEdwardsBC::pos_offset
double pos_offset
Definition
LeesEdwardsBC.hpp:30
LeesEdwardsBC::shear_plane_normal
unsigned int shear_plane_normal
Definition
LeesEdwardsBC.hpp:33
LeesEdwardsBC::distance
Utils::Vector3d distance(Utils::Vector3d const &d, Utils::Vector3d const &l, Utils::Vector3d const &, Utils::Vector3d const &l_inv, std::bitset< 3 > const periodic) const
Definition
LeesEdwardsBC.hpp:34
LeesEdwardsBC::shear_direction
unsigned int shear_direction
Definition
LeesEdwardsBC.hpp:32
src
core
lees_edwards
LeesEdwardsBC.hpp
Generated on Fri Nov 22 2024 02:13:54 for ESPResSo by
1.9.8