The website uses cookies. By using this site, you agree to our use of cookies as described in the Privacy Policy.

# o3 - Direct sums of Irreps¶

Classes:

 `Irrep`(l[, p]) Irreducible representation of O(3)$O\left(3\right)$ `Irreps`(irreps) Direct sum of irreducible representations of O(3)$O\left(3\right)$
class `e3nn.o3.irreps.``Irrep`(l, p=None)

Bases: `tuple`

Irreducible representation of O(3)$O\left(3\right)$

`l`

non negative integer, the degree of the representation, l=0,1,…$l=0,1,\dots$

Type

int

`p`

the parity of the representation

Type

{1, -1}

`dim`

the dimension of the representation

Type

int

Examples

Create a representation l=0$l=0$ of even parity.

```>>> Irrep(0, 1)
0e
```

Create a representation l=2$l=2$ of odd parity.

```>>> Irrep(2, -1)
2o
```

Create a representation l=1$l=1$ of the parity of the spherical harmonics.

```>>> Irrep("1y")
1o
```
```>>> Irrep("2e") in Irrep("1o") * Irrep("1o")
True
```
```>>> Irrep("1o") + Irrep("2o")
1x1o+1x2o
```

Methods:

 `D_from_angles`(alpha, beta, gamma[, k]) Matrix kDl(α,β,γ)${p}^{k}{D}^{l}\left(\alpha ,\beta ,\gamma \right)$ Matrix of the representation, see `Irrep.D_from_angles` `D_from_quaternion`(q[, k]) Matrix of the representation, see `Irrep.D_from_angles` `count`(_value) Return number of occurrences of value. `index`(_value) Return first index of value. `iterator`([lmax]) Iterator through all the irreps of O(3)$O\left(3\right)$
`D_from_angles`(alpha, beta, gamma, k=None)

Matrix kDl(α,β,γ)${p}^{k}{D}^{l}\left(\alpha ,\beta ,\gamma \right)$

(matrix) Representation of O(3)$O\left(3\right)$. D$D$ is the representation of SO(3)$SO\left(3\right)$, see `wigner_D`.

Parameters
• alpha (`torch.Tensor`) – tensor of shape (...)$\left(...\right)$ Rotation α$\alpha$ around Z axis, applied third.

• beta (`torch.Tensor`) – tensor of shape (...)$\left(...\right)$ Rotation β$\beta$ around Y axis, applied second.

• gamma (`torch.Tensor`) – tensor of shape (...)$\left(...\right)$ Rotation γ$\gamma$ around Z axis, applied first.

• k (`torch.Tensor`, optional) – tensor of shape (...)$\left(...\right)$ How many times the parity is applied.

Returns

tensor of shape (...,2l+1,2l+1)$\left(...,2l+1,2l+1\right)$

Return type

`torch.Tensor`

See also

`o3.wigner_D`, `Irreps.D_from_angles`

`D_from_matrix`(R)

Matrix of the representation, see `Irrep.D_from_angles`

Parameters
Returns

tensor of shape (...,2l+1,2l+1)$\left(...,2l+1,2l+1\right)$

Return type

`torch.Tensor`

`D_from_quaternion`(q, k=None)

Matrix of the representation, see `Irrep.D_from_angles`

Parameters
Returns

tensor of shape (...,2l+1,2l+1)$\left(...,2l+1,2l+1\right)$

Return type

`torch.Tensor`

`count`(_value)

Return number of occurrences of value.

`index`(_value)

Return first index of value.

Raises ValueError if the value is not present.

classmethod `iterator`(lmax=None)

Iterator through all the irreps of O(3)$O\left(3\right)$

class `e3nn.o3.irreps.``Irreps`(irreps)

Bases: `tuple`

Direct sum of irreducible representations of O(3)$O\left(3\right)$

`dim`

the total dimension of the representation

Type

int

`num_irreps`

number of irreps. the sum of the multiplicities

Type

int

`ls`

list of l$l$ values

Type

list of int

`lmax`

maximum l$l$ value

Type

int

Examples

Create a representation of 100 l=0$l=0$ of even parity and 50 pseudo-vectors.

```>>> Irreps([(100, (0, 1)), (50, (1, 1))])
100x0e+50x1e
```

Create a representation of 100 l=0$l=0$ of even parity and 50 pseudo-vectors.

```>>> Irreps("100x0e + 50x1e")
100x0e+50x1e
```
```>>> Irreps("100x0e + 50x1e + 0x2e")
100x0e+50x1e+0x2e
```
```>>> Irreps("100x0e + 50x1e + 0x2e").lmax
1
```
```>>> Irrep("2e") in Irreps("0e + 2e")
True
```

Methods:

 `D_from_angles`(alpha, beta, gamma[, k]) Matrix of the representation Matrix of the representation `D_from_quaternion`(q[, k]) Matrix of the representation `count`(ir) Return number of occurrences of value. `index`(_object) Return first index of value. `randn`(*size[, normalization, dtype, device, …]) random tensor simplify the representation sort the representation representation of the spherical harmonics
`D_from_angles`(alpha, beta, gamma, k=None)

Matrix of the representation

Parameters
Returns

tensor of shape (...,dim,dim)$\left(...,dim,dim\right)$

Return type

`torch.Tensor`

`D_from_matrix`(R)

Matrix of the representation

Parameters
Returns

tensor of shape (...,dim,dim)$\left(...,dim,dim\right)$

Return type

`torch.Tensor`

`D_from_quaternion`(q, k=None)

Matrix of the representation

Parameters
Returns

tensor of shape (...,dim,dim)$\left(...,dim,dim\right)$

Return type

`torch.Tensor`

`count`(ir) → int

Return number of occurrences of value.

`index`(_object)

Return first index of value.

Raises ValueError if the value is not present.

`randn`(*size, normalization='component', dtype=None, device=None, requires_grad=False)

random tensor

Parameters
• *size (list of int) – size of the output tensor, needs to contains a `-1`

• normalization ({'component', 'norm'}) –

Returns

tensor of shape `size` where `-1` is replaced by `self.dim`

Return type

`torch.Tensor`

Examples

```>>> Irreps("5x0e + 10x1o").randn(5, -1, 5, normalization='norm').shape
torch.Size([5, 35, 5])
```
```>>> Irreps("2o").randn(2, -1, 3, normalization='norm').norm(dim=1).sub(1).abs().max().item() < 1e-5
True
```
`simplify`()

simplify the representation

Returns
Return type

`Irreps`

Examples

Note that simplify does not sort the representations.

```>>> Irreps("1e + 1e + 0e").simplify()
2x1e+1x0e
```

Same representations which are seperated from each other are not combined

```>>> Irreps("1e + 1e + 0e + 1e").simplify()
2x1e+1x0e+1x1e
```
`sort`()

sort the representation

Returns

Examples

```>>> Irreps("1e + 0e + 1e").sort().irreps
1x0e+1x1e+1x1e
```
```>>> Irreps("2o + 1e + 0e + 1e").sort().p
(3, 1, 0, 2)
```
```>>> Irreps("2o + 1e + 0e + 1e").sort().inv
(2, 1, 3, 0)
```
static `spherical_harmonics`(lmax)

representation of the spherical harmonics

Parameters

lmax (int) – maximum l$l$

Returns

representation of (Y0,Y1,…,Ylmax)$\left({Y}^{0},{Y}^{1},\dots ,{Y}^{lmax}\right)$

Return type

`Irreps`

Examples

```>>> Irreps.spherical_harmonics(3)
1x0e+1x1o+1x2e+1x3o
```
Measure
Measure
Summary | 1 Annotation
the parity of the spherical harmonics
2021/02/05 03:07