seams-core v2.14.0
libyodaLib, the C++ engine of d-SEAMS
Loading...
Searching...
No Matches
tum::device Namespace Reference

Functions

bool bonded (const int *deg, const int *cols, int nAtoms, int kMax, int a, int b)
bool inSix (const int *r, int atom)
bool shareAtoms (const int *a, const int *b)
int commonCount (const int *a, const int *b)
bool commonInThree (const int *a, const int *b, const int *c)
bool shareNeigh (const int *deg, const int *cols, int nAtoms, int kMax, int a, int b)
int hopsAtMost (const int *deg, const int *cols, int nAtoms, int kMax, int a, int b, int cap)
 Graph distance from a to b when it is at most cap, else -1.
bool hopBoundPrimitiveSix (const int *r, const int *deg, const int *cols, int nAtoms, int kMax)
 Hop-bounded Franzblau SP test on a six-cycle of the bond graph.
bool notNeighboursOfRing (const int *deg, const int *cols, int nAtoms, int kMax, const int *trip, const int *ring)
bool basalConditions (const int *deg, const int *cols, int nAtoms, int kMax, const int *b1, const int *b2)
 beta(b1, b2) for rings sharing no atom: some alternating triplet {l_p, l_p+2, l_p+4} of b1 bonds one-to-one onto an alternating triplet {m_q, m_q+2, m_q+4} of b2, and no other atom of b2 is bonded to b1.
int ringsThrough (const int *A, int nA, const int *B, int nB, const int *C, int nC, int skipA, int skipB, int *out, int cap)
int fetchAdd (int *p)
void enumSixFrom (int i, const int *deg, const int *cols, int nAtoms, int kMax, int maxRings, int *nRings, int *ringAtoms)
 Enumerate hop-bound primitive six-rings whose lowest vertex is i.
void invertOneRing (int r, const int *nRings, const int *ringAtoms, int nAtoms, int maxPer, int *throughCount, int *through)
 throughCount counts every stored ring through the atom; only the first maxPer ids are kept.
void sortThroughRow (int *row, int n)
bool seenEarlier (const int *bi, const int *deg, const int *cols, const int *throughCount, const int *through, int nAtoms, int kMax, int maxPer, int slot, int n, int j)
 True when ring j is in the through row of a bond neighbour of bi[0] or bi[1] visited before (slot, n), so each candidate is tested once.
void emitBasalFrom (int i, const int *nRings, const int *ringAtoms, const int *deg, const int *cols, const int *throughCount, const int *through, int nAtoms, int kMax, int maxPer, int maxPairs, int *nPairs, int *pairs)
 Ordered basal pairs (i, j).
void applyHcPair (int p, const int *nPairs, const int *pairs, const int *ringAtoms, const int *throughCount, const int *through, int nAtoms, int maxPer, int *hc)
void ddcFrom (int i, const int *nRings, const int *ringAtoms, const int *throughCount, const int *through, const int *hc, int nAtoms, int maxPer, int *ddc)
 epsilon(i) for a ring that is not HC, as ring::equatorialConditions: every atom in 3 other rings, and pairwise distinct P_k in T_k with P_0, P_2, P_4 sharing an atom, P_1, P_3, P_5 sharing an atom and, for some starting atom and direction of i, the alternate pairs sharing 3 atoms.
void atomIceFrom (int r, const int *nRings, const int *ringAtoms, const int *hc, const int *ddc, int nAtoms, int *atomHc, int *atomDdc)

Variables

constexpr int kRowCap = 32
 Longest atom row the kernels accept.

Function Documentation

◆ applyHcPair()

void tum::device::applyHcPair ( int p,
const int * nPairs,
const int * pairs,
const int * ringAtoms,
const int * throughCount,
const int * through,
int nAtoms,
int maxPer,
int * hc )
inline

Definition at line 404 of file tum_device.hpp.

406 {
407 if (p >= *nPairs) {
408 return;
409 }
410 const int i = pairs[p * 2];
411 const int j = pairs[p * 2 + 1];
412 hc[i] = 1;
413 hc[j] = 1;
414 const int *bi = ringAtoms + i * 6;
415 const int *bj = ringAtoms + j * 6;
416 for (int q = 0; q < 6; ++q) {
417 int trip[3];
418 for (int m = 0; m < 3; ++m) {
419 trip[m] = bi[(q + m) % 6];
420 }
421 const int nA = throughCount[trip[0]];
422 const int nB = throughCount[trip[1]];
423 const int nC = throughCount[trip[2]];
424 const int *A = through + trip[0] * maxPer;
425 const int *B = through + trip[1] * maxPer;
426 const int *C = through + trip[2] * maxPer;
427 int cand[kRowCap];
428 const int nc = ringsThrough(A, nA, B, nB, C, nC, i, j, cand, kRowCap);
429 for (int c = 0; c < nc; ++c) {
430 const int kr = cand[c];
431 const int *bk = ringAtoms + kr * 6;
432 int rest = 0;
433 int restInJ = 0;
434 for (int u = 0; u < 6; ++u) {
435 const int a = bk[u];
436 if (a != trip[0] && a != trip[1] && a != trip[2]) {
437 ++rest;
438 if (inSix(bj, a)) {
439 ++restInJ;
440 }
441 }
442 }
443 if (rest == 3 && restInJ == 3) {
444 hc[kr] = 1;
445 }
446 }
447 }
448}
@ hc
Type for an atom which belongs to an HC.
Definition cage.hpp:107
bool inSix(const int *r, int atom)
int ringsThrough(const int *A, int nA, const int *B, int nB, const int *C, int nC, int skipA, int skipB, int *out, int cap)
constexpr int kRowCap
Longest atom row the kernels accept.

◆ atomIceFrom()

void tum::device::atomIceFrom ( int r,
const int * nRings,
const int * ringAtoms,
const int * hc,
const int * ddc,
int nAtoms,
int * atomHc,
int * atomDdc )
inline

Definition at line 591 of file tum_device.hpp.

593 {
594 if (r >= *nRings) {
595 return;
596 }
597 const int *ring = ringAtoms + r * 6;
598 const int isHc = hc[r];
599 const int isDdc = ddc[r];
600 for (int t = 0; t < 6; ++t) {
601 const int a = ring[t];
602 if (a < 0 || a >= nAtoms) {
603 continue;
604 }
605 if (isHc) {
606 atomHc[a] = 1;
607 }
608 if (isDdc) {
609 atomDdc[a] = 1;
610 }
611 }
612}
Topological network criteria functions.

◆ basalConditions()

bool tum::device::basalConditions ( const int * deg,
const int * cols,
int nAtoms,
int kMax,
const int * b1,
const int * b2 )
inline

beta(b1, b2) for rings sharing no atom: some alternating triplet {l_p, l_p+2, l_p+4} of b1 bonds one-to-one onto an alternating triplet {m_q, m_q+2, m_q+4} of b2, and no other atom of b2 is bonded to b1.

All 2 x 2 x 6 alignments are tried, so rotation, direction and ring order do not matter.

Definition at line 147 of file tum_device.hpp.

148 {
149 const int perm[6][3] = {{0, 1, 2}, {0, 2, 1}, {1, 0, 2},
150 {1, 2, 0}, {2, 0, 1}, {2, 1, 0}};
151 for (int q = 0; q < 2; ++q) {
152 const int oddT[3] = {b2[q + 1], b2[q + 3], b2[(q + 5) % 6]};
153 if (!notNeighboursOfRing(deg, cols, nAtoms, kMax, oddT, b1)) {
154 continue;
155 }
156 for (int p = 0; p < 2; ++p) {
157 for (int s = 0; s < 6; ++s) {
158 bool all = true;
159 for (int t = 0; t < 3 && all; ++t) {
160 all = bonded(deg, cols, nAtoms, kMax, b1[p + 2 * t],
161 b2[q + 2 * perm[s][t]]);
162 }
163 if (all) {
164 return true;
165 }
166 }
167 }
168 }
169 return false;
170}
bool bonded(const int *deg, const int *cols, int nAtoms, int kMax, int a, int b)
bool notNeighboursOfRing(const int *deg, const int *cols, int nAtoms, int kMax, const int *trip, const int *ring)

◆ bonded()

bool tum::device::bonded ( const int * deg,
const int * cols,
int nAtoms,
int kMax,
int a,
int b )
inline

Definition at line 32 of file tum_device.hpp.

33 {
34 if (a < 0 || b < 0 || a >= nAtoms || b >= nAtoms) {
35 return false;
36 }
37 const int d = deg[a];
38 const int row = a * kMax;
39 for (int t = 0; t < d; ++t) {
40 if (cols[row + t] == b) {
41 return true;
42 }
43 }
44 return false;
45}

◆ commonCount()

int tum::device::commonCount ( const int * a,
const int * b )
inline

Definition at line 65 of file tum_device.hpp.

65 {
66 int n = 0;
67 for (int i = 0; i < 6; ++i) {
68 if (inSix(b, a[i])) {
69 ++n;
70 }
71 }
72 return n;
73}

◆ commonInThree()

bool tum::device::commonInThree ( const int * a,
const int * b,
const int * c )
inline

Definition at line 75 of file tum_device.hpp.

75 {
76 for (int i = 0; i < 6; ++i) {
77 if (inSix(b, a[i]) && inSix(c, a[i])) {
78 return true;
79 }
80 }
81 return false;
82}

◆ ddcFrom()

void tum::device::ddcFrom ( int i,
const int * nRings,
const int * ringAtoms,
const int * throughCount,
const int * through,
const int * hc,
int nAtoms,
int maxPer,
int * ddc )
inline

epsilon(i) for a ring that is not HC, as ring::equatorialConditions: every atom in 3 other rings, and pairwise distinct P_k in T_k with P_0, P_2, P_4 sharing an atom, P_1, P_3, P_5 sharing an atom and, for some starting atom and direction of i, the alternate pairs sharing 3 atoms.

On a pass marks i and every P_k of every valid assignment.

Definition at line 455 of file tum_device.hpp.

457 {
458 if (i >= *nRings) {
459 return;
460 }
461 if (hc[i]) {
462 return;
463 }
464 const int *bi = ringAtoms + i * 6;
465 for (int m = 0; m < 6; ++m) {
466 const int atom = bi[m];
467 if (atom < 0 || atom >= nAtoms) {
468 return;
469 }
470 const int nr = throughCount[atom];
471 const int *row = through + atom * maxPer;
472 int common = 0;
473 for (int t = 0; t < nr; ++t) {
474 if (row[t] != i) {
475 ++common;
476 }
477 }
478 if (common < 3) {
479 return;
480 }
481 }
482 // T[k]: every ring but i through bi[k], bi[k+1], bi[k+2]
483 int T[6][kRowCap];
484 int nT[6];
485 for (int k = 0; k < 6; ++k) {
486 int trip[3];
487 for (int t = 0; t < 3; ++t) {
488 trip[t] = bi[(k + t) % 6];
489 }
490 const int nA = throughCount[trip[0]];
491 const int nB = throughCount[trip[1]];
492 const int nC = throughCount[trip[2]];
493 const int *A = through + trip[0] * maxPer;
494 const int *B = through + trip[1] * maxPer;
495 const int *C = through + trip[2] * maxPer;
496 nT[k] = ringsThrough(A, nA, B, nB, C, nC, i, -1, T[k], kRowCap);
497 if (nT[k] == 0) {
498 return;
499 }
500 }
501 // Bit t of used[k] marks T[k][t] as P_k of some valid assignment
502 unsigned used[6] = {0U, 0U, 0U, 0U, 0U, 0U};
503 bool any = false;
504 for (int a = 0; a < nT[0]; ++a) {
505 const int r0 = T[0][a];
506 const int *p0 = ringAtoms + r0 * 6;
507 for (int c = 0; c < nT[2]; ++c) {
508 const int r2 = T[2][c];
509 const int *p2 = ringAtoms + r2 * 6;
510 if (r2 == r0) {
511 continue;
512 }
513 const bool e02 = commonCount(p0, p2) >= 3;
514 for (int e = 0; e < nT[4]; ++e) {
515 const int r4 = T[4][e];
516 const int *p4 = ringAtoms + r4 * 6;
517 if (r4 == r0 || r4 == r2 || !commonInThree(p0, p2, p4)) {
518 continue;
519 }
520 const bool e24 = commonCount(p2, p4) >= 3;
521 const bool e40 = commonCount(p4, p0) >= 3;
522 // Bit t: the ring on triplet 2t shares 3 atoms with both others
523 const unsigned mE = (e40 && e02 ? 1U : 0U) |
524 (e02 && e24 ? 2U : 0U) |
525 (e24 && e40 ? 4U : 0U);
526 if (mE == 0U) {
527 continue;
528 }
529 // Some start and direction of i puts an even middle 2t next to an
530 // odd middle 2t+1 or 2t-1
531 unsigned partners = 0U;
532 for (int t = 0; t < 3; ++t) {
533 if ((mE >> t) & 1U) {
534 partners |= (1U << t) | (1U << ((t + 2) % 3));
535 }
536 }
537 for (int b = 0; b < nT[1]; ++b) {
538 const int r1 = T[1][b];
539 const int *p1 = ringAtoms + r1 * 6;
540 if (r1 == r0 || r1 == r2 || r1 == r4) {
541 continue;
542 }
543 for (int d = 0; d < nT[3]; ++d) {
544 const int r3 = T[3][d];
545 const int *p3 = ringAtoms + r3 * 6;
546 if (r3 == r0 || r3 == r2 || r3 == r4 || r3 == r1) {
547 continue;
548 }
549 const bool o13 = commonCount(p1, p3) >= 3;
550 for (int g = 0; g < nT[5]; ++g) {
551 const int r5 = T[5][g];
552 const int *p5 = ringAtoms + r5 * 6;
553 if (r5 == r0 || r5 == r2 || r5 == r4 || r5 == r1 || r5 == r3 ||
554 !commonInThree(p1, p3, p5)) {
555 continue;
556 }
557 const bool o35 = commonCount(p3, p5) >= 3;
558 const bool o51 = commonCount(p5, p1) >= 3;
559 const unsigned mO = (o51 && o13 ? 1U : 0U) |
560 (o13 && o35 ? 2U : 0U) |
561 (o35 && o51 ? 4U : 0U);
562 if ((partners & mO) == 0U) {
563 continue;
564 }
565 any = true;
566 used[0] |= 1U << a;
567 used[1] |= 1U << b;
568 used[2] |= 1U << c;
569 used[3] |= 1U << d;
570 used[4] |= 1U << e;
571 used[5] |= 1U << g;
572 }
573 }
574 }
575 }
576 }
577 }
578 if (!any) {
579 return;
580 }
581 ddc[i] = 1;
582 for (int k = 0; k < 6; ++k) {
583 for (int t = 0; t < nT[k]; ++t) {
584 if ((used[k] >> t) & 1U) {
585 ddc[T[k][t]] = 1;
586 }
587 }
588 }
589}
@ ddc
Type for an atom which belongs to a DDC.
Definition cage.hpp:107
bool commonInThree(const int *a, const int *b, const int *c)
int commonCount(const int *a, const int *b)

◆ emitBasalFrom()

void tum::device::emitBasalFrom ( int i,
const int * nRings,
const int * ringAtoms,
const int * deg,
const int * cols,
const int * throughCount,
const int * through,
int nAtoms,
int kMax,
int maxPer,
int maxPairs,
int * nPairs,
int * pairs )
inline

Ordered basal pairs (i, j).

Every pair passing beta has a bond from bi[0] or bi[1] into bj, so the neighbours of those two atoms reach every candidate.

Definition at line 355 of file tum_device.hpp.

359 {
360 if (i >= *nRings) {
361 return;
362 }
363 const int *bi = ringAtoms + i * 6;
364 for (int slot = 0; slot < 2; ++slot) {
365 const int anchor = bi[slot];
366 if (anchor < 0 || anchor >= nAtoms) {
367 continue;
368 }
369 const int da = deg[anchor];
370 const int arow = anchor * kMax;
371 for (int n = 0; n < da; ++n) {
372 const int nb = cols[arow + n];
373 if (nb < 0 || nb >= nAtoms) {
374 continue;
375 }
376 const int nr = throughCount[nb];
377 const int *row = through + nb * maxPer;
378 for (int t = 0; t < nr; ++t) {
379 const int j = row[t];
380 if (j == i) {
381 continue;
382 }
383 if (seenEarlier(bi, deg, cols, throughCount, through, nAtoms, kMax,
384 maxPer, slot, n, j)) {
385 continue;
386 }
387 const int *bj = ringAtoms + j * 6;
388 if (shareAtoms(bi, bj)) {
389 continue;
390 }
391 if (!basalConditions(deg, cols, nAtoms, kMax, bi, bj)) {
392 continue;
393 }
394 const int slotp = fetchAdd(nPairs);
395 if (slotp < maxPairs) {
396 pairs[slotp * 2] = i;
397 pairs[slotp * 2 + 1] = j;
398 }
399 }
400 }
401 }
402}
int fetchAdd(int *p)
bool seenEarlier(const int *bi, const int *deg, const int *cols, const int *throughCount, const int *through, int nAtoms, int kMax, int maxPer, int slot, int n, int j)
True when ring j is in the through row of a bond neighbour of bi[0] or bi[1] visited before (slot,...
bool shareAtoms(const int *a, const int *b)
bool basalConditions(const int *deg, const int *cols, int nAtoms, int kMax, const int *b1, const int *b2)
beta(b1, b2) for rings sharing no atom: some alternating triplet {l_p, l_p+2, l_p+4}...

◆ enumSixFrom()

void tum::device::enumSixFrom ( int i,
const int * deg,
const int * cols,
int nAtoms,
int kMax,
int maxRings,
int * nRings,
int * ringAtoms )
inline

Enumerate hop-bound primitive six-rings whose lowest vertex is i.

nRings counts every ring found; only the first maxRings are stored.

Definition at line 225 of file tum_device.hpp.

226 {
227 const int di = deg[i];
228 if (di < 2) {
229 return;
230 }
231 const int irow = i * kMax;
232 for (int ia = 0; ia < di; ++ia) {
233 const int a = cols[irow + ia];
234 for (int ib = ia + 1; ib < di; ++ib) {
235 const int b = cols[irow + ib];
236 const int da = deg[a];
237 const int db = deg[b];
238 const int arow = a * kMax;
239 const int brow = b * kMax;
240 for (int ix = 0; ix < da; ++ix) {
241 const int x = cols[arow + ix];
242 if (x == i || x == b) {
243 continue;
244 }
245 for (int iy = 0; iy < db; ++iy) {
246 const int y = cols[brow + iy];
247 if (y == i || y == a || y == x) {
248 continue;
249 }
250 const int dx = deg[x];
251 const int xrow = x * kMax;
252 for (int iz = 0; iz < dx; ++iz) {
253 const int z = cols[xrow + iz];
254 if (z == i || z == a || z == b || z == y) {
255 continue;
256 }
257 if (!bonded(deg, cols, nAtoms, kMax, z, y)) {
258 continue;
259 }
260 const int cyc[6] = {i, a, x, z, y, b};
261 int mn = i;
262 for (int t = 1; t < 6; ++t) {
263 if (cyc[t] < mn) {
264 mn = cyc[t];
265 }
266 }
267 if (mn != i) {
268 continue;
269 }
270 if (!hopBoundPrimitiveSix(cyc, deg, cols, nAtoms, kMax)) {
271 continue;
272 }
273 const int slot = fetchAdd(nRings);
274 if (slot >= maxRings) {
275 continue;
276 }
277 const int dest = slot * 6;
278 for (int t = 0; t < 6; ++t) {
279 ringAtoms[dest + t] = cyc[t];
280 }
281 }
282 }
283 }
284 }
285 }
286}
bool hopBoundPrimitiveSix(const int *r, const int *deg, const int *cols, int nAtoms, int kMax)
Hop-bounded Franzblau SP test on a six-cycle of the bond graph.

◆ fetchAdd()

int tum::device::fetchAdd ( int * p)
inline

Definition at line 212 of file tum_device.hpp.

212 {
213 int old;
214#if defined(_OPENMP)
215#pragma omp atomic capture
216 old = (*p)++;
217#else
218 old = (*p)++;
219#endif
220 return old;
221}

◆ hopBoundPrimitiveSix()

bool tum::device::hopBoundPrimitiveSix ( const int * r,
const int * deg,
const int * cols,
int nAtoms,
int kMax )
inline

Hop-bounded Franzblau SP test on a six-cycle of the bond graph.

Definition at line 116 of file tum_device.hpp.

117 {
118 const int pairI[9] = {0, 1, 2, 3, 4, 5, 0, 1, 2};
119 const int pairJ[9] = {2, 3, 4, 5, 0, 1, 3, 4, 5};
120 const int ringHops[9] = {2, 2, 2, 2, 2, 2, 3, 3, 3};
121 for (int t = 0; t < 9; ++t) {
122 if (hopsAtMost(deg, cols, nAtoms, kMax, r[pairI[t]], r[pairJ[t]],
123 ringHops[t] - 1) >= 0) {
124 return false;
125 }
126 }
127 return true;
128}
int hopsAtMost(const int *deg, const int *cols, int nAtoms, int kMax, int a, int b, int cap)
Graph distance from a to b when it is at most cap, else -1.

◆ hopsAtMost()

int tum::device::hopsAtMost ( const int * deg,
const int * cols,
int nAtoms,
int kMax,
int a,
int b,
int cap )
inline

Graph distance from a to b when it is at most cap, else -1.

cap is 1 or 2: the Franzblau reject bound for a six-ring.

Definition at line 98 of file tum_device.hpp.

99 {
100 if (a == b) {
101 return 0;
102 }
103 if (bonded(deg, cols, nAtoms, kMax, a, b)) {
104 return 1;
105 }
106 if (cap < 2) {
107 return -1;
108 }
109 if (shareNeigh(deg, cols, nAtoms, kMax, a, b)) {
110 return 2;
111 }
112 return -1;
113}
bool shareNeigh(const int *deg, const int *cols, int nAtoms, int kMax, int a, int b)

◆ inSix()

bool tum::device::inSix ( const int * r,
int atom )
inline

Definition at line 47 of file tum_device.hpp.

47 {
48 for (int t = 0; t < 6; ++t) {
49 if (r[t] == atom) {
50 return true;
51 }
52 }
53 return false;
54}

◆ invertOneRing()

void tum::device::invertOneRing ( int r,
const int * nRings,
const int * ringAtoms,
int nAtoms,
int maxPer,
int * throughCount,
int * through )
inline

throughCount counts every stored ring through the atom; only the first maxPer ids are kept.

Definition at line 290 of file tum_device.hpp.

292 {
293 if (r >= *nRings) {
294 return;
295 }
296 const int *ring = ringAtoms + r * 6;
297 for (int t = 0; t < 6; ++t) {
298 const int atom = ring[t];
299 if (atom < 0 || atom >= nAtoms) {
300 continue;
301 }
302 const int slot = fetchAdd(throughCount + atom);
303 if (slot < maxPer) {
304 through[atom * maxPer + slot] = r;
305 }
306 }
307}

◆ notNeighboursOfRing()

bool tum::device::notNeighboursOfRing ( const int * deg,
const int * cols,
int nAtoms,
int kMax,
const int * trip,
const int * ring )
inline

Definition at line 130 of file tum_device.hpp.

131 {
132 for (int i = 0; i < 3; ++i) {
133 for (int j = 0; j < 6; ++j) {
134 if (bonded(deg, cols, nAtoms, kMax, ring[j], trip[i])) {
135 return false;
136 }
137 }
138 }
139 return true;
140}

◆ ringsThrough()

int tum::device::ringsThrough ( const int * A,
int nA,
const int * B,
int nB,
const int * C,
int nC,
int skipA,
int skipB,
int * out,
int cap )
inline

Definition at line 172 of file tum_device.hpp.

174 {
175 int i = 0;
176 int j = 0;
177 int k = 0;
178 int n = 0;
179 while (i < nA && j < nB && k < nC) {
180 const int x = A[i];
181 const int y = B[j];
182 const int z = C[k];
183 if (x == y && y == z) {
184 if (x != skipA && x != skipB && n < cap) {
185 out[n++] = x;
186 }
187 ++i;
188 ++j;
189 ++k;
190 continue;
191 }
192 int lo = x;
193 if (y < lo) {
194 lo = y;
195 }
196 if (z < lo) {
197 lo = z;
198 }
199 if (x == lo) {
200 ++i;
201 }
202 if (y == lo) {
203 ++j;
204 }
205 if (z == lo) {
206 ++k;
207 }
208 }
209 return n;
210}

◆ seenEarlier()

bool tum::device::seenEarlier ( const int * bi,
const int * deg,
const int * cols,
const int * throughCount,
const int * through,
int nAtoms,
int kMax,
int maxPer,
int slot,
int n,
int j )
inline

True when ring j is in the through row of a bond neighbour of bi[0] or bi[1] visited before (slot, n), so each candidate is tested once.

Definition at line 324 of file tum_device.hpp.

327 {
328 for (int s = 0; s <= slot; ++s) {
329 const int anchor = bi[s];
330 if (anchor < 0 || anchor >= nAtoms) {
331 continue;
332 }
333 const int arow = anchor * kMax;
334 const int stop = s < slot ? deg[anchor] : n;
335 for (int m = 0; m < stop; ++m) {
336 const int nb = cols[arow + m];
337 if (nb < 0 || nb >= nAtoms) {
338 continue;
339 }
340 const int nr = throughCount[nb];
341 const int *row = through + nb * maxPer;
342 for (int t = 0; t < nr; ++t) {
343 if (row[t] == j) {
344 return true;
345 }
346 }
347 }
348 }
349 return false;
350}

◆ shareAtoms()

bool tum::device::shareAtoms ( const int * a,
const int * b )
inline

Definition at line 56 of file tum_device.hpp.

56 {
57 for (int i = 0; i < 6; ++i) {
58 if (inSix(b, a[i])) {
59 return true;
60 }
61 }
62 return false;
63}

◆ shareNeigh()

bool tum::device::shareNeigh ( const int * deg,
const int * cols,
int nAtoms,
int kMax,
int a,
int b )
inline

Definition at line 84 of file tum_device.hpp.

85 {
86 const int da = deg[a];
87 const int ra = a * kMax;
88 for (int t = 0; t < da; ++t) {
89 if (bonded(deg, cols, nAtoms, kMax, b, cols[ra + t])) {
90 return true;
91 }
92 }
93 return false;
94}

◆ sortThroughRow()

void tum::device::sortThroughRow ( int * row,
int n )
inline

Definition at line 309 of file tum_device.hpp.

309 {
310 for (int a = 1; a < n; ++a) {
311 const int key = row[a];
312 int p = a;
313 while (p > 0 && row[p - 1] > key) {
314 row[p] = row[p - 1];
315 --p;
316 }
317 row[p] = key;
318 }
319}

Variable Documentation

◆ kRowCap

int tum::device::kRowCap = 32
constexpr

Longest atom row the kernels accept.

Candidate buffers are sized by it and ddcFrom keeps one bit per entry in an unsigned. A liquid atom of a 3.5 A cutoff graph can lie in more than 16 six-rings; a graph with a longer row goes to the host (tum_offload.hpp).

Definition at line 29 of file tum_device.hpp.