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 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
// 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
config.hpp
This file contains the defaults for ESPResSo.
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:395
Particle::is_virtual
auto is_virtual() const
Definition
Particle.hpp:518
Particle::bonds
auto const & bonds() const
Definition
Particle.hpp:428
Particle::is_ghost
bool is_ghost() const
Definition
Particle.hpp:440
Particle::id
auto const & id() const
Definition
Particle.hpp:414
src
core
collision_detection
common.hpp
Generated on Fri Nov 22 2024 02:13:54 for ESPResSo by
1.9.8