pairs module

Full Documentation for hippynn.graphs.nodes.pairs module. Click here for a summary page.

Nodes for finding and manipulating pairs and distances.

class DynamicPeriodicPairs(name, parents, dist_hard_max, module='auto', module_kwargs=None, **kwargs)[source]

Bases: _DispatchNeighbors

Node for finding pairs in arbitrary periodic boundary conditions. Note: This will often be slower than PeriodicPairIndexer, but more general. If the speed is a concern, consider precomputing pairs with experiment.assembly.precompute_pairs

Note

This node has parent expansion, following these procedures.

  1. If matching (PositionsNode, SpeciesNode, CellNode), then apply expand0

  2. If matching (PositionsNode, Encoder, PaddingIndexer, CellNode), then apply expand1

  3. Asserts that the number of parents is 8

  4. Gets main_output of nodes: casts MultiNodes to their main output

  5. Transforms the parents to have index states (<IdxType.MolAtom>, None, None, None, None, None, None, None)

class ExternalNeighborIndexer(name, parents, hard_dist_cutoff, module='auto', **kwargs)[source]

Bases: ExpandParents, PairIndexer, AutoKw, MultiNode

class KDTreePairs(name, parents, dist_hard_max, module='auto', module_kwargs=None, **kwargs)[source]

Bases: _DispatchNeighbors

Node for finding pairs under periodic boundary conditions using Scipy’s KD Tree algorithm. Cell must be orthorhombic.

Note

This node has parent expansion, following these procedures.

  1. If matching (PositionsNode, SpeciesNode, CellNode), then apply expand0

  2. If matching (PositionsNode, Encoder, PaddingIndexer, CellNode), then apply expand1

  3. Asserts that the number of parents is 8

  4. Gets main_output of nodes: casts MultiNodes to their main output

  5. Transforms the parents to have index states (<IdxType.MolAtom>, None, None, None, None, None, None, None)

class KDTreePairsMemory(name, parents, dist_hard_max, skin, module='auto', module_kwargs=None, **kwargs)[source]

Bases: _DispatchNeighbors, Memory

Implementation of KDTreePairs with an added memory component.

Stores current pair indices in memory and reuses them to compute the pair distances if no particle has moved more than skin/2 since last pair calculation. Otherwise uses the _pair_indexer_class to recompute the pairs.

Increasing the value of ‘skin’ will increase the number of pair distances computed at each step, but decrease the number of times new pairs must be computed. Skin should be set to zero while training for fastest results.

Note

This node has parent expansion, following these procedures.

  1. If matching (PositionsNode, SpeciesNode, CellNode), then apply expand0

  2. If matching (PositionsNode, Encoder, PaddingIndexer, CellNode), then apply expand1

  3. Asserts that the number of parents is 8

  4. Gets main_output of nodes: casts MultiNodes to their main output

  5. Transforms the parents to have index states (<IdxType.MolAtom>, None, None, None, None, None, None, None)

class Memory[source]

Bases: object

reset_reuse_percentage()[source]
property reuse_percentage
property skin
class MinDistNode(name, parents, module='auto', **kwargs)[source]

Bases: ExpandParents, AutoNoKw, MultiNode

expand0(pair_finder, **kwargs)[source]

Used for creation from parents with signature (PairIndexer)

expand1(neigh_list, **kwargs)[source]

Used for creation from parents with signature (PaddedNeighborNode)

expand2(neigh_list, pad_idxer, **kwargs)[source]

Used for creation from parents with signature (PaddedNeighborNode, AtomIndexer)

class NumpyDynamicPairs(name, parents, dist_hard_max, module='auto', module_kwargs=None, **kwargs)[source]

Bases: _DispatchNeighbors

class OpenPairIndexer(name, parents, dist_hard_max, module='auto', **kwargs)[source]

Bases: ExpandParents, PairIndexer, MultiNode

auto_module()[source]
expand0(pos, encode, indexer, **kwargs)[source]

Used for creation from parents with signature (PositionsNode, Encoder, PaddingIndexer)

class PaddedNeighborNode(name, parents, module='auto', **kwargs)[source]

Bases: ExpandParents, AutoNoKw, MultiNode

expand0(pair_finder, **kwargs)[source]

Used for creation from parents with signature (PairIndexer)

class PairCacher(name, parents, module='auto', module_kwargs=None, **kwargs)[source]

Bases: ExpandParents, AutoKw, PairCache, SingleNode

expand0(pair_indexer, *args, purpose, **kwargs)[source]

Used for creation from parents with signature (PairIndexer)

expand1(pair_indexer, atomidx, *args, purpose, **kwargs)[source]

Used for creation from parents with signature (PairIndexer, AtomIndexer)

class PairDeIndexer(name, parents, module='auto', **kwargs)[source]

Bases: ExpandParents, AutoNoKw, SingleNode

For converting from IdxType.Pairs to IdxType.MolAtomAtom (Padded form)

Note

This node has parent expansion, following these procedures.

  1. If matching (_BaseNode), then apply expand0

  2. If matching (_BaseNode, PaddingIndexer, PairIndexer), then apply expand1

expand0(pair_features)[source]

Used for creation from parents with signature (_BaseNode)

expand1(pair_features, pad_idx, pair_idx)[source]

Used for creation from parents with signature (_BaseNode, PaddingIndexer, PairIndexer)

class PairFilter(name, parents, dist_hard_max, module='auto', **kwargs)[source]

Bases: AutoKw, PairIndexer, ExpandParents, MultiNode

expand0(pair_indexer, purpose)[source]

Used for creation from parents with signature (PairIndexer)

class PairReIndexer(name, parents, module='auto', **kwargs)[source]

Bases: ExpandParents, AutoNoKw, SingleNode

For re-using index information to convert from IdxType.MolAtomAtom -> IdxType.Pairs

Note

This node has parent expansion, following these procedures.

  1. If matching (_BaseNode), then apply expand0

  2. If matching (_BaseNode, PaddingIndexer, PairIndexer), then apply expand1

  3. Asserts that the number of parents is 5

  4. Gets main_output of nodes: casts MultiNodes to their main output

expand0(pair_features)[source]

Used for creation from parents with signature (_BaseNode)

expand1(pair_features, pad_idx, pair_idx)[source]

Used for creation from parents with signature (_BaseNode, PaddingIndexer, PairIndexer)

class PairUncacher(name, parents, dist_hard_max, module='auto', **kwargs)[source]

Bases: ExpandParents, AutoNoKw, PairIndexer, MultiNode

expand0(sparse, *args, purpose, **kwargs)[source]

Used for creation from parents with signature (PairCache)

expand1(sp, r, c, atomidx, *args, purpose, **kwargs)[source]

Used for creation from parents with signature (PairCache, PositionsNode, CellNode, AtomIndexer)

class PeriodicPairIndexer(name, parents, dist_hard_max, module='auto', module_kwargs=None, **kwargs)[source]

Bases: ExpandParents, AutoKw, PeriodicPairOutputs, PairIndexer, MultiNode

expand0(pos, spec, cell, *, purpose, **kwargs)[source]

Used for creation from parents with signature (PositionsNode, SpeciesNode, CellNode)

expand1(pos, encode, indexer, cell, **kwargs)[source]

Used for creation from parents with signature (PositionsNode, Encoder, PaddingIndexer, CellNode)

class PeriodicPairIndexerMemory(name, parents, dist_hard_max, skin, module='auto', module_kwargs=None, **kwargs)[source]

Bases: PeriodicPairIndexer, Memory

Implementation of PeriodicPairIndexer with additional memory component.

Stores current pair indices in memory and reuses them to compute the pair distances if no particle has moved more than skin/2 since last pair calculation. Otherwise uses the _pair_indexer_class to recompute the pairs.

Increasing the value of ‘skin’ will increase the number of pair distances computed at each step, but decrease the number of times new pairs must be computed. Skin should be set to zero while training for fastest results.

Note

This node has parent expansion, following these procedures.

  1. If matching (PositionsNode, SpeciesNode, CellNode), then apply expand0

  2. If matching (PositionsNode, Encoder, PaddingIndexer, CellNode), then apply expand1

  3. Asserts that the number of parents is 5

  4. Gets main_output of nodes: casts MultiNodes to their main output

class PeriodicPairOutputs[source]

Bases: object

class RDFBins(name, parents, module='auto', bins=None, module_kwargs=None, **kwargs)[source]

Bases: ExpandParents, AutoKw, SingleNode

expand0(pos, spec, cell, *, purpose, dist_hard_max=None, **kwargs)[source]

Build a default Periodic Pair indexer.

Used for creation from parents with signature (PositionsNode, SpeciesNode, CellNode)

expand1(pos, spec, *, purpose, dist_hard_max=None, **kwargs)[source]

Builds an open pair indexer.

Used for creation from parents with signature (PositionsNode, SpeciesNode)

expand2(pairs, *, purpose, **kwargs)[source]

Get the encoding and padding associated with a pair indexer.

Used for creation from parents with signature (PairIndexer)

expand3(pairs, one_hot, pad, *, purpose, **kwargs)[source]

Expanded the needed children of pairs, encoder, and padding indexer.

Used for creation from parents with signature (PairIndexer, OneHotEncoder, PaddingIndexer)