38#include "system/System.hpp"
43#include <boost/serialization/set.hpp>
60template <
class Filter>
62 double const distance,
Filter filter) {
63 std::vector<std::pair<int, int>>
ret;
85 auto const &cell_structure = *
system.cell_structure;
86 return std::ranges::min(cell_structure.max_range());
89 double const distance) {
93 auto const max_range = get_max_neighbor_search_range(
system);
94 if (distance > max_range) {
95 throw std::domain_error(
"pair search distance " + std::to_string(distance) +
96 " bigger than the decomposition range " +
97 std::to_string(max_range));
103 auto const &cell_structure = *
system.cell_structure;
105 throw std::runtime_error(
"Cannot search for neighbors in the hybrid "
106 "decomposition cell system");
110 double const distance) {
111 search_distance_sanity_check_max_range(
system, distance);
112 search_distance_sanity_check_cell_structure(
system, distance);
116std::optional<std::vector<int>>
118 double const distance) {
119 detail::search_neighbors_sanity_checks(
system, distance);
120 std::vector<int>
ret;
125 ret.emplace_back(
p2.id());
128 auto &cell_structure = *
system.cell_structure;
129 auto const p = cell_structure.get_local_particle(pid);
130 if (p
and not p->is_ghost()) {
131 cell_structure.run_on_particle_short_range_neighbors(*p, kernel);
142 auto &cell_structure = *
system.cell_structure;
143 auto const distance = std::ranges::min(cell_structure.max_range());
144 detail::search_neighbors_sanity_checks(
system, distance);
145 std::vector<Particle const *>
ret;
150 ret.emplace_back(&
p2);
153 cell_structure.run_on_particle_short_range_neighbors(p, kernel);
158 double const distance) {
159 detail::search_neighbors_sanity_checks(
system, distance);
161 [](
Particle const &) {
return true; });
164std::vector<std::pair<int, int>>
166 std::vector<int>
const &
types) {
167 detail::search_neighbors_sanity_checks(
system, distance);
169 return std::ranges::any_of(
170 types, [
target = p.
type()](
int const type) { return type == target; });
176 std::vector<PairInfo>
pairs;
180 pairs.emplace_back(
p1.id(),
p2.id(),
p1.pos(),
p2.pos(), d.vec21, rank);
187 std::vector<NeighborPIDs>
ret;
189 std::vector<Particle const *>
const &neighbors) {
190 std::vector<int> neighbor_pids;
191 neighbor_pids.reserve(neighbors.size());
192 for (
auto const &
neighbor : neighbors) {
193 neighbor_pids.emplace_back(
neighbor->id());
195 ret.emplace_back(p.
id(), neighbor_pids);
197 auto &cell_structure = *
system.cell_structure;
198 for (
auto const &p : cell_structure.local_particles()) {
@ HYBRID
Hybrid decomposition.
Vector implementation and trait types for boost qvm interoperability.
static auto get_interacting_neighbors(System::System const &system, Particle const &p)
Get pointers to all interacting neighbors of a central particle.
static auto get_pairs_filtered(System::System const &system, double const distance, Filter filter)
Get pairs of particles that are closer than a distance and fulfill a filter criterion.
std::optional< std::vector< int > > get_short_range_neighbors(System::System const &system, int const pid, double const distance)
Get ids of particles that are within a certain distance of another particle.
std::vector< PairInfo > non_bonded_loop_trace(System::System const &system, int const rank)
Returns pairs of particle ids, positions and distance as seen by the non-bonded loop.
std::vector< std::pair< int, int > > get_pairs_of_types(System::System const &system, double const distance, std::vector< int > const &types)
Get pairs closer than distance if both their types are in types.
std::vector< NeighborPIDs > get_neighbor_pids(System::System const &system)
Returns pairs of particle ids and neighbor particle id lists.
std::vector< std::pair< int, int > > get_pairs(System::System const &system, double const distance)
Get pairs closer than distance from the cells.
This file contains everything related to the global cell structure / cell system.
cudaStream_t stream[1]
CUDA streams for parallel computing on CPU and GPU.
This file contains the errorhandling code for severe errors, like a broken bond or illegal parameter ...
DEVICE_QUALIFIER constexpr T sqr(T x)
Calculates the SQuaRe of x.
Distance vector and length handed to pair kernels.
Struct holding all information for one particle.
constexpr auto const & type() const
constexpr auto const & id() const