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_max
specified during initialization.- Parameters:
xyz – a
metatensor.TensorMap
containing the Cartesian coordinates of the 3D points. ThisTensorMap
should 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
. Allsamples
in the outputTensorMap
will be the same as those of thexyz
input.
- compute_with_gradients(xyz: TensorMap) TensorMap ¶
Computes the spherical harmonics for the given Cartesian coordinates, up to the maximum degree
l_max
specified 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
. EachTensorBlock
in the outputTensorMap
will have a gradient block with respect to the Cartesian positions. Allsamples
in the outputTensorMap
will be the same as those of thexyz
input.
- compute_with_hessians(xyz: TensorMap) TensorMap ¶
Computes the spherical harmonics for the given Cartesian coordinates, up to the maximum degree
l_max
specified 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
. EachTensorBlock
in the outputTensorMap
will have a gradient block with respect to the Cartesian positions, which will itself have a gradient with respect to the Cartesian positions. Allsamples
in the outputTensorMap
will be the same as those of thexyz
input.
- class sphericart.metatensor.SolidHarmonics(l_max: int)¶
metatensor
-based wrapper around thesphericart.SolidHarmonics()
class.See
SphericalHarmonics
for 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.SphericalHarmonics
for more details.backward_second_derivatives
has 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.SphericalHarmonics
for more details.backward_second_derivatives
has 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()
.