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
#include "system/System.hpp"
29
30
#include <shapes/NoWhere.hpp>
31
#include <shapes/Shape.hpp>
32
33
#include <
utils/Vector.hpp
>
34
35
#include <memory>
36
#include <utility>
37
38
namespace
Constraints
{
39
40
class
ShapeBasedConstraint
:
public
Constraint
{
41
public
:
42
ShapeBasedConstraint
(
System::System
const
&system)
43
: part_rep{}, m_shape{std::make_shared<
Shapes
::NoWhere>()},
44
m_penetrable{false}, m_only_positive{false}, m_local_force{},
45
m_outer_normal_force{}, m_system{system} {}
46
47
void
add_energy
(
const
Particle
&p,
const
Utils::Vector3d
&folded_pos,
48
double
time,
Observable_stat
&energy)
const override
;
49
50
ParticleForce
force
(
const
Particle
&p,
const
Utils::Vector3d
&folded_pos,
51
double
time)
override
;
52
53
bool
fits_in_box
(
Utils::Vector3d
const
&)
const override
{
return
true
; }
54
55
/** @brief Calculate the minimum distance between all particle pairs. */
56
double
min_dist
(
BoxGeometry
const
&box_geo,
57
ParticleRange
const
&particles)
const
;
58
59
/** @brief Calculate distance from the constraint */
60
void
calc_dist
(
Utils::Vector3d
const
&
pos
,
double
&dist,
61
Utils::Vector3d
&vec)
const
{
62
m_shape->calculate_dist(
pos
, dist, vec);
63
}
64
65
void
set_shape
(std::shared_ptr<Shapes::Shape>
const
&
shape
) {
66
m_shape =
shape
;
67
}
68
69
Shapes::Shape
const
&
shape
()
const
{
return
*m_shape; }
70
71
void
reset_force
()
override
{
72
m_local_force =
Utils::Vector3d
{0, 0, 0};
73
m_outer_normal_force = 0.0;
74
}
75
76
bool
&
only_positive
() {
return
m_only_positive; }
77
bool
&
penetrable
() {
return
m_penetrable; }
78
int
&
type
() {
return
part_rep.
type
(); }
79
Utils::Vector3d
&
velocity
() {
return
part_rep.
v
(); }
80
81
void
set_type
(
int
type
) {
82
part_rep.
type
() =
type
;
83
m_system.
nonbonded_ias
->make_particle_type_exist(
type
);
84
}
85
86
Utils::Vector3d
total_force
()
const
;
87
double
total_normal_force
()
const
;
88
89
private
:
90
Particle
part_rep;
91
std::shared_ptr<Shapes::Shape> m_shape;
92
bool
m_penetrable;
93
bool
m_only_positive;
94
Utils::Vector3d
m_local_force;
95
double
m_outer_normal_force;
96
System::System
const
&m_system;
97
98
auto
const
&get_ia_param(
int
type
)
const
{
99
return
m_system.
nonbonded_ias
->get_ia_param(
type
, part_rep.
type
());
100
}
101
};
102
103
}
// namespace Constraints
BoxGeometry.hpp
Observable_stat.hpp
ParticleRange.hpp
Particle.hpp
Vector.hpp
Vector implementation and trait types for boost qvm interoperability.
force
__global__ float * force
Definition
barnes_hut_gpu_cuda.cu:685
pos
__shared__ int pos[MAXDEPTH *THREADS5/WARPSIZE]
Definition
barnes_hut_gpu_cuda.cu:696
BoxGeometry
Definition
BoxGeometry.hpp:98
Constraints::Constraint
Definition
core/constraints/Constraint.hpp:28
Constraints::ShapeBasedConstraint
Definition
core/constraints/ShapeBasedConstraint.hpp:40
Constraints::ShapeBasedConstraint::velocity
Utils::Vector3d & velocity()
Definition
core/constraints/ShapeBasedConstraint.hpp:79
Constraints::ShapeBasedConstraint::type
int & type()
Definition
core/constraints/ShapeBasedConstraint.hpp:78
Constraints::ShapeBasedConstraint::total_normal_force
double total_normal_force() const
Definition
ShapeBasedConstraint.cpp:53
Constraints::ShapeBasedConstraint::ShapeBasedConstraint
ShapeBasedConstraint(System::System const &system)
Definition
core/constraints/ShapeBasedConstraint.hpp:42
Constraints::ShapeBasedConstraint::penetrable
bool & penetrable()
Definition
core/constraints/ShapeBasedConstraint.hpp:77
Constraints::ShapeBasedConstraint::shape
Shapes::Shape const & shape() const
Definition
core/constraints/ShapeBasedConstraint.hpp:69
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:60
Constraints::ShapeBasedConstraint::fits_in_box
bool fits_in_box(Utils::Vector3d const &) const override
Definition
core/constraints/ShapeBasedConstraint.hpp:53
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:57
Constraints::ShapeBasedConstraint::only_positive
bool & only_positive()
Definition
core/constraints/ShapeBasedConstraint.hpp:76
Constraints::ShapeBasedConstraint::set_type
void set_type(int type)
Definition
core/constraints/ShapeBasedConstraint.hpp:81
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:146
Constraints::ShapeBasedConstraint::total_force
Utils::Vector3d total_force() const
Definition
ShapeBasedConstraint.cpp:49
Constraints::ShapeBasedConstraint::reset_force
void reset_force() override
Definition
core/constraints/ShapeBasedConstraint.hpp:71
Constraints::ShapeBasedConstraint::set_shape
void set_shape(std::shared_ptr< Shapes::Shape > const &shape)
Definition
core/constraints/ShapeBasedConstraint.hpp:65
Observable_stat
Observable for the pressure and energy.
Definition
Observable_stat.hpp:34
ParticleRange
A range of particles.
Definition
ParticleRange.hpp:38
Shapes::Shape
Definition
shapes/include/shapes/Shape.hpp:29
System::System
Main system class.
Definition
core/system/System.hpp:65
System::System::nonbonded_ias
std::shared_ptr< InteractionsNonBonded > nonbonded_ias
Definition
core/system/System.hpp:269
Utils::Vector
Definition
Vector.hpp:47
Constraints
Definition
constraints.cpp:21
Shapes
Definition
shapes/include/shapes/Cylinder.hpp:31
nonbonded_interaction_data.hpp
Various procedures concerning interactions between particles.
Constraint.hpp
ParticleForce
Force information on a particle.
Definition
Particle.hpp:290
Particle
Struct holding all information for one particle.
Definition
Particle.hpp:393
Particle::v
auto const & v() const
Definition
Particle.hpp:431
Particle::type
auto const & type() const
Definition
Particle.hpp:416
src
core
constraints
ShapeBasedConstraint.hpp
Generated on Sat May 11 2024 01:33:52 for ESPResSo by
1.9.8