Metatensor API¶
sphericart can be used in conjunction with
metatensor in order to attach
metadata to inputs and outputs, as well as to naturally obtain spherical harmonics,
gradients and Hessians in a single object.
Here is the API reference for the sphericart.metatensor and
sphericart.torch.metatensor modules.
sphericart.metatensor¶
- class sphericart.metatensor.SphericalHarmonics(l_max: int)¶
metatensor-based wrapper around thesphericart.SphericalHarmonics()class.- Parameters:
l_max – the maximum degree of the spherical harmonics to be calculated
- Returns:
a spherical harmonics calculator object
- compute(xyz: TensorMap) TensorMap¶
Computes the spherical harmonics for the given Cartesian coordinates, up to the maximum degree
l_maxspecified during initialization.- Parameters:
xyz – a
metatensor.TensorMapcontaining the Cartesian coordinates of the 3D points. ThisTensorMapshould have only oneTensorBlock. In thisTensorBlock, the samples are arbitrary, there must be one component named"xyz"with 3 values, and one property.- Returns:
The spherical harmonics and their metadata as a
metatensor.TensorMap. Allsamplesin the outputTensorMapwill be the same as those of thexyzinput.
- compute_with_gradients(xyz: TensorMap) TensorMap¶
Computes the spherical harmonics for the given Cartesian coordinates, up to the maximum degree
l_maxspecified during initialization, together with their gradients with respect to the Cartesian coordinates.- Parameters:
xyz – see
compute()- Returns:
The spherical harmonics and their metadata as a
metatensor.TensorMap. EachTensorBlockin the outputTensorMapwill have a gradient block with respect to the Cartesian positions. Allsamplesin the outputTensorMapwill be the same as those of thexyzinput.
- compute_with_hessians(xyz: TensorMap) TensorMap¶
Computes the spherical harmonics for the given Cartesian coordinates, up to the maximum degree
l_maxspecified during initialization, together with their gradients and Hessians with respect to the Cartesian coordinates.- Parameters:
xyz – see
compute()- Returns:
The spherical harmonics and their metadata as a
metatensor.TensorMap. EachTensorBlockin the outputTensorMapwill have a gradient block with respect to the Cartesian positions, which will itself have a gradient with respect to the Cartesian positions. Allsamplesin the outputTensorMapwill be the same as those of thexyzinput.
- class sphericart.metatensor.SolidHarmonics(l_max: int)¶
metatensor-based wrapper around thesphericart.SolidHarmonics()class.See
SphericalHarmonicsfor more details.- compute_with_gradients(xyz: TensorMap) TensorMap¶
See
sphericart.metatensor.SphericalHarmonics.compute_with_gradients().
- compute_with_hessians(xyz: TensorMap) TensorMap¶
See
sphericart.metatensor.SphericalHarmonics.compute_with_hessians().
sphericart.torch.metatensor¶
- class sphericart.torch.metatensor.SphericalHarmonics(l_max: int, backward_second_derivatives: bool = False)¶
metatensor-based wrapper around thesphericart.torch.SphericalHarmonics()class.See
sphericart.metatensor.SphericalHarmonicsfor more details.backward_second_derivativeshas the same meaning as insphericart.torch.SphericalHarmonics.- compute_with_gradients(xyz: TensorMap) TensorMap¶
See
sphericart.metatensor.SphericalHarmonics.compute_with_gradients().
- compute_with_hessians(xyz: TensorMap) TensorMap¶
See
sphericart.metatensor.SphericalHarmonics.compute_with_hessians().
- class sphericart.torch.metatensor.SolidHarmonics(l_max: int, backward_second_derivatives: bool = False)¶
metatensor-based wrapper around thesphericart.torch.SolidHarmonics()class.See
sphericart.metatensor.SphericalHarmonicsfor more details.backward_second_derivativeshas the same meaning as insphericart.torch.SphericalHarmonics.- compute_with_gradients(xyz: TensorMap) TensorMap¶
See
sphericart.metatensor.SphericalHarmonics.compute_with_gradients().
- compute_with_hessians(xyz: TensorMap) TensorMap¶
See
sphericart.metatensor.SphericalHarmonics.compute_with_hessians().