26 Kokkos::realloc(Kokkos::view_alloc(Kokkos::WithoutInitializing),
pair_list,
28 Kokkos::realloc(Kokkos::view_alloc(Kokkos::WithoutInitializing),
pair_ids,
30 Kokkos::realloc(Kokkos::view_alloc(Kokkos::WithoutInitializing),
angle_list,
32 Kokkos::realloc(Kokkos::view_alloc(Kokkos::WithoutInitializing),
angle_ids,
34 Kokkos::realloc(Kokkos::view_alloc(Kokkos::WithoutInitializing),
36 Kokkos::realloc(Kokkos::view_alloc(Kokkos::WithoutInitializing),
40 Kokkos::ViewAllocateWithoutInitializing(
"pair_bond_list"),
pair_count);
42 Kokkos::ViewAllocateWithoutInitializing(
"pair_bond_id"),
pair_count);
44 Kokkos::ViewAllocateWithoutInitializing(
"angle_bond_list"),
47 Kokkos::ViewAllocateWithoutInitializing(
"angle_bond_id"),
angle_count);
49 Kokkos::ViewAllocateWithoutInitializing(
"dihedral_bond_list"),
52 Kokkos::ViewAllocateWithoutInitializing(
"dihedral_bond_id"),
66#ifdef ESPRESSO_COLLISION_DETECTION
73#ifdef ESPRESSO_COLLISION_DETECTION
78#ifdef ESPRESSO_COLLISION_DETECTION
113template <
typename BondListT,
typename BondIDT>
121 auto new_data_view = Kokkos::View<
const int *, Kokkos::HostSpace,
122 Kokkos::MemoryTraits<Kokkos::Unmanaged>>(
124 auto new_id_view = Kokkos::View<
const int *, Kokkos::HostSpace,
125 Kokkos::MemoryTraits<Kokkos::Unmanaged>>(
131 Kokkos::ViewAllocateWithoutInitializing(
"bond_list_rebuild"),
134 Kokkos::ViewAllocateWithoutInitializing(
"bond_id_rebuild"),
140 Kokkos::subview(bond_list, std::make_pair(0,
old_count), Kokkos::ALL()));
142 Kokkos::subview(bond_ids, std::make_pair(0,
old_count)));
144 Kokkos::parallel_for(
147 constexpr int NCols =
148 BondListT::rank == 2 ? static_cast<int>(BondListT::static_extent(1))
150 auto bond_idx = old_count + static_cast<int>(flat_idx / NCols);
151 auto col_idx = static_cast<int>(flat_idx % NCols);
152 bond_view(bond_idx, col_idx) = new_data_view(flat_idx);
155 Kokkos::parallel_for(
158 id_view(old_count + static_cast<int>(idx)) = new_id_view(idx);
cudaStream_t stream[1]
CUDA streams for parallel computing on CPU and GPU.
void rebuild_bond_list_impl(std::vector< int > const &new_bond_list, std::vector< int > const &new_bond_ids, BondListT &bond_list, BondIDT &bond_ids, int total_bond_count)
Kokkos::View< int *[4], Kokkos::LayoutRight > DihedralBondlistType
std::vector< int > new_angle_ids
void allocate()
Allocate or reallocate all Kokkos Views to current counts.
Kokkos::View< int *[2], Kokkos::LayoutRight > PairBondlistType
AngleBondIDType angle_ids
std::vector< int > new_dihedral_list
Kokkos::View< int *, Kokkos::LayoutRight > DihedralBondIDType
DihedralBondlistType dihedral_list
AngleBondlistType angle_list
std::vector< int > new_pair_list
void reset()
Reset counts + collision vectors.
Kokkos::View< int *[3], Kokkos::LayoutRight > AngleBondlistType
Kokkos::View< int *, Kokkos::LayoutRight > PairBondIDType
std::vector< int > new_angle_list
void clear()
Deallocates Views.
Kokkos::View< int *, Kokkos::LayoutRight > AngleBondIDType
void add_new_bond(int bond_id, std::vector< int > const &particle_ids, Kokkos::View< int * > const &id_to_index)
std::vector< int > new_dihedral_ids
std::vector< int > new_pair_ids
DihedralBondIDType dihedral_ids
PairBondlistType pair_list