seams-core v2.14.0
libyodaLib, the C++ engine of d-SEAMS
Loading...
Searching...
No Matches
neighbours.hpp
Go to the documentation of this file.
1//-----------------------------------------------------------------------------------
2// d-SEAMS - Deferred Structural Elucidation Analysis for Molecular Simulations
3//
4// Copyright (c) 2018--present d-SEAMS core team
5//
6// This program is free software: you can redistribute it and/or modify
7// it under the terms of the MIT License as published by
8// the Open Source Initiative.
9//
10// A copy of the MIT License is included in the LICENSE file of this repository.
11// You should have received a copy of the MIT License along with this program.
12// If not, see <https://opensource.org/licenses/MIT>.
13//-----------------------------------------------------------------------------------
14
15#ifndef SEAMS_NEIGHBOURS_H_
16#define SEAMS_NEIGHBOURS_H_
17
18#include <algorithm>
19#include <array>
20#include <cmath>
21#include <string>
22#include <tuple>
23#include <utility>
24#include <vector>
25
26#include <generic.hpp>
27#include <mol_sys.hpp>
28
29#ifdef SEAMS_HAS_LINKCELL
30#include <linkcell.hpp>
31#endif
32#ifdef SEAMS_HAS_MINIMAGE
33#include <minimage.h>
34#endif
35
39
44
67
68namespace nneigh {
69
75inline void dumpBoundsToH(const std::vector<double> &box,
76 const std::vector<double> &boxLow, double H[3][3],
77 double origin[3]) {
78 const double xspan = box.size() > 0 ? box[0] : 0.0;
79 const double yspan = box.size() > 1 ? box[1] : 0.0;
80 const double zspan = box.size() > 2 ? box[2] : 0.0;
81 const double xlo_b = boxLow.size() > 0 ? boxLow[0] : 0.0;
82 const double ylo_b = boxLow.size() > 1 ? boxLow[1] : 0.0;
83 const double zlo_b = boxLow.size() > 2 ? boxLow[2] : 0.0;
84 const double xy = box.size() >= 6 ? box[3] : 0.0;
85 const double xz = box.size() >= 6 ? box[4] : 0.0;
86 const double yz = box.size() >= 6 ? box[5] : 0.0;
87 const double xmin = std::min(std::min(0.0, xy), std::min(xz, xy + xz));
88 const double xmax = std::max(std::max(0.0, xy), std::max(xz, xy + xz));
89 const double ymin = std::min(0.0, yz);
90 const double ymax = std::max(0.0, yz);
91 H[0][0] = xspan - xmax + xmin;
92 H[0][1] = 0.0;
93 H[0][2] = 0.0;
94 H[1][0] = xy;
95 H[1][1] = yspan - ymax + ymin;
96 H[1][2] = 0.0;
97 H[2][0] = xz;
98 H[2][1] = yz;
99 H[2][2] = zspan;
100 origin[0] = xlo_b - xmin;
101 origin[1] = ylo_b - ymin;
102 origin[2] = zlo_b;
103}
104
106inline void dumpCellLengths(const std::vector<double> &box,
107 const std::vector<double> &boxLow,
108 double lengths[3]) {
109 double H[3][3];
110 double origin[3];
111 dumpBoundsToH(box, boxLow, H, origin);
112 lengths[0] = H[0][0];
113 lengths[1] = H[1][1];
114 lengths[2] = H[2][2];
115}
116
118inline int dumpAxialDim(const std::vector<double> &box,
119 const std::vector<double> &boxLow) {
120 double lengths[3];
121 dumpCellLengths(box, boxLow, lengths);
122 int axial = 0;
123 if (lengths[1] > lengths[axial]) {
124 axial = 1;
125 }
126 if (lengths[2] > lengths[axial]) {
127 axial = 2;
128 }
129 return axial;
130}
131
132inline int dumpAxialDim(
133 const molSys::PointCloud<molSys::Point<double>, double> &yCloud) {
134 return dumpAxialDim(yCloud.box, yCloud.boxLow);
135}
136
138inline void dumpToFrac(const double H[3][3], const double origin[3], double x,
139 double y, double z, double s[3]) {
140 const double lx = H[0][0];
141 const double ly = H[1][1];
142 const double lz = H[2][2];
143 const double xy = H[1][0];
144 const double xz = H[2][0];
145 const double yz = H[2][1];
146 s[2] = (z - origin[2]) / lz;
147 s[1] = (y - origin[1] - yz * s[2]) / ly;
148 s[0] = (x - origin[0] - xy * s[1] - xz * s[2]) / lx;
149}
150
152inline void dumpFromFrac(const double H[3][3], const double origin[3],
153 const double s[3], double r[3]) {
154 r[0] = origin[0] + H[0][0] * s[0] + H[1][0] * s[1] + H[2][0] * s[2];
155 r[1] = origin[1] + H[1][1] * s[1] + H[2][1] * s[2];
156 r[2] = origin[2] + H[2][2] * s[2];
157}
158
161inline double dumpVolume(const std::vector<double> &box,
162 const std::vector<double> &boxLow) {
163 double H[3][3];
164 double origin[3];
165 dumpBoundsToH(box, boxLow, H, origin);
166 const double vol = H[0][0] * H[1][1] * H[2][2];
167 return vol < 0.0 ? -vol : vol;
168}
169
170inline double dumpVolume(
171 const molSys::PointCloud<molSys::Point<double>, double> &yCloud) {
172 return dumpVolume(yCloud.box, yCloud.boxLow);
173}
174
180inline bool setBoxFromLammpsEdges(std::vector<double> &box,
181 std::vector<double> &boxLow, double xlo,
182 double ylo, double zlo, double lx, double ly,
183 double lz, double xy, double xz, double yz) {
184 if (!(lx > 0.0 && ly > 0.0 && lz > 0.0)) {
185 box.clear();
186 boxLow.clear();
187 return false;
188 }
189 const bool tilt =
190 std::abs(xy) > 0.0 || std::abs(xz) > 0.0 || std::abs(yz) > 0.0;
191 if (!tilt) {
192 box = {lx, ly, lz};
193 boxLow = {xlo, ylo, zlo};
194 return true;
195 }
196 const double xmin = std::min(std::min(0.0, xy), std::min(xz, xy + xz));
197 const double xmax = std::max(std::max(0.0, xy), std::max(xz, xy + xz));
198 const double ymin = std::min(0.0, yz);
199 const double ymax = std::max(0.0, yz);
200 box = {lx + xmax - xmin, ly + ymax - ymin, lz, xy, xz, yz};
201 boxLow = {xlo + xmin, ylo + ymin, zlo};
202 return true;
203}
204
210inline bool setBoxFromLengthsAngles(std::vector<double> &box,
211 std::vector<double> &boxLow, double a,
212 double b, double c, double alphaDeg,
213 double betaDeg, double gammaDeg) {
214 constexpr double kDeg = 3.14159265358979323846 / 180.0;
215 const double alpha = alphaDeg * kDeg;
216 const double beta = betaDeg * kDeg;
217 const double gamma = gammaDeg * kDeg;
218 const double cosA = std::cos(alpha);
219 const double cosB = std::cos(beta);
220 const double cosG = std::cos(gamma);
221 const double sinG = std::sin(gamma);
222 if (!(a > 0.0 && b > 0.0 && c > 0.0) || std::abs(sinG) < 1e-18) {
223 box.clear();
224 boxLow.clear();
225 return false;
226 }
227 double xy = b * cosG;
228 const double ly = b * sinG;
229 double xz = c * cosB;
230 double yz = c * (cosA - cosB * cosG) / sinG;
231 // cos(90 deg) is a few ulps, not zero. A right angle must stay
232 // orthorhombic, or the pair loop takes the triclinic path.
233 const double tol = 1e-10 * std::max(a, std::max(b, c));
234 if (std::abs(xy) < tol) {
235 xy = 0.0;
236 }
237 if (std::abs(xz) < tol) {
238 xz = 0.0;
239 }
240 if (std::abs(yz) < tol) {
241 yz = 0.0;
242 }
243 const double lz2 = c * c - xz * xz - yz * yz;
244 if (!(ly > 0.0) || !(lz2 > 0.0)) {
245 box.clear();
246 boxLow.clear();
247 return false;
248 }
249 return setBoxFromLammpsEdges(box, boxLow, 0.0, 0.0, 0.0, a, ly, std::sqrt(lz2),
250 xy, xz, yz);
251}
252
253#ifdef SEAMS_HAS_LINKCELL
255inline lc_cell lammpsBoxToLcCell(const std::vector<double> &box,
256 const std::vector<double> &boxLow) {
257#ifdef SEAMS_HAS_MINIMAGE
258 const double xspan = box.size() > 0 ? box[0] : 0.0;
259 const double yspan = box.size() > 1 ? box[1] : 0.0;
260 const double zspan = box.size() > 2 ? box[2] : 0.0;
261 const double xy = box.size() >= 6 ? box[3] : 0.0;
262 const double xz = box.size() >= 6 ? box[4] : 0.0;
263 const double yz = box.size() >= 6 ? box[5] : 0.0;
264 const double xlo_b = boxLow.size() > 0 ? boxLow[0] : 0.0;
265 const double ylo_b = boxLow.size() > 1 ? boxLow[1] : 0.0;
266 const double zlo_b = boxLow.size() > 2 ? boxLow[2] : 0.0;
267 mi_cell raw{};
268 if (mi_cell_from_lammps_bounds(xspan, yspan, zspan, xy, xz, yz, xlo_b, ylo_b,
269 zlo_b, &raw) == 0) {
270 lc_cell c = lc_cell_ortho(raw.ax, raw.by, raw.cz);
271 c.ax = raw.ax;
272 c.ay = raw.ay;
273 c.az = raw.az;
274 c.bx = raw.bx;
275 c.by = raw.by;
276 c.bz = raw.bz;
277 c.cx = raw.cx;
278 c.cy = raw.cy;
279 c.cz = raw.cz;
280 c.ox = raw.ox;
281 c.oy = raw.oy;
282 c.oz = raw.oz;
283 return c;
284 }
285#endif
286 double H[3][3], o[3];
287 dumpBoundsToH(box, boxLow, H, o);
288 lc_cell c = lc_cell_ortho(H[0][0], H[1][1], H[2][2]);
289 c.ax = H[0][0];
290 c.ay = H[0][1];
291 c.az = H[0][2];
292 c.bx = H[1][0];
293 c.by = H[1][1];
294 c.bz = H[1][2];
295 c.cx = H[2][0];
296 c.cy = H[2][1];
297 c.cz = H[2][2];
298 c.ox = o[0];
299 c.oy = o[1];
300 c.oz = o[2];
301 return c;
302}
303
304inline linkcell::Cell lammpsBoxToLinkcell(const std::vector<double> &box,
305 const std::vector<double> &boxLow) {
306 return linkcell::Cell(lammpsBoxToLcCell(box, boxLow));
307}
308
313inline void residentFrameCell(const double *box, const double *boxLow,
314 int nBox, linkcell::Cell &cell,
315 const double *&frameLens) {
316 cell = linkcell::Cell::ortho(box[0], box[1], box[2]);
317 frameLens = box;
318 if (boxLow != nullptr || nBox >= 6) {
319 std::vector<double> dump(static_cast<std::size_t>(std::max(nBox, 3)));
320 for (int i = 0; i < nBox && i < static_cast<int>(dump.size()); ++i) {
321 dump[static_cast<std::size_t>(i)] = box[i];
322 }
323 std::vector<double> lo;
324 if (boxLow != nullptr) {
325 lo = {boxLow[0], boxLow[1], boxLow[2]};
326 }
327 cell = lammpsBoxToLinkcell(dump, lo);
328 frameLens = nullptr;
329 }
330}
331#endif
332
334
338std::vector<std::vector<int>> neighList(
339 double rcutoff, const molSys::PointCloud<molSys::Point<double>, double> &yCloud,
340 int typeI, int typeJ);
341
344std::vector<std::vector<int>> neighListPair(
345 double rcutoff, const molSys::PointCloud<molSys::Point<double>, double> &yCloud,
346 int typeI, int typeJ);
347
362const std::vector<std::vector<int>> &reusedShellList(
363 double rcutoff, const molSys::PointCloud<molSys::Point<double>, double> &yCloud,
364 const std::vector<char> *source);
365
378 const molSys::PointCloud<molSys::Point<double>, double> &yCloud, double rcutoff,
379 const std::vector<char> *source, std::vector<std::vector<int>> &rows,
380 bool byId = true, bool everyRow = false);
381
383 const molSys::PointCloud<molSys::Point<double>, double> &yCloud,
384 const std::vector<int> &subset, double rcutoff,
385 std::vector<std::vector<int>> &rows);
386
389void preferSerialCutoff(bool on);
390
403 const molSys::PointCloud<molSys::Point<double>, double> &yCloud,
404 const std::vector<int> *subset, double rcutoff, std::vector<int> &offsets,
405 std::vector<int> &cols, bool half = false,
406 std::vector<std::vector<int>> *directRows = nullptr, const int *indexToID = nullptr,
407 bool *wroteRows = nullptr, bool branchy = false);
408
411bool refillNeighListO(double rcutoff,
412 const molSys::PointCloud<molSys::Point<double>, double> &yCloud,
413 int typeI, std::vector<std::vector<int>> &rows);
414
417 double cutoff, std::vector<std::vector<int>> &rows);
418
423 const molSys::PointCloud<molSys::Point<double>, double> &yCloud, int k,
424 double candidateCutoff, std::vector<int> &offsets, std::vector<int> &cols);
425
430public:
431 CutoffSkin(double cutoff, double skin);
433 const std::vector<int> *subset = nullptr, bool half = false);
434 [[nodiscard]] bool lastReused() const { return reused_; }
435 [[nodiscard]] const std::vector<int> &offsets() const { return offsets_; }
436 [[nodiscard]] const std::vector<int> &cols() const { return cols_; }
437
438private:
439 double cutoff_;
440 double skin_;
441 bool half_{false};
442 bool reused_{false};
443 bool have_{false};
444 int nop_{0};
445 std::vector<double> x0_;
446 std::vector<double> y0_;
447 std::vector<double> z0_;
448 std::vector<double> box0_;
449 std::vector<double> boxLow0_;
450 std::vector<int> wideOff_;
451 std::vector<int> wideCols_;
452 std::vector<int> offsets_;
453 std::vector<int> cols_;
454 const std::vector<int> *subset_{nullptr};
455
456 bool moved(const molSys::PointCloud<molSys::Point<double>, double> &yCloud) const;
457 void filter(const molSys::PointCloud<molSys::Point<double>, double> &yCloud);
458};
459
461std::vector<std::vector<int>> idRowsFromCsr(
462 const molSys::PointCloud<molSys::Point<double>, double> &yCloud,
463 const std::vector<int> &indexToID, const std::vector<int> &offsets,
464 const std::vector<int> &cols);
465
467std::vector<std::vector<int>> indexRowsFromCsr(
468 int nop, const std::vector<int> &offsets, const std::vector<int> &cols);
469
471std::vector<std::vector<int>> halfIdRowsFromCsr(
472 const molSys::PointCloud<molSys::Point<double>, double> &yCloud,
473 const std::vector<int> &indexToID, const std::vector<int> &offsets,
474 const std::vector<int> &cols);
475
479std::vector<std::vector<int>> neighListO(
480 double rcutoff, const molSys::PointCloud<molSys::Point<double>, double> &yCloud,
481 int typeI);
482
486std::vector<std::vector<int>> neighListLinkcell(
487 double rcutoff, const molSys::PointCloud<molSys::Point<double>, double> &yCloud,
488 int typeI);
489
492std::vector<std::vector<int>> halfNeighList(
493 double rcutoff, const molSys::PointCloud<molSys::Point<double>, double> &yCloud,
494 int typeI = 1);
495
498
501std::vector<std::vector<int>> neighbourListByIndex(
502 const molSys::PointCloud<molSys::Point<double>, double> &yCloud,
503 const std::vector<std::vector<int>> &nList);
504
507std::vector<std::vector<int>> getNewNeighbourListByIndex(
508 const molSys::PointCloud<molSys::Point<double>, double> &yCloud, double cutoff);
509
525std::vector<std::vector<int>> kNearestNeighbourList(
526 const molSys::PointCloud<molSys::Point<double>, double> &yCloud, int k,
527 double candidateCutoff, int typeI, bool mutual = true);
528
532void kNearestCsr(const molSys::PointCloud<molSys::Point<double>, double> &yCloud, int k,
533 double candidateCutoff, int typeI, bool mutual, std::vector<int> &offsets,
534 std::vector<int> &cols, bool park = true);
535
540 const molSys::PointCloud<molSys::Point<double>, double> &yCloud, int k,
541 double candidateCutoff, int typeI, std::vector<double> &xyz,
542 std::vector<int> &nom);
543
546std::vector<std::vector<int>> kNearestNeighbourList(
547 const molSys::PointCloud<molSys::Point<double>, double> &yCloud, int k,
548 double candidateCutoff, const std::vector<int> &types, bool mutual = true);
549
553std::pair<std::vector<std::vector<int>>, std::vector<std::vector<int>>>
555 const molSys::PointCloud<molSys::Point<double>, double> &yCloud, int k,
556 double candidateCutoff, int typeI);
557
558std::pair<std::vector<std::vector<int>>, std::vector<std::vector<int>>>
560 const molSys::PointCloud<molSys::Point<double>, double> &yCloud, int k,
561 double candidateCutoff, const std::vector<int> &types);
562
571std::pair<double, double> shellSeparation(
572 const molSys::PointCloud<molSys::Point<double>, double> &yCloud, int k,
573 int typeI);
574
581std::vector<std::tuple<int, int, double>> nearestUnlike(
582 const molSys::PointCloud<molSys::Point<double>, double> &yCloud, int typeI,
583 int typeJ);
584
588std::vector<std::pair<int, int>> mutualNearestUnlike(
589 const molSys::PointCloud<molSys::Point<double>, double> &yCloud, int typeI,
590 int typeJ);
591
593[[nodiscard]] int clearNeighbourList(std::vector<std::vector<int>> &nList);
594
602
603BondGraph bondGraphFromName(const std::string &name);
604const char *bondGraphName(BondGraph graph);
605
615public:
618 SkinNeighborList(double cutoff, double skin, int typeI,
620
621 [[nodiscard]] BondGraph graph() const { return graph_; }
622
625 const std::vector<std::vector<int>> &
627
628 [[nodiscard]] bool lastRebuilt() const { return rebuilt_; }
630 [[nodiscard]] int lastChangedAtoms() const { return changedAtoms_; }
631 [[nodiscard]] const std::vector<std::vector<int>> &bonds() const {
632 return nList_;
633 }
634
635private:
636 double cutoff_;
637 double skin_;
638 double cutoffSq_;
639 double triggerSq_;
640 int typeI_;
641 int k_;
643 bool mutual_{true};
644 bool rebuilt_{true};
645 int changedAtoms_{0};
646 std::vector<double> x0_;
647 std::vector<double> y0_;
648 std::vector<double> z0_;
649 std::vector<double> box0_;
650 std::vector<std::pair<int, int>> candidates_;
651 std::vector<std::pair<int, int>> bonded_;
652 std::vector<std::vector<int>> nList_;
653
654 bool mustRebuild(
655 const molSys::PointCloud<molSys::Point<double>, double> &yCloud) const;
656 void rebuildCandidates(
657 const molSys::PointCloud<molSys::Point<double>, double> &yCloud);
658 void refreshBonds(
659 const molSys::PointCloud<molSys::Point<double>, double> &yCloud);
660};
661
662} // namespace nneigh
663
665#endif // SEAMS_NEIGHBOURS_H_
const std::vector< int > & cols() const
const std::vector< int > & offsets() const
bool lastReused() const
CutoffSkin(double cutoff, double skin)
bool update(const molSys::PointCloud< molSys::Point< double >, double > &yCloud, const std::vector< int > *subset=nullptr, bool half=false)
SkinNeighborList(double cutoff, double skin, int typeI, BondGraph graph=BondGraph::KnnMutual, int k=4)
const std::vector< std::vector< int > > & update(const molSys::PointCloud< molSys::Point< double >, double > &yCloud)
BondGraph graph() const
int lastChangedAtoms() const
Atoms whose cutoff bond set changed on the last update.
const std::vector< std::vector< int > > & bonds() const
File for containing generic or common functions.
The main molecular system handler.
Functions for building neighbour lists.
std::vector< std::vector< int > > idRowsFromCsr(const molSys::PointCloud< molSys::Point< double >, double > &yCloud, const std::vector< int > &indexToID, const std::vector< int > &offsets, const std::vector< int > &cols)
Atom-ID rows, self first, from a CSR of cloud indices.
std::pair< double, double > shellSeparation(const molSys::PointCloud< molSys::Point< double >, double > &yCloud, int k, int typeI)
The shell-separation certificate for the exact reduction of the k-nearest graph to the cutoff graph: ...
bool directedKNearestCsr(const molSys::PointCloud< molSys::Point< double >, double > &yCloud, int k, double candidateCutoff, std::vector< int > &offsets, std::vector< int > &cols)
Directed k nearest neighbours as a CSR of cloud indices, no self entry.
std::vector< std::vector< int > > kNearestNeighbourList(const molSys::PointCloud< molSys::Point< double >, double > &yCloud, int k, double candidateCutoff, int typeI, bool mutual=true)
Bonded graph from the k nearest neighbours of each particle rather than a distance cutoff.
const char * bondGraphName(BondGraph graph)
bool blockWindowRows(const molSys::PointCloud< molSys::Point< double >, double > &yCloud, double rcutoff, const std::vector< char > *source, std::vector< std::vector< int > > &rows, bool byId=true, bool everyRow=false)
void dumpBoundsToH(const std::vector< double > &box, const std::vector< double > &boxLow, double H[3][3], double origin[3])
LAMMPS dump bound spans to restricted triclinic H (rows a, b, c).
void dumpCellLengths(const std::vector< double > &box, const std::vector< double > &boxLow, double lengths[3])
Recovered restricted-triclinic lengths lx, ly, lz (H diagonal).
const std::vector< std::vector< int > > & reusedShellList(double rcutoff, const molSys::PointCloud< molSys::Point< double >, double > &yCloud, const std::vector< char > *source)
void kNearestPacked(const molSys::PointCloud< molSys::Point< double >, double > &yCloud, int k, double candidateCutoff, int typeI, std::vector< double > &xyz, std::vector< int > &nom)
std::pair< std::vector< std::vector< int > >, std::vector< std::vector< int > > > kNearestNeighbourPair(const molSys::PointCloud< molSys::Point< double >, double > &yCloud, int k, double candidateCutoff, int typeI)
Mutual and union k-nearest graphs from one candidate search.
std::vector< std::tuple< int, int, double > > nearestUnlike(const molSys::PointCloud< molSys::Point< double >, double > &yCloud, int typeI, int typeJ)
Nearest unlike image of each typeI particle among typeJ particles.
void dumpFromFrac(const double H[3][3], const double origin[3], const double s[3], double r[3])
Fractional to cartesian coordinates via dump H.
std::vector< std::vector< int > > indexRowsFromCsr(int nop, const std::vector< int > &offsets, const std::vector< int > &cols)
Index rows, self first, from a CSR of cloud indices.
std::vector< std::vector< int > > halfNeighList(double rcutoff, const molSys::PointCloud< molSys::Point< double >, double > &yCloud, int typeI=1)
void preferSerialCutoff(bool on)
When set, neighListO stays on the one-thread builder even if the OpenMP team is wider.
std::vector< std::pair< int, int > > mutualNearestUnlike(const molSys::PointCloud< molSys::Point< double >, double > &yCloud, int typeI, int typeJ)
Subset of nearestUnlike where j's nearest typeI is i (mutual).
int clearNeighbourList(std::vector< std::vector< int > > &nList)
Erases memory for a vector of vectors for the neighbour list.
bool setBoxFromLengthsAngles(std::vector< double > &box, std::vector< double > &boxLow, double a, double b, double c, double alphaDeg, double betaDeg, double gammaDeg)
Crystallographic lengths and angles in degrees, stored as a dump box.
void dumpToFrac(const double H[3][3], const double origin[3], double x, double y, double z, double s[3])
Cartesian to fractional coordinates via dump H.
std::vector< std::vector< int > > neighListLinkcell(double rcutoff, const molSys::PointCloud< molSys::Point< double >, double > &yCloud, int typeI)
int dumpAxialDim(const std::vector< double > &box, const std::vector< double > &boxLow)
Longest recovered length: 0 = x, 1 = y, 2 = z.
bool cellListRowsThreaded(const molSys::PointCloud< molSys::Point< double >, double > &yCloud, const std::vector< int > &subset, double rcutoff, std::vector< std::vector< int > > &rows)
std::vector< std::vector< int > > neighList(double rcutoff, const molSys::PointCloud< molSys::Point< double >, double > &yCloud, int typeI, int typeJ)
All these functions use atom IDs and not indices.
std::vector< std::vector< int > > getNewNeighbourListByIndex(const molSys::PointCloud< molSys::Point< double >, double > &yCloud, double cutoff)
bool refillIndexRows(const molSys::PointCloud< molSys::Point< double >, double > &yCloud, double cutoff, std::vector< std::vector< int > > &rows)
Same rows as getNewNeighbourListByIndex, written into rows.
bool refillNeighListO(double rcutoff, const molSys::PointCloud< molSys::Point< double >, double > &yCloud, int typeI, std::vector< std::vector< int > > &rows)
void kNearestCsr(const molSys::PointCloud< molSys::Point< double >, double > &yCloud, int k, double candidateCutoff, int typeI, bool mutual, std::vector< int > &offsets, std::vector< int > &cols, bool park=true)
std::vector< std::vector< int > > halfIdRowsFromCsr(const molSys::PointCloud< molSys::Point< double >, double > &yCloud, const std::vector< int > &indexToID, const std::vector< int > &offsets, const std::vector< int > &cols)
Half list by atom ID. The lower cloud index owns the pair.
std::vector< std::vector< int > > neighbourListByIndex(const molSys::PointCloud< molSys::Point< double >, double > &yCloud, const std::vector< std::vector< int > > &nList)
double dumpVolume(const std::vector< double > &box, const std::vector< double > &boxLow)
Triclinic dump-cell volume, the absolute value of det(H), from dumpBoundsToH.
BondGraph bondGraphFromName(const std::string &name)
bool setBoxFromLammpsEdges(std::vector< double > &box, std::vector< double > &boxLow, double xlo, double ylo, double zlo, double lx, double ly, double lz, double xy, double xz, double yz)
LAMMPS edge origin and edge lengths, plus tilt, as a dump box.
std::vector< std::vector< int > > neighListPair(double rcutoff, const molSys::PointCloud< molSys::Point< double >, double > &yCloud, int typeI, int typeJ)
bool orthoFullCsr(const molSys::PointCloud< molSys::Point< double >, double > &yCloud, const std::vector< int > *subset, double rcutoff, std::vector< int > &offsets, std::vector< int > &cols, bool half=false, std::vector< std::vector< int > > *directRows=nullptr, const int *indexToID=nullptr, bool *wroteRows=nullptr, bool branchy=false)
Full cutoff list as CSR of cloud indices.
BondGraph
Bond graph for TUM.
std::vector< std::vector< int > > neighListO(double rcutoff, const molSys::PointCloud< molSys::Point< double >, double > &yCloud, int typeI)
void dump(const Runtime &cfg, std::ostream &os)
This contains a collection of points; contains information for a particular frame.
Definition mol_sys.hpp:173
This contains per-particle information.
Definition mol_sys.hpp:152