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, **kwargs)[source]
Bases:
_DispatchNeighborsNode 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.
If matching (PositionsNode, SpeciesNode, CellNode), then apply expand0
If matching (PositionsNode, Encoder, PaddingIndexer, CellNode), then apply expand1
Asserts that the number of parents is 8
Gets main_output of nodes: casts MultiNodes to their main output
Transforms the parents to have index states (<IdxType.SysAtom>, None, None, None, None, None, None, None)
- auto_module_class
alias of
TorchNeighbors
- parent_expander: ParentExpander = <hippynn.graphs.nodes.base.definition_helpers.ParentExpander object>
- class ExternalNeighborIndexer(*args, module='auto', module_kwargs=None, **kwargs)[source]
Bases:
AutoKw,ExpandParents,PairIndexer,MultiNode- auto_module_class
alias of
ExternalNeighbors
- auto_module_kwargs: Tuple[str] | Dict[str, str] | None = ('hard_dist_cutoff',)
- input_names = ('coordinates', 'real_atoms', 'shifts', 'cell', 'ext_pair_first', 'ext_pair_second')
- parent_expander: ParentExpander = <hippynn.graphs.nodes.base.definition_helpers.ParentExpander object>
- class KDTreePairs(name, parents, dist_hard_max, **kwargs)[source]
Bases:
_DispatchNeighborsNode 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.
If matching (PositionsNode, SpeciesNode, CellNode), then apply expand0
If matching (PositionsNode, Encoder, PaddingIndexer, CellNode), then apply expand1
Asserts that the number of parents is 8
Gets main_output of nodes: casts MultiNodes to their main output
Transforms the parents to have index states (<IdxType.SysAtom>, None, None, None, None, None, None, None)
- auto_module_class
alias of
KDTreeNeighbors
- parent_expander: ParentExpander = <hippynn.graphs.nodes.base.definition_helpers.ParentExpander object>
- class KDTreePairsMemory(name, parents, dist_hard_max, skin, module='auto', module_kwargs=None, **kwargs)[source]
Bases:
_DispatchNeighbors,MemoryImplementation 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.
If matching (PositionsNode, SpeciesNode, CellNode), then apply expand0
If matching (PositionsNode, Encoder, PaddingIndexer, CellNode), then apply expand1
Asserts that the number of parents is 8
Gets main_output of nodes: casts MultiNodes to their main output
Transforms the parents to have index states (<IdxType.SysAtom>, None, None, None, None, None, None, None)
- auto_module_class
alias of
KDTreePairsMemory
- auto_module_kwargs: Tuple[str] | Dict[str, str] | None = ('dist_hard_max',)
- parent_expander: ParentExpander = <hippynn.graphs.nodes.base.definition_helpers.ParentExpander object>
- class MinDistNode(name, parents, module='auto', **kwargs)[source]
Bases:
ExpandParents,AutoNoKw,MultiNode- auto_module_class
alias of
MinDistModule
- 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)
- input_names = ('rij_list', 'j_list', 'system_index', 'atom_index', 'inv_real_atoms', 'n_atoms_max', 'n_systems')
- output_index_states = (<IdxType.Systems>, <IdxType.Systems>, <IdxType.Atoms>, <IdxType.Atoms>)
- output_names = ('min_dist_mol', 'mol_locs', 'min_dist_atom', 'atom_pairlocs')
- parent_expander: ParentExpander = <hippynn.graphs.nodes.base.definition_helpers.ParentExpander object>
- class NumpyDynamicPairs(name, parents, dist_hard_max, **kwargs)[source]
Bases:
_DispatchNeighbors- auto_module_class
alias of
NPNeighbors
- parent_expander: ParentExpander = <hippynn.graphs.nodes.base.definition_helpers.ParentExpander object>
- class OpenPairIndexer(name, parents, dist_hard_max, **kwargs)[source]
Bases:
AutoKw,ExpandParents,PairIndexer,MultiNode- auto_module_class
alias of
OpenPairIndexer
- expand0(pos, encode, indexer, **kwargs)[source]
Used for creation from parents with signature (PositionsNode, Encoder, PaddingIndexer)
- auto_module_kwargs: Tuple[str] | Dict[str, str] | None = {'hard_dist_cutoff': 'dist_hard_max'}
- input_names = ('coordinates', 'nonblank', 'real_atoms', 'inv_real_atoms')
- parent_expander: ParentExpander = <hippynn.graphs.nodes.base.definition_helpers.ParentExpander object>
- class PaddedNeighborNode(name, parents, module='auto', **kwargs)[source]
Bases:
ExpandParents,AutoNoKw,MultiNode- auto_module_class
alias of
PaddedNeighModule
- input_names = ('pair_first', 'pair_second', 'pair_coord')
- output_index_states = (<IdxType.Atoms>, <IdxType.Atoms>)
- output_names = ('j_list', 'rij_list')
- parent_expander: ParentExpander = <hippynn.graphs.nodes.base.definition_helpers.ParentExpander object>
- class PairCacher(*args, module='auto', module_kwargs=None, **kwargs)[source]
Bases:
AutoKw,ExpandParents,PairCache,SingleNode- auto_module_class
alias of
PairCacher
- 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)
- input_names = ('pair_first', 'pair_second', 'cell_offsets', 'offset_index', 'real_atoms', 'system_index', 'n_atoms_max', 'n_systems')
- parent_expander: ParentExpander = <hippynn.graphs.nodes.base.definition_helpers.ParentExpander object>
- class PairDeIndexer(name, parents, module='auto', **kwargs)[source]
Bases:
ExpandParents,AutoNoKw,SingleNodeFor converting from IdxType.Pairs to IdxType.SysAtomAtom (Padded form)
Note
This node has parent expansion, following these procedures.
If matching (Node), then apply expand0
If matching (Node, PaddingIndexer, PairIndexer), then apply expand1
- auto_module_class
alias of
PairDeIndexer
- expand1(pair_features, pad_idx, pair_idx)[source]
Used for creation from parents with signature (Node, PaddingIndexer, PairIndexer)
- input_names = ('pair_features', 'system_index', 'atom_index', 'n_systems', 'n_atoms_maxpair_first', 'pair_second')
- parent_expander: ParentExpander = <hippynn.graphs.nodes.base.definition_helpers.ParentExpander object>
- class PairFilter(name, parents, dist_hard_max, module='auto', **kwargs)[source]
Bases:
AutoKw,PairIndexer,ExpandParents,MultiNode- auto_module_class
alias of
FilterDistance
- parent_expander: ParentExpander = <hippynn.graphs.nodes.base.definition_helpers.ParentExpander object>
- class PairReIndexer(name, parents, module='auto', **kwargs)[source]
Bases:
ExpandParents,AutoNoKw,SingleNodeFor re-using index information to convert from IdxType.SysAtomAtom -> IdxType.Pairs
Note
This node has parent expansion, following these procedures.
If matching (Node), then apply expand0
If matching (Node, PaddingIndexer, PairIndexer), then apply expand1
Asserts that the number of parents is 5
Gets main_output of nodes: casts MultiNodes to their main output
- auto_module_class
alias of
PairReIndexer
- expand1(pair_features, pad_idx, pair_idx)[source]
Used for creation from parents with signature (Node, PaddingIndexer, PairIndexer)
- input_names = ('pair_features', 'system_index', 'atom_index', 'pair_first', 'pair_second')
- parent_expander: ParentExpander = <hippynn.graphs.nodes.base.definition_helpers.ParentExpander object>
- class PairUncacher(name, parents, dist_hard_max, **kwargs)[source]
Bases:
ExpandParents,AutoNoKw,PairIndexer,MultiNode- auto_module_class
alias of
PairUncacher
- 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 (Node, Node, Node, AtomIndexer)
Used for creation from parents with signature (PairCache, PositionsNode, CellNode, AtomIndexer)
- auto_module_kwargs = ('dist_hard_max',)
- index_state = 'Unlabeled'
- input_names = ('sparsepairs', 'coordinates', 'cells', 'real_atoms', 'inv_real_atoms', 'n_atoms_max', 'n_systems')
- output_index_states = (<IdxType.Pairs>, <IdxType.Pairs>, <IdxType.Pairs>, <IdxType.Pairs>, <IdxType.Pairs>, <IdxType.Pairs>)
- output_names = ('pair_dist', 'pair_first', 'pair_second', 'pair_coord', 'cell_offsets', 'offset_index')
- parent_expander: ParentExpander = <hippynn.graphs.nodes.base.definition_helpers.ParentExpander object>
- class PeriodicPairIndexer(name, parents, dist_hard_max, **kwargs)[source]
Bases:
AutoKw,ExpandParents,PeriodicPairOutputs,PairIndexer,MultiNode- auto_module_class
alias of
PeriodicPairIndexer
- 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)
- auto_module_kwargs: Tuple[str] | Dict[str, str] | None = {'hard_dist_cutoff': 'dist_hard_max'}
- input_names = ('coordinates', 'nonblank', 'real_atoms', 'inv_real_atoms', 'cell')
- parent_expander: ParentExpander = <hippynn.graphs.nodes.base.definition_helpers.ParentExpander object>
- class PeriodicPairIndexerMemory(name, parents, dist_hard_max, skin, module='auto', module_kwargs=None, **kwargs)[source]
Bases:
PeriodicPairIndexer,MemoryImplementation 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.
If matching (PositionsNode, SpeciesNode, CellNode), then apply expand0
If matching (PositionsNode, Encoder, PaddingIndexer, CellNode), then apply expand1
Asserts that the number of parents is 5
Gets main_output of nodes: casts MultiNodes to their main output
- auto_module_class
alias of
PeriodicPairIndexerMemory
- name: str
- parent_expander: ParentExpander = <hippynn.graphs.nodes.base.definition_helpers.ParentExpander object>
- torch_module: torch.nn.Module
- class PeriodicPairOutputs[source]
Bases:
object- output_index_states = (<IdxType.Pairs>, <IdxType.Pairs>, <IdxType.Pairs>, <IdxType.Pairs>, <IdxType.Pairs>, <IdxType.Pairs>)
- output_names = ('pair_dist', 'pair_first', 'pair_second', 'pair_coord', 'cell_offsets', 'offset_index')
- class RDFBins(name, parents, bins=None, **kwargs)[source]
Bases:
AutoKw,ExpandParents,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)
- auto_module_kwargs: Tuple[str] | Dict[str, str] | None = ('bins',)
- input_names = ('pair_dists', 'pair_first', 'pair_second', 'one_hot', 'n_systems')
- parent_expander: ParentExpander = <hippynn.graphs.nodes.base.definition_helpers.ParentExpander object>
- parent_expansion_kwargs: Tuple[str] | Dict[str, str] | None = ('dist_hard_max',)