ESPResSo
Extensible Simulation Package for Research on Soft Matter Systems
Loading...
Searching...
No Matches
LocalBondState.hpp
Go to the documentation of this file.
1/*
2 * Copyright (C) 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#include <Kokkos_Core.hpp>
25
26#include <vector>
27
29 using execution_space = Kokkos::DefaultHostExecutionSpace;
31 Kokkos::View<int *[2], Kokkos::LayoutRight, execution_space>;
33 Kokkos::View<int *, Kokkos::LayoutRight, execution_space>;
35 Kokkos::View<int *[3], Kokkos::LayoutRight, execution_space>;
37 Kokkos::View<int *, Kokkos::LayoutRight, execution_space>;
39 Kokkos::View<int *[4], Kokkos::LayoutRight, execution_space>;
41 Kokkos::View<int *, Kokkos::LayoutRight, execution_space>;
42
43 // Bond counts
44 int pair_count = 0;
45 int angle_count = 0;
47
48 // Kokkos bond lists
55
56#ifdef ESPRESSO_COLLISION_DETECTION
57 std::vector<int> new_pair_list, new_pair_ids;
58 std::vector<int> new_angle_list, new_angle_ids;
60#endif
61
62 void reset_counts() {
63 pair_count = 0;
64 angle_count = 0;
66 }
67
68 void set_counts(int p, int a, int d) {
69 pair_count = p;
70 angle_count = a;
72 }
73
74 /** Allocate or reallocate all Kokkos Views to current counts. */
75 void allocate();
76
77 /** Deallocates Views */
78 void clear();
79
80 /** Reset counts + collision vectors */
81 void reset();
82
83#ifdef ESPRESSO_COLLISION_DETECTION
84 void clear_new_bonds();
85 void add_new_bond(int bond_id, std::vector<int> const &particle_ids,
86 Kokkos::View<int *, execution_space> const &id_to_index);
87 void rebuild();
88#endif
89};
cudaStream_t stream[1]
CUDA streams for parallel computing on CPU and GPU.
Kokkos::View< int *, Kokkos::LayoutRight, execution_space > AngleBondIDType
std::vector< int > new_angle_ids
Kokkos::View< int *[3], Kokkos::LayoutRight, execution_space > AngleBondlistType
void allocate()
Allocate or reallocate all Kokkos Views to current counts.
AngleBondIDType angle_ids
Kokkos::View< int *[2], Kokkos::LayoutRight, execution_space > PairBondlistType
std::vector< int > new_dihedral_list
DihedralBondlistType dihedral_list
AngleBondlistType angle_list
void add_new_bond(int bond_id, std::vector< int > const &particle_ids, Kokkos::View< int *, execution_space > const &id_to_index)
std::vector< int > new_pair_list
PairBondIDType pair_ids
void reset()
Reset counts + collision vectors.
std::vector< int > new_angle_list
void clear()
Deallocates Views.
std::vector< int > new_dihedral_ids
Kokkos::DefaultHostExecutionSpace execution_space
Kokkos::View< int *, Kokkos::LayoutRight, execution_space > DihedralBondIDType
void set_counts(int p, int a, int d)
std::vector< int > new_pair_ids
Kokkos::View< int *[4], Kokkos::LayoutRight, execution_space > DihedralBondlistType
Kokkos::View< int *, Kokkos::LayoutRight, execution_space > PairBondIDType
DihedralBondIDType dihedral_ids
PairBondlistType pair_list