ESPResSo
Extensible Simulation Package for Research on Soft Matter Systems
Loading...
Searching...
No Matches
core/collision_detection/GlueToSurface.hpp
Go to the documentation of this file.
1
/*
2
* Copyright (C) 2011-2026 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
#ifdef ESPRESSO_COLLISION_DETECTION
25
#ifdef ESPRESSO_VIRTUAL_SITES_RELATIVE
26
27
#include "
CollisionPair.hpp
"
28
#include "
common.hpp
"
29
30
#include "
Particle.hpp
"
31
#include "system/System.hpp"
32
33
#include <vector>
34
35
namespace
CollisionDetection
{
36
37
class
GlueToSurface
{
38
public
:
39
/// Distance at which particle are bound
40
double
distance
;
41
/// Square of distance at which particle are bound
42
double
distance_sq
;
43
/// bond type used between centers of colliding particles
44
int
bond_centers
;
45
/// bond type used between virtual sites
46
int
bond_vs
;
47
/// particle type for virtual sites created on collision
48
int
part_type_vs
;
49
/// Distance from the particle which is to be glued to the new virtual site
50
double
dist_glued_part_to_vs
;
51
/// The particle type being glued (the small particle)
52
int
part_type_to_be_glued
;
53
/// The particle type to which virtual sites are attached (the large particle)
54
int
part_type_to_attach_vs_to
;
55
/// Particle type to which the newly glued particle is converted
56
int
part_type_after_glueing
;
57
58
GlueToSurface
(
double
distance
,
int
bond_centers
,
int
bond_vs
,
59
int
part_type_vs
,
double
dist_glued_part_to_vs
,
60
int
part_type_to_be_glued
,
int
part_type_to_attach_vs_to
,
61
int
part_type_after_glueing
)
62
:
distance
{
distance
},
distance_sq
{
distance
*
distance
},
63
bond_centers
{
bond_centers
},
bond_vs
{
bond_vs
},
64
part_type_vs
{
part_type_vs
},
65
dist_glued_part_to_vs
{
dist_glued_part_to_vs
},
66
part_type_to_be_glued
{
part_type_to_be_glued
},
67
part_type_to_attach_vs_to
{
part_type_to_attach_vs_to
},
68
part_type_after_glueing
{
part_type_after_glueing
} {}
69
70
void
initialize
(
System::System
&
system
);
71
72
auto
cutoff
()
const
{
return
distance
; }
73
74
/** @brief Check additional criteria for the glue_to_surface collision mode */
75
bool
glue_to_surface_criterion
(
Particle
const
&
p1
,
Particle
const
&
p2
)
const
{
76
return
((
p1
.type() ==
part_type_to_be_glued
and
77
p2
.type() ==
part_type_to_attach_vs_to
)
or
78
(
p2
.type() ==
part_type_to_be_glued
and
79
p1
.type() ==
part_type_to_attach_vs_to
));
80
}
81
82
void
handle_collisions
(
System::System
&
system
,
83
std::vector<CollisionPair> &local_collision_queue);
84
85
bool
detect_collision
(
Particle
const
&
p1
,
Particle
const
&
p2
,
86
double
const
dist_sq
)
const
{
87
if
(
dist_sq
>
distance_sq
)
88
return
false
;
89
90
if
(!
glue_to_surface_criterion
(
p1
,
p2
))
91
return
false
;
92
93
return
detect_collision_common
(
p1
,
p2
,
bond_centers
);
94
}
95
};
96
97
}
// namespace CollisionDetection
98
#endif
// ESPRESSO_VIRTUAL_SITES_RELATIVE
99
#endif
// ESPRESSO_COLLISION_DETECTION
CollisionPair.hpp
Particle.hpp
CollisionDetection::GlueToSurface
Definition
core/collision_detection/GlueToSurface.hpp:37
CollisionDetection::GlueToSurface::part_type_vs
int part_type_vs
particle type for virtual sites created on collision
Definition
core/collision_detection/GlueToSurface.hpp:48
CollisionDetection::GlueToSurface::dist_glued_part_to_vs
double dist_glued_part_to_vs
Distance from the particle which is to be glued to the new virtual site.
Definition
core/collision_detection/GlueToSurface.hpp:50
CollisionDetection::GlueToSurface::bond_centers
int bond_centers
bond type used between centers of colliding particles
Definition
core/collision_detection/GlueToSurface.hpp:44
CollisionDetection::GlueToSurface::distance_sq
double distance_sq
Square of distance at which particle are bound.
Definition
core/collision_detection/GlueToSurface.hpp:42
CollisionDetection::GlueToSurface::distance
double distance
Distance at which particle are bound.
Definition
core/collision_detection/GlueToSurface.hpp:40
CollisionDetection::GlueToSurface::part_type_to_attach_vs_to
int part_type_to_attach_vs_to
The particle type to which virtual sites are attached (the large particle)
Definition
core/collision_detection/GlueToSurface.hpp:54
CollisionDetection::GlueToSurface::bond_vs
int bond_vs
bond type used between virtual sites
Definition
core/collision_detection/GlueToSurface.hpp:46
CollisionDetection::GlueToSurface::part_type_after_glueing
int part_type_after_glueing
Particle type to which the newly glued particle is converted.
Definition
core/collision_detection/GlueToSurface.hpp:56
CollisionDetection::GlueToSurface::initialize
void initialize(System::System &system)
Definition
GlueToSurface.cpp:53
CollisionDetection::GlueToSurface::GlueToSurface
GlueToSurface(double distance, int bond_centers, int bond_vs, int part_type_vs, double dist_glued_part_to_vs, int part_type_to_be_glued, int part_type_to_attach_vs_to, int part_type_after_glueing)
Definition
core/collision_detection/GlueToSurface.hpp:58
CollisionDetection::GlueToSurface::cutoff
auto cutoff() const
Definition
core/collision_detection/GlueToSurface.hpp:72
CollisionDetection::GlueToSurface::handle_collisions
void handle_collisions(System::System &system, std::vector< CollisionPair > &local_collision_queue)
Definition
GlueToSurface.cpp:86
CollisionDetection::GlueToSurface::glue_to_surface_criterion
bool glue_to_surface_criterion(Particle const &p1, Particle const &p2) const
Check additional criteria for the glue_to_surface collision mode.
Definition
core/collision_detection/GlueToSurface.hpp:75
CollisionDetection::GlueToSurface::detect_collision
bool detect_collision(Particle const &p1, Particle const &p2, double const dist_sq) const
Definition
core/collision_detection/GlueToSurface.hpp:85
CollisionDetection::GlueToSurface::part_type_to_be_glued
int part_type_to_be_glued
The particle type being glued (the small particle)
Definition
core/collision_detection/GlueToSurface.hpp:52
System::System
Main system class.
Definition
core/system/System.hpp:85
stream
cudaStream_t stream[1]
CUDA streams for parallel computing on CPU and GPU.
Definition
common_cuda.cu:34
config.hpp
CollisionDetection
Definition
ActiveProtocol.hpp:33
CollisionDetection::detect_collision_common
auto detect_collision_common(Particle const &p1, Particle const &p2, int const bond_centers)
Definition
collision_detection/common.hpp:31
common.hpp
Common functions for dipolar and charge P3M.
Particle
Struct holding all information for one particle.
Definition
Particle.hpp:435
src
core
collision_detection
GlueToSurface.hpp
Generated on Thu Mar 5 2026 02:40:45 for ESPResSo by
1.9.8