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
29 static auto constexpr invalid_dir = 3u;
30 double pos_offset = 0.;
31 double shear_velocity = 0.;
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 implementation and trait types for boost qvm interoperability.
static auto constexpr invalid_dir
unsigned int shear_plane_normal
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
unsigned int shear_direction