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#ifndef IBM_TRIEL_H
21#define IBM_TRIEL_H
22
23#include "config/config.hpp"
24
25#include <utils/Vector.hpp>
26
27#include <boost/optional.hpp>
28
29#include <tuple>
30
32
33/** Parameters for IBM elastic triangle (triel) */
34struct IBMTriel {
35 // These values encode the reference state
36 double l0;
37 double lp0;
38 double sinPhi0;
39 double cosPhi0;
40 double area0;
41
42 // These values are cache values to speed up computation
43 double a1;
44 double a2;
45 double b1;
46 double b2;
47
48 // These are interaction parameters
49 // k1 is used for Neo-Hookean
50 // k1 and k2 are used Skalak
51 double maxDist;
53 double k1;
54 double k2;
55
56 double cutoff() const { return maxDist; }
57
58 static constexpr int num = 2;
59
60 /** Set the IBM Triel parameters.
61 * Also calculate and store the reference state.
62 */
63 IBMTriel(int ind1, int ind2, int ind3, double maxDist, tElasticLaw elasticLaw,
64 double k1, double k2);
65
66 /** Calculate the forces.
67 * The equations can be found in Appendix C of @cite kruger12a.
68 * @return the forces on @p p1, @p p2, @p p3
69 */
70 boost::optional<std::tuple<Utils::Vector3d, Utils::Vector3d, Utils::Vector3d>>
71 calc_forces(Utils::Vector3d const &vec1, Utils::Vector3d const &vec2) const;
72
73private:
74 friend boost::serialization::access;
75 template <typename Archive>
76 void serialize(Archive &ar, long int /* version */) {
77 ar & l0;
78 ar & lp0;
79 ar & sinPhi0;
80 ar & cosPhi0;
81 ar & area0;
82 ar & a1;
83 ar & a2;
84 ar & b1;
85 ar & b2;
86 ar & maxDist;
87 ar & elasticLaw;
88 ar & k1;
89 ar & k2;
90 }
91};
92
93#endif
Vector implementation and trait types for boost qvm interoperability.
This file contains the defaults for ESPResSo.
tElasticLaw
Definition ibm_triel.hpp:31
Parameters for IBM elastic triangle (triel)
Definition ibm_triel.hpp:34
double cosPhi0
Definition ibm_triel.hpp:39
boost::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:75
double lp0
Definition ibm_triel.hpp:37
static constexpr int num
Definition ibm_triel.hpp:58
double k1
Definition ibm_triel.hpp:53
double b2
Definition ibm_triel.hpp:46
double l0
Definition ibm_triel.hpp:36
double cutoff() const
Definition ibm_triel.hpp:56
tElasticLaw elasticLaw
Definition ibm_triel.hpp:52
double maxDist
Definition ibm_triel.hpp:51
double b1
Definition ibm_triel.hpp:45
double a1
Definition ibm_triel.hpp:43
double a2
Definition ibm_triel.hpp:44
double sinPhi0
Definition ibm_triel.hpp:38
double area0
Definition ibm_triel.hpp:40
double k2
Definition ibm_triel.hpp:54