derivatives module
Full Documentation for hippynn.graphs.nodes.physics.derivatives module.
Click here for a summary page.
- class GradientNode(name, parents, sign, **kwargs)[source]
Bases:
AutoKw,SingleNodeCompute the gradient of a quantity.
- auto_module_kwargs = ('sign',)
- input_names = ('energy', 'coordinates')
- class HVPNode(name, parents, module='auto', **kwargs)[source]
Bases:
ExpandParents,AutoKw,MultiNode- expansion0(source, vector, *, purpose, **kwargs)[source]
Used for creation from parents with signature (Energies, Node)
- expansion1(energy, positions, vector, *, purpose, **kwargs)[source]
Used for creation from parents with signature (Energies, PositionsNode, Node)
- expansion2(force, positions, vector, *, purpose, **kwargs)[source]
Used for creation from parents with signature (GradientNode, PositionsNode, Node)
- expansion3(force, positions, vector, *, purpose, **kwargs)[source]
Used for creation from parents with signature (Node, PositionsNode, Node)
- expansion4(force, coordinates, vector, encoder, *, purpose, **kwargs)[source]
Used for creation from parents with signature (Node, PositionsNode, Node, Encoder)
- input_names = ('source', 'coordinates', 'vector', 'nonblank')
- output_index_states = (<IdxType.SysAtom>, <IdxType.SysAtom>)
- output_names = ('hvp', 'mask')
- parent_expander: ParentExpander = <hippynn.graphs.nodes.base.definition_helpers.ParentExpander object>
- class HVPVectorNode(name, parents, module='auto', vector_type='random', **kwargs)[source]
Bases:
ExpandParents,AutoKw,SingleNodeOutputs a tensor with a determined number of random or one-hot vectors per molecule
Note
This node has parent expansion, following these procedures.
If matching (PositionsNode), then apply expand_from_positions
Asserts that the number of parents is 2
Gets main_output of nodes: casts MultiNodes to their main output
Transforms the parents to have index states (<IdxType.SysAtom>, <IdxType.SysAtom>)
- expand_from_positions(positions, *, purpose=None, **kwargs)[source]
Used for creation from parents with signature (PositionsNode)
- index_state = 'SysAtom'
- input_names = ('coordinates', 'nonblank')
- parent_expander: ParentExpander = <hippynn.graphs.nodes.base.definition_helpers.ParentExpander object>
- class HessianNode(name, parents, module='auto', **kwargs)[source]
Bases:
ExpandParents,AutoKw,MultiNodeNode that computes the Hessian (second derivatives of energy) via gradients of force w.r.t. coordinates or second gradients of enery w.r.t. coordinates.
Note
This node has parent expansion, following these procedures.
If matching (Node), then apply expansion0
If matching (Energies, PositionsNode), then apply expansion1
If matching (GradientNode, PositionsNode), then apply expansion2
If matching (Node, PositionsNode), then apply expansion3
If matching (Node, PositionsNode, Encoder), then apply expansion4
If matching (Node, Node, Node), then apply check_for_grad
Asserts that the number of parents is 3
Gets main_output of nodes: casts MultiNodes to their main output
Transforms the parents to have index states (<IdxType.SysAtom>, <IdxType.SysAtom>, None)
- check_for_grad(force, coordinates, encoder, **kwargs)[source]
Used for creation from parents with signature (Node, Node, Node)
- expansion0(source, *, purpose, **kwargs)[source]
Used for creation from parents with signature (Node)
- expansion1(energy, positions, *, purpose, **kwargs)[source]
Used for creation from parents with signature (Energies, PositionsNode)
- expansion2(force, coordinates, *, purpose, **kwargs)[source]
Used for creation from parents with signature (GradientNode, PositionsNode)
- expansion3(force, coordinates, *, purpose, **kwargs)[source]
Used for creation from parents with signature (Node, PositionsNode)
- expansion4(force, coordinates, encoder, **kwargs)[source]
Used for creation from parents with signature (Node, PositionsNode, Encoder)
- input_names = ('forces', 'coordinates', 'nonblank')
- output_index_states = (<IdxType.Systems>, <IdxType.Systems>)
- output_names = ('hessian', 'mask')
- parent_expander: ParentExpander = <hippynn.graphs.nodes.base.definition_helpers.ParentExpander object>
- class MultiGradientNode(name: str, molecular_energies_parent: Node, generalized_coordinates_parents: tuple[Node], signs: tuple[int], **kwargs)[source]
-
Compute the gradient of a quantity.
- auto_module_class
alias of
MultiGradient
- auto_module_kwargs = ('signs',)
- class StrainInducer(name, parents, module='auto', **kwargs)[source]
-
- auto_module_class
alias of
CellScaleInducer
- input_names = ('coordinates', 'cell')
- output_index_states = NotImplemented
- output_names = ('strained_coordinates', 'strained_cell', 'strain')
- class StressForceNode(name, parents, module='auto', **kwargs)[source]
-
- auto_module_class
alias of
StressForce
- input_names = ('energy', 'strain', 'coordinates', 'cell')
- output_names = ('forces', 'stress')
- class TrueHVPNode(name, parents=None, module='auto', **kwargs)[source]
Bases:
ExpandParents,AutoNoKw,SingleNodeComputes true Hessian-vector product from database-stored Hessians and input vector
Note
This node has parent expansion, following these procedures.
If matching (Node, HVPVectorNode), then apply expand_from_hessian_and_vector
Gets main_output of nodes: casts MultiNodes to their main output
Transforms the parents to have index states (<IdxType.Systems>, <IdxType.SysAtom>)
- expand_from_hessian_and_vector(hessian, vector, **kwargs)[source]
Used for creation from parents with signature (Node, HVPVectorNode)
- index_state = 'SysAtom'
- input_names = ('hessian', 'vector')
- parent_expander: ParentExpander = <hippynn.graphs.nodes.base.definition_helpers.ParentExpander object>
- setup_stressforce_nodes(energy_node, return_transformed_inputs=False, positions_node='auto', cell_node='auto', strain_node='auto')[source]
_summary_
- Parameters:
energy_node – the energy to differenitate
return_transformed_inputs – If true, return the strained positions, strained cell, and strain
position_node – defaults to “auto”
cell_node – defaults to “auto”
strain_node – defaults to “auto”
Using “auto” will cause a failure if the corresponding node cannot be found or is ambiguous.
- Returns:
(forces, stress) or (forces, stress, strained_positions, strained_cell, strain) depending on return_transformed_inputs flag.