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

Functions for generating primitive rings. More...

Classes

struct  Vertex
 This is a collection of elements, for each point, required for graph traversal. More...
struct  Graph
 This is a per-frame object, containing all the vertices for the particular frame, along with the vector of rings generated. More...
class  RingUpdater
 Exact frame-to-frame maintenance of the primitive ring network. More...
struct  RingSearchSplit

Enumerations

enum class  RingRows { Auto , Vectors , Packed }

Functions

std::vector< std::vector< int > > ringNetwork (const std::vector< std::vector< int > > &nList, int maxDepth)
std::vector< int > atomRingSizeCounts (const std::vector< std::vector< int > > &nList, int maxDepth)
std::vector< std::vector< int > > ringNetworkMinSize (const std::vector< std::vector< int > > &nList, int maxDepth, int minDepth)
std::vector< std::vector< int > > ringNetwork (const std::vector< std::vector< int > > &nList, int maxDepth, RingRows rows)
std::vector< std::vector< int > > ringNetwork (const std::vector< std::vector< int > > &nList, int maxDepth, const std::vector< char > &sources)
std::vector< std::vector< int > > ringNetwork (const std::vector< int > &offsets, const std::vector< int > &cols, int maxDepth, const std::vector< char > &sources={})
void ringSizeCounts (const std::vector< int > &offsets, const std::vector< int > &cols, int maxDepth, int *counts, int countsLen)
std::vector< std::vector< int > > ringNetworkBalls (const std::vector< std::vector< int > > &nList, int maxDepth)
int lastRingSearchUsedBalls ()
Graph populateGraphFromNListID (molSys::PointCloud< molSys::Point< double >, double > &yCloud, const std::vector< std::vector< int > > &neighHbondList)
Graph populateGraphFromIndices (const std::vector< std::vector< int > > &nList)
void restoreEdgesFromIndices (Graph &fullGraph, const std::vector< std::vector< int > > &nList)
Graph countAllRingsFromIndex (const std::vector< std::vector< int > > &neighHbondList, int maxDepth)
 Creates a vector of vectors of all possible rings.
void removeNonSPrings (Graph &fullGraph)
 Removes the non-SP rings, using the Franzblau shortest path criterion.
int findRings (Graph &fullGraph, int v, std::vector< int > &visited, int maxDepth, int depth, int root=-1)
 Main function that searches for all rings.
int shortestPath (Graph &fullGraph, int v, int goal, std::vector< int > &path, std::vector< int > &visited, int maxDepth, int depth=1)
 Calculates the shortest path.
Graph clearGraph (Graph &currentGraph)
 Function for clearing vectors in Graph after multiple usage.
RingSearchSplit lastRingSearchSplit ()
 Balls, source enumeration and the gather from the last ringNetwork call.
void setPhaseTiming (bool on)
 When set, ringNetwork records the primitive-test time in the split.
double takePrimitiveMs ()
 Primitive-test milliseconds from the last timed ringNetwork, then zero.
void setSourceWork (double *microseconds)

Detailed Description

Functions for generating primitive rings.

This namespace contains struct definitions and functions that are used for generating primitive (shortest-path) rings (directed cyclic graphs).

The Vertex object is a collection of elements for each point, required for graph traversal. The Graph object is an object for the whole frame, containing the information of all vertices, and a row-ordered vector of vector of the rings generated.

The Franzblau shortest-path criterion has been used. The SP (shortest-path) criterion is midway between the least restrictive and most restrictive criteria in the hierarchy.

The following is the procedure for finding primitive rings:

  1. All possible rings (including non-SP) rings are found, in the primitive::countAllRingsFromIndex function, using the backtracking algorithm. This is a recursive algorithm.
  2. The non-SP rings are then removed from the list of all rings, using the Franzblau shortest path criterion (primitive::removeNonSPrings), answered by a hop-bounded breadth-first sweep per vertex.

Changelog

Enumeration Type Documentation

◆ RingRows

enum class primitive::RingRows
strong

Which adjacency the ring search packs before it walks. Auto uses one sorted array per row: a single pass on one thread, a team on several. Vectors keeps a std::vector per atom. Packed forces the array even when the team has one thread. The ring set does not depend on the choice.

Enumerator
Auto 
Vectors 
Packed 

Definition at line 138 of file franzblau.hpp.

Function Documentation

◆ atomRingSizeCounts()

std::vector< int > primitive::atomRingSizeCounts ( const std::vector< std::vector< int > > & nList,
int maxDepth )

Per-atom primitive-ring counts, without storing the rings. counts[atom * (maxDepth + 1) + size] is how many rings of that size contain the atom.

◆ clearGraph()

Graph primitive::clearGraph ( Graph & currentGraph)

Function for clearing vectors in Graph after multiple usage.

◆ countAllRingsFromIndex()

Graph primitive::countAllRingsFromIndex ( const std::vector< std::vector< int > > & neighHbondList,
int maxDepth )

Creates a vector of vectors of all possible rings.

◆ findRings()

int primitive::findRings ( Graph & fullGraph,
int v,
std::vector< int > & visited,
int maxDepth,
int depth,
int root = -1 )
nodiscard

Main function that searches for all rings.

◆ lastRingSearchSplit()

RingSearchSplit primitive::lastRingSearchSplit ( )
nodiscard

Balls, source enumeration and the gather from the last ringNetwork call.

◆ lastRingSearchUsedBalls()

int primitive::lastRingSearchUsedBalls ( )
nodiscard

0 when the last ringNetwork call answered every primitivity query from the adjacency rows, 1 when it filled the sorted pair table, 2 when it filled the occupancy bitset of a radius-4 ball, 3 when a radius-2 pair table answers distance 4 by a meet in the middle. Rings of size at most 7 report 0. Rings of size 8 and 9 report 1. Rings of size 10 report 3. ringNetworkBalls always reports 1.

◆ populateGraphFromIndices()

Graph primitive::populateGraphFromIndices ( const std::vector< std::vector< int > > & nList)

Creates a graph object and fills it with the information from a neighbour list of INDICES NOT ATOM IDs created before. NOTE: the neighbourListIndex contains the indices and NOT the atom IDs as in the neighbour list

◆ populateGraphFromNListID()

Graph primitive::populateGraphFromNListID ( molSys::PointCloud< molSys::Point< double >, double > & yCloud,
const std::vector< std::vector< int > > & neighHbondList )

Creates a graph object and fills it with the information from a neighbour list and pointCloud created before. NOTE: the neighbourListIndex contains the indices and NOT the atom IDs as in the neighbour list

◆ removeNonSPrings()

void primitive::removeNonSPrings ( Graph & fullGraph)

Removes the non-SP rings, using the Franzblau shortest path criterion.

◆ restoreEdgesFromIndices()

void primitive::restoreEdgesFromIndices ( Graph & fullGraph,
const std::vector< std::vector< int > > & nList )

Re-fills the neighbour lists of a graph object from a neighbour list of INDICES NOT ATOM IDs created before. NOTE: the neighbourListIndex contains the indices and NOT the atom IDs as in the neighbour list

◆ ringNetwork() [1/4]

std::vector< std::vector< int > > primitive::ringNetwork ( const std::vector< int > & offsets,
const std::vector< int > & cols,
int maxDepth,
const std::vector< char > & sources = {} )

Rings of a CSR neighbour graph. cols[offsets[i] .. offsets[i + 1]] are the neighbours of vertex i, with no self entry. The ring set is the one ringNetwork returns for those rows with the vertex written in front of each row.

◆ ringNetwork() [2/4]

std::vector< std::vector< int > > primitive::ringNetwork ( const std::vector< std::vector< int > > & nList,
int maxDepth )

Returns a vector of vectors containing the rings (of all sizes), by atom index, given the neighbour list also by index (preferably the hydrogen-bonded neighbour list). Each ring starts at its lowest-indexed member and runs toward the lesser of that member's ring neighbours, and the rings are sorted lexicographically.

◆ ringNetwork() [3/4]

std::vector< std::vector< int > > primitive::ringNetwork ( const std::vector< std::vector< int > > & nList,
int maxDepth,
const std::vector< char > & sources )

The rings ringNetwork returns whose lowest-indexed member is flagged in sources (by index; empty flags every vertex), in the same order

◆ ringNetwork() [4/4]

std::vector< std::vector< int > > primitive::ringNetwork ( const std::vector< std::vector< int > > & nList,
int maxDepth,
RingRows rows )

◆ ringNetworkBalls()

std::vector< std::vector< int > > primitive::ringNetworkBalls ( const std::vector< std::vector< int > > & nList,
int maxDepth )

The same ring set, built with a bounded ball at every vertex and a primitivity test of every pair. ringNetwork leaves that table out when the largest ring is at most 7, because a strict shortcut is then a walk of at most two edges. The timing harness compares the two.

◆ ringNetworkMinSize()

std::vector< std::vector< int > > primitive::ringNetworkMinSize ( const std::vector< std::vector< int > > & nList,
int maxDepth,
int minDepth )

Primitive rings whose size is at least minDepth and at most maxDepth. ringNetwork(nList, maxDepth) is minDepth 3. A separate name keeps ringNetwork(nList, maxDepth, {}) the empty source mask.

◆ ringSizeCounts()

void primitive::ringSizeCounts ( const std::vector< int > & offsets,
const std::vector< int > & cols,
int maxDepth,
int * counts,
int countsLen )

Ring sizes of the same search as ringNetwork(offsets, cols, maxDepth). counts[s] is the number of primitive rings of size s, for s below countsLen. The rings themselves are not gathered.

◆ setPhaseTiming()

void primitive::setPhaseTiming ( bool on)

When set, ringNetwork records the primitive-test time in the split.

◆ setSourceWork()

void primitive::setSourceWork ( double * microseconds)

When non-null, ringNetwork adds each source's enumeration time, in microseconds, at that source's index. The buffer must hold one entry per neighbour-list row. A null buffer skips the clock.

◆ shortestPath()

int primitive::shortestPath ( Graph & fullGraph,
int v,
int goal,
std::vector< int > & path,
std::vector< int > & visited,
int maxDepth,
int depth = 1 )
nodiscard

Calculates the shortest path.

◆ takePrimitiveMs()

double primitive::takePrimitiveMs ( )

Primitive-test milliseconds from the last timed ringNetwork, then zero.