mindscience.e3nn.o3.SphericalHarmonics
- class mindscience.e3nn.o3.SphericalHarmonics(irreps_out, normalize, normalization='integral', irreps_in=None, dtype=mindspore.float32)[source]
Spherical-harmonics cell: maps 3-D Cartesian vectors (x, y, z) to the corresponding complex-valued spherical-harmonic basis functions \(Y_l^m(\hat{x})\). The layer can return any requested degree(s) l and automatically handles parity (even/odd) selection rules.
- Parameters
irreps_out (Union[str, Irrep, Irreps]) – irreducible representations of output for spherical harmonics.
normalize (bool) – whether to normalize the input Tensor to unit vectors that lie on the sphere before projecting onto the spherical harmonics.
normalization (str, optional) – {'integral', 'component', 'norm'}, normalization method of the output tensors. Default:
'integral'.irreps_in (Union[str, Irrep, Irreps], optional) – irreducible representations of input for spherical harmonics. Default:
None.dtype (mindspore.dtype, optional) – The type of input tensor. Default:
mindspore.float32.
- Inputs:
x (Tensor) - Tensor for construct spherical harmonics. The shape of Tensor is \((..., 3)\).
- Outputs:
output (Tensor) - the spherical harmonics \(Y^l(x)\). The shape of Tensor is \((..., 2l+1)\).
- Raises
ValueError – If normalization is not in {'integral', 'component', 'norm'}.
ValueError – If irreps_in for SphericalHarmonics is not neither a vector (1x1o) nor a pseudovector (1x1e).
ValueError – If the l and p of irreps_out are not consistent with irreps_in for spherical harmonics. The output parity should have been p = {input_p**l}.
NotImplementedError – If l is larger than 11.
Examples
>>> from mindscience.e3nn.o3 import SphericalHarmonics >>> from mindspore import ops >>> sh = SphericalHarmonics(0, False, normalization='component') >>> x = ops.rand(2,3) >>> m = sh(x) [[1.] [1.]]