ESPResSo
Extensible Simulation Package for Research on Soft Matter Systems
Loading...
Searching...
No Matches
ibm_triel.hpp
Go to the documentation of this file.
1/*
2 * Copyright (C) 2010-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 "config/config.hpp"
23
24#include "BoxGeometry.hpp"
26
27#include <utils/Vector.hpp>
28
29#include <optional>
30#include <tuple>
31
33
34/** Parameters for IBM elastic triangle (triel) */
35struct IBMTriel {
36 // These values encode the reference state
37 double l0;
38 double lp0;
39 double sinPhi0;
40 double cosPhi0;
41 double area0;
42
43 // These values are cache values to speed up computation
44 double a1;
45 double a2;
46 double b1;
47 double b2;
48
49 // These are interaction parameters
50 // k1 is used for Neo-Hookean
51 // k1 and k2 are used Skalak
52 double maxDist;
54 double k1;
55 double k2;
56
57 /** Particle ids */
58 std::tuple<int, int, int> p_ids;
60
61 double cutoff() const { return maxDist; }
62
63 static constexpr int num = 2;
64
65 /** Set the IBM Triel parameters.
66 * Also calculate and store the reference state.
67 */
68 void initialize(BoxGeometry const &box_geo,
69 CellStructure const &cell_structure);
70
71 IBMTriel(int ind1, int ind2, int ind3, double maxDist, tElasticLaw elasticLaw,
72 double k1, double k2)
73 : l0{0.}, lp0{0.}, sinPhi0{0.}, cosPhi0{0.}, area0{0.}, a1{0.}, a2{0.},
75 k2{k2}, p_ids{ind1, ind2, ind3}, is_initialized{false} {}
76
77 /** Calculate the forces.
78 * The equations can be found in Appendix C of @cite kruger12a.
79 * @return the forces on @p p1, @p p2, @p p3
80 */
81 std::optional<std::tuple<Utils::Vector3d, Utils::Vector3d, Utils::Vector3d>>
82 calc_forces(Utils::Vector3d const &vec1, Utils::Vector3d const &vec2) const;
83};
Vector implementation and trait types for boost qvm interoperability.
This file contains the defaults for ESPResSo.
tElasticLaw
Definition ibm_triel.hpp:32
Describes a cell structure / cell system.
Parameters for IBM elastic triangle (triel)
Definition ibm_triel.hpp:35
double cosPhi0
Definition ibm_triel.hpp:40
double lp0
Definition ibm_triel.hpp:38
static constexpr int num
Definition ibm_triel.hpp:63
bool is_initialized
Definition ibm_triel.hpp:59
double k1
Definition ibm_triel.hpp:54
double b2
Definition ibm_triel.hpp:47
double l0
Definition ibm_triel.hpp:37
void initialize(BoxGeometry const &box_geo, CellStructure const &cell_structure)
Set the IBM Triel parameters.
double cutoff() const
Definition ibm_triel.hpp:61
tElasticLaw elasticLaw
Definition ibm_triel.hpp:53
double maxDist
Definition ibm_triel.hpp:52
double b1
Definition ibm_triel.hpp:46
double a1
Definition ibm_triel.hpp:44
double a2
Definition ibm_triel.hpp:45
double sinPhi0
Definition ibm_triel.hpp:39
std::optional< std::tuple< Utils::Vector3d, Utils::Vector3d, Utils::Vector3d > > calc_forces(Utils::Vector3d const &vec1, Utils::Vector3d const &vec2) const
Calculate the forces.
Definition ibm_triel.cpp:74
IBMTriel(int ind1, int ind2, int ind3, double maxDist, tElasticLaw elasticLaw, double k1, double k2)
Definition ibm_triel.hpp:71
std::tuple< int, int, int > p_ids
Particle ids.
Definition ibm_triel.hpp:58
double area0
Definition ibm_triel.hpp:41
double k2
Definition ibm_triel.hpp:55