namespace topo

Overview

namespace topo {
 
// typedefs
 
typedef std::vector<std::vector<int>> Rows;
 
// structs
 
struct FrameFingerprint;
struct KeyLibrary;
struct LibraryMatch;
struct LocalKey;
 
// global functions
 
std::vector<int> hopNeighbourhood(const Rows& rows, int atom, int hops);
std::uint64_t wlHash(const std::vector<std::vector<int>>& adjacency, int root, int rounds, const std::vector<int>& colours = {});
LocalKey localKey(const Rows& rows, int atom, int hops, const std::vector<int>& colours = {});
FrameFingerprint fingerprint(const Rows& rows, int hops = 2, int maxRingSize = 7, const std::vector<int>& colours = {});
std::string hex(std::uint64_t value);
void addToLibrary(KeyLibrary& lib, const FrameFingerprint& fp, const std::string& label);
std::string writeLibrary(const KeyLibrary& lib);
KeyLibrary readLibrary(const std::string& text);
LibraryMatch matchLibrary(const FrameFingerprint& fp, const KeyLibrary& lib);
LibraryMatch matchLibraries(const Rows& rows, const std::vector<KeyLibrary>& libs, int maxRingSize = 7, const std::vector<int>& colours = {});
 
} // namespace topo

Detailed Documentation

Typedefs

typedef std::vector<std::vector<int>> Rows

Neighbour rows by index, each row leading with the atom itself, as nneigh::neighbourListByIndex returns them.

Global Functions

std::vector<int> hopNeighbourhood(const Rows& rows, int atom, int hops)

Atoms within hops bonds of atom, the atom itself first, then in breadth-first order.

std::uint64_t wlHash(const std::vector<std::vector<int>>& adjacency, int root, int rounds, const std::vector<int>& colours = {})

Weisfeiler-Lehman refinement hash of a graph given by local adjacency lists; root (or -1) starts in its own colour; colours (empty or one integer per vertex, such as the atom type) seeds the initial colours.

rounds refinements.

LocalKey localKey(const Rows& rows, int atom, int hops, const std::vector<int>& colours = {})

Key of the rooted neighbourhood of atom.

colours is empty or one class per row (atom type, species); coloured vertices never match vertices of another colour.

FrameFingerprint fingerprint(const Rows& rows, int hops = 2, int maxRingSize = 7, const std::vector<int>& colours = {})

Keys of every atom, their histogram, the ring census up to maxRingSize, and the frame key.

colours as in localKey.

std::string hex(std::uint64_t value)

Hex string of a 64-bit hash.

void addToLibrary(KeyLibrary& lib, const FrameFingerprint& fp, const std::string& label)

Add every distinct key of fp under label; a key already present under other labels carries all of them, sorted and joined by ‘|’.

std::string writeLibrary(const KeyLibrary& lib)

Text form: a header line # method M hops H colours C (C is 0 or 1; a header without it means uncoloured), then key label lines.

LibraryMatch matchLibrary(const FrameFingerprint& fp, const KeyLibrary& lib)

Look every atom key of fp up in lib.

Throws std::invalid_argument when the methods, hop counts or colourings differ.

LibraryMatch matchLibraries(const Rows& rows, const std::vector<KeyLibrary>& libs, int maxRingSize = 7, const std::vector<int>& colours = {})

Match against libraries at several depths: an atom takes the label of the deepest library that holds its key, and a molecule whose wide neighbourhood is disturbed (a defect two bonds away, a jittered dense polymorph) still gets named by its inner shells.

depth records the hops that named each atom. Every library must share the method of this build and the colouring (colours empty or one per row); throws std::invalid_argument otherwise, or when two libraries share a depth.