ESPResSo
Extensible Simulation Package for Research on Soft Matter Systems
Loading...
Searching...
No Matches
collision_detection/common.hpp
Go to the documentation of this file.
1
/*
2
* Copyright (C) 2011-2024 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
26
#include "
BondList.hpp
"
27
#include "
Particle.hpp
"
28
29
namespace
CollisionDetection
{
30
31
inline
auto
detect_collision_common
(
Particle
const
&
p1
,
Particle
const
&
p2
,
32
int
const
bond_centers) {
33
// Ignore virtual particles
34
if
(
p1
.is_virtual()
or
p2
.is_virtual())
35
return
false
;
36
37
// Check, if there's already a bond between the particles
38
if
(
pair_bond_exists_on
(
p1
.bonds(),
p2
.id(), bond_centers)
or
39
pair_bond_exists_on
(
p2
.bonds(),
p1
.id(), bond_centers))
40
return
false
;
41
42
/* If we're still here, there is no previous bond between the particles,
43
we have a new collision */
44
45
// do not create bond between ghost particles
46
return
not
(
p1
.is_ghost()
and
p2
.is_ghost());
47
}
48
49
}
// namespace CollisionDetection
50
#endif
// ESPRESSO_COLLISION_DETECTION
BondList.hpp
pair_bond_exists_on
bool pair_bond_exists_on(BondList const &bonds, int partner_id, int bond_id)
Check if there is a specific bond in a bond list.
Definition
BondList.hpp:238
Particle.hpp
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
Particle
Struct holding all information for one particle.
Definition
Particle.hpp:450
src
core
collision_detection
common.hpp
Generated on Tue Dec 9 2025 02:28:52 for ESPResSo by
1.9.8