ESPResSo
Extensible Simulation Package for Research on Soft Matter Systems
Loading...
Searching...
No Matches
core/constraints/ShapeBasedConstraint.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 "
BoxGeometry.hpp
"
23
#include "
Constraint.hpp
"
24
#include "
Observable_stat.hpp
"
25
#include "
Particle.hpp
"
26
#include "
ParticleRange.hpp
"
27
#include "
nonbonded_interactions/nonbonded_interaction_data.hpp
"
28
29
#include <shapes/NoWhere.hpp>
30
#include <shapes/Shape.hpp>
31
32
#include <
utils/Vector.hpp
>
33
34
#include <memory>
35
#include <utility>
36
37
namespace
System
{
38
class
System
;
39
}
40
41
namespace
Constraints
{
42
43
class
ShapeBasedConstraint
:
public
Constraint
{
44
public
:
45
ShapeBasedConstraint
()
46
: part_rep{}, m_shape{std::make_shared<
Shapes
::NoWhere>()},
47
m_penetrable{false}, m_only_positive{false}, m_local_force{},
48
m_outer_normal_force{}, m_system{} {}
49
50
void
add_energy
(
const
Particle
&p,
const
Utils::Vector3d
&folded_pos,
51
double
time,
Observable_stat
&energy)
const override
;
52
53
ParticleForce
force
(
const
Particle
&p,
const
Utils::Vector3d
&folded_pos,
54
double
time)
override
;
55
56
bool
fits_in_box
(
Utils::Vector3d
const
&)
const override
{
return
true
; }
57
58
/** @brief Calculate the minimum distance between all particle pairs. */
59
double
min_dist
(
BoxGeometry
const
&box_geo,
60
ParticleRange
const
&particles)
const
;
61
62
/** @brief Calculate distance from the constraint */
63
void
calc_dist
(
Utils::Vector3d
const
&pos,
double
&dist,
64
Utils::Vector3d
&vec)
const
{
65
m_shape->calculate_dist(pos, dist, vec);
66
}
67
68
void
set_shape
(std::shared_ptr<Shapes::Shape>
const
&
shape
) {
69
m_shape =
shape
;
70
}
71
72
Shapes::Shape
const
&
shape
()
const
{
return
*m_shape; }
73
74
void
reset_force
()
override
{
75
m_local_force =
Utils::Vector3d
{0, 0, 0};
76
m_outer_normal_force = 0.0;
77
}
78
79
bool
&
only_positive
() {
return
m_only_positive; }
80
bool
&
penetrable
() {
return
m_penetrable; }
81
int
&
type
() {
return
part_rep.
type
(); }
82
Utils::Vector3d
&
velocity
() {
return
part_rep.
v
(); }
83
84
void
set_type
(
int
type
);
85
86
Utils::Vector3d
total_force
()
const
;
87
double
total_normal_force
()
const
;
88
void
bind_system
(std::shared_ptr<System::System const>
const
&system) {
89
m_system = system;
90
}
91
92
private
:
93
Particle
part_rep;
94
std::shared_ptr<Shapes::Shape> m_shape;
95
bool
m_penetrable;
96
bool
m_only_positive;
97
Utils::Vector3d
m_local_force;
98
double
m_outer_normal_force;
99
std::weak_ptr<System::System const> m_system;
100
101
IA_parameters
const
&get_ia_param(
int
type
)
const
;
102
};
103
104
}
// namespace Constraints
BoxGeometry.hpp
Observable_stat.hpp
ParticleRange.hpp
Particle.hpp
Vector.hpp
Vector implementation and trait types for boost qvm interoperability.
BoxGeometry
Definition
BoxGeometry.hpp:98
Constraints::Constraint
Definition
core/constraints/Constraint.hpp:30
Constraints::ShapeBasedConstraint
Definition
core/constraints/ShapeBasedConstraint.hpp:43
Constraints::ShapeBasedConstraint::velocity
Utils::Vector3d & velocity()
Definition
core/constraints/ShapeBasedConstraint.hpp:82
Constraints::ShapeBasedConstraint::type
int & type()
Definition
core/constraints/ShapeBasedConstraint.hpp:81
Constraints::ShapeBasedConstraint::total_normal_force
double total_normal_force() const
Definition
ShapeBasedConstraint.cpp:63
Constraints::ShapeBasedConstraint::penetrable
bool & penetrable()
Definition
core/constraints/ShapeBasedConstraint.hpp:80
Constraints::ShapeBasedConstraint::shape
Shapes::Shape const & shape() const
Definition
core/constraints/ShapeBasedConstraint.hpp:72
Constraints::ShapeBasedConstraint::calc_dist
void calc_dist(Utils::Vector3d const &pos, double &dist, Utils::Vector3d &vec) const
Calculate distance from the constraint.
Definition
core/constraints/ShapeBasedConstraint.hpp:63
Constraints::ShapeBasedConstraint::fits_in_box
bool fits_in_box(Utils::Vector3d const &) const override
Definition
core/constraints/ShapeBasedConstraint.hpp:56
Constraints::ShapeBasedConstraint::bind_system
void bind_system(std::shared_ptr< System::System const > const &system)
Definition
core/constraints/ShapeBasedConstraint.hpp:88
Constraints::ShapeBasedConstraint::min_dist
double min_dist(BoxGeometry const &box_geo, ParticleRange const &particles) const
Calculate the minimum distance between all particle pairs.
Definition
ShapeBasedConstraint.cpp:67
Constraints::ShapeBasedConstraint::only_positive
bool & only_positive()
Definition
core/constraints/ShapeBasedConstraint.hpp:79
Constraints::ShapeBasedConstraint::set_type
void set_type(int type)
Definition
ShapeBasedConstraint.cpp:50
Constraints::ShapeBasedConstraint::add_energy
void add_energy(const Particle &p, const Utils::Vector3d &folded_pos, double time, Observable_stat &energy) const override
Definition
ShapeBasedConstraint.cpp:161
Constraints::ShapeBasedConstraint::total_force
Utils::Vector3d total_force() const
Definition
ShapeBasedConstraint.cpp:59
Constraints::ShapeBasedConstraint::ShapeBasedConstraint
ShapeBasedConstraint()
Definition
core/constraints/ShapeBasedConstraint.hpp:45
Constraints::ShapeBasedConstraint::force
ParticleForce force(const Particle &p, const Utils::Vector3d &folded_pos, double time) override
Definition
ShapeBasedConstraint.cpp:89
Constraints::ShapeBasedConstraint::reset_force
void reset_force() override
Definition
core/constraints/ShapeBasedConstraint.hpp:74
Constraints::ShapeBasedConstraint::set_shape
void set_shape(std::shared_ptr< Shapes::Shape > const &shape)
Definition
core/constraints/ShapeBasedConstraint.hpp:68
Observable_stat
Observable for the pressure and energy.
Definition
Observable_stat.hpp:31
ParticleRange
A range of particles.
Definition
ParticleRange.hpp:38
Shapes::Shape
Definition
shapes/include/shapes/Shape.hpp:29
Utils::Vector
Definition
Vector.hpp:48
Constraints
Definition
core/constraints/Constraint.hpp:29
Shapes
Definition
shapes/include/shapes/Cylinder.hpp:31
System
Definition
core/accumulators/AccumulatorBase.hpp:31
nonbonded_interaction_data.hpp
Various procedures concerning interactions between particles.
Constraint.hpp
IA_parameters
Parameters for non-bonded interactions.
Definition
nonbonded_interaction_data.hpp:280
ParticleForce
Force information on a particle.
Definition
Particle.hpp:290
Particle
Struct holding all information for one particle.
Definition
Particle.hpp:395
Particle::v
auto const & v() const
Definition
Particle.hpp:433
Particle::type
auto const & type() const
Definition
Particle.hpp:418
src
core
constraints
ShapeBasedConstraint.hpp
Generated on Thu Dec 19 2024 02:13:16 for ESPResSo by
1.9.8