Loading...
Searching...
No Matches
topo_fingerprint.hpp File Reference

Label-independent keys for bonded topologies. More...

#include <cstdint>
#include <map>
#include <string>
#include <utility>
#include <vector>

Go to the source code of this file.

Classes

struct  topo::LocalKey
struct  topo::FrameFingerprint
struct  topo::KeyLibrary
 A dictionary from local keys to labels: the keys of reference structures (a polymorph library), so any molecule whose rooted neighbourhood matches a reference gets that reference's name. More...
struct  topo::LibraryMatch

Namespaces

namespace  topo

Typedefs

using topo::Rows = std::vector<std::vector<int>>
 Neighbour rows by index, each row leading with the atom itself, as nneigh::neighbourListByIndex returns them.

Functions

std::vector< int > topo::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 topo::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.
LocalKey topo::localKey (const Rows &rows, int atom, int hops, const std::vector< int > &colours={})
 Key of the rooted neighbourhood of atom.
FrameFingerprint topo::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.
FrameFingerprint topo::incrementalFingerprint (const FrameFingerprint &prev, const Rows &rows, const std::vector< int > &dirtyAtoms, int hops, int maxRingSize=7, const std::vector< int > &colours={})
 Recompute local keys only for the hop-ball of dirtyAtoms and keep the rest of prev.
std::string topo::hex (std::uint64_t value)
 Hex string of a 64-bit hash.
void topo::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 topo::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.
KeyLibrary topo::readLibrary (const std::string &text)
LibraryMatch topo::matchLibrary (const FrameFingerprint &fp, const KeyLibrary &lib)
 Look every atom key of fp up in lib.
LibraryMatch topo::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.

Detailed Description

Label-independent keys for bonded topologies.

A local key names the isomorphism class of the rooted bonded graph within a number of hops of one atom: two atoms share a key exactly when their neighbourhoods are the same graph with the same centre, whatever the atom indices. A frame key names the multiset of local keys together with the primitive ring census, so two configurations share a frame key when every atom has a counterpart with the same environment. This is the topological classification k-ART uses to index its event catalogue (Trochet, Beland, Joly, Brommer and Mousseau, Phys. Rev. B 91, 224106 (2015)), here on the graphs the ring and cage code already builds.

With nauty linked the local key is the canonical certificate of the rooted graph (the centre in its own colour cell), an exact invariant. Without it the key is a Weisfeiler-Lehman colour refinement hash, which separates every pair of graphs the refinement can distinguish and is what the frame key uses in either build so that keys compare across hosts. The method is recorded on every result.

Definition in file topo_fingerprint.hpp.