Loading...
Searching...
No Matches
LinkCellNeighbors.cpp
Go to the documentation of this file.
1// SPDX-License-Identifier: BSD-3-Clause
3#include <linkcell.hpp>
4
5namespace eonc {
6std::vector<CutoffPair> periodicCutoffNeighbors(const double *positions,
7 size_t atoms,
8 const double *cell,
9 double cutoff, bool full) {
10 const auto box = linkcell::Cell::from_vectors({cell[0], cell[1], cell[2]},
11 {cell[3], cell[4], cell[5]},
12 {cell[6], cell[7], cell[8]});
13 const auto rows = linkcell::pairs_within(positions, atoms, box, cutoff,
14 nullptr, 0.0, !full);
15 std::vector<CutoffPair> result;
16 result.reserve(rows.size());
17 for (const auto &pair : rows)
18 result.push_back({pair.i, pair.j, pair.shift, pair.dist2});
19 return result;
20}
21} // namespace eonc
RAII resource manager for the ARTn C library with global synchronization.
std::vector< CutoffPair > periodicCutoffNeighbors(const double *positions, size_t atoms, const double *cell, double cutoff, bool full)