# Irreps¶

A group representation $$(D,V)$$ describe the action of a group $$G$$ on a vector space $$V$$

$D : G \longrightarrow \text{linear map on } V.$

The irreducible representations, in short irreps (definition of irreps) are the “smallest” representations.

• Any representation can be decomposed via a change of basis into a direct sum of irreps

• Any physical quantity, under the action of $$O(3)$$, transforms with a representation of $$O(3)$$

The irreps of $$SO(3)$$ are called the wigner matrices $$D^L$$. The irreps of the group of inversion ($$\{e, I\}$$) are the trivial representation $$\sigma_+$$ and the sign representation $$\sigma_-$$

$\begin{split}\sigma_p(g) = \left \{ \begin{array}{l} 1 \text{ if } g = e \\ p \text{ if } g = I \end{array} \right..\end{split}$

The group $$O(3)$$ is the direct product of $$SO(3)$$ and inversion

$g = r i, \quad r \in SO(3), i \in \text{inversion}.$

The irreps of $$O(3)$$ are the product of the irreps of $$SO(3)$$ and inversion. An instance of the class Irreps represent a direct sum of irreps of $$O(3)$$:

$g = r i \mapsto \bigoplus_{j=1}^n m_j \times \sigma_{p_j}(i) D^{L_j}(r)$

where $$(m_j \in \mathbb{N}, p_j = \pm 1, L_j = 0,1,2,3,\dots)_{j=1}^n$$ defines the Irreps.

Irreps of $$O(3)$$ are often confused with the spherical harmonics, the relation between the irreps and the spherical harmonics is explained at Spherical Harmonics.

class e3nn.o3.Irrep(l, p=None)

Bases: tuple

Irreducible representation of $$O(3)$$

This class does not contain any data, it is a structure that describe the representation. It is typically used as argument of other classes of the library to define the input and output representations of functions.

Parameters
• l (int) – non-negative integer, the degree of the representation, $$l = 0, 1, \dots$$

• p ({1, -1}) – the parity of the representation

Examples

Create a scalar representation ($$l=0$$) of even parity.

>>> Irrep(0, 1)
0e


Create a pseudotensor representation ($$l=2$$) of odd parity.

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


Create a vector representation ($$l=1$$) of the parity of the spherical harmonics ($$-1^l$$ gives odd parity).

>>> Irrep("1y")
1o

>>> Irrep("2o").dim
5

>>> Irrep("2e") in Irrep("1o") * Irrep("1o")
True

>>> Irrep("1o") + Irrep("2o")
1x1o+1x2o


Methods:

 D_from_angles(alpha, beta, gamma[, k]) Matrix $$p^k D^l(\alpha, \beta, \gamma)$$ 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)$$

Attributes:

 dim The dimension of the representation, $$2 l + 1$$. l The degree of the representation, $$l = 0, 1, \dots$$. p The parity of the representation, $$p = \pm 1$$.
D_from_angles(alpha, beta, gamma, k=None)

Matrix $$p^k D^l(\alpha, \beta, \gamma)$$

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

Parameters
Returns

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

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)$$

Return type

torch.Tensor

Examples

>>> m = Irrep(1, -1).D_from_matrix(-torch.eye(3))
>>> m.long()
tensor([[-1,  0,  0],
[ 0, -1,  0],
[ 0,  0, -1]])

D_from_quaternion(q, k=None)

Matrix of the representation, see Irrep.D_from_angles

Parameters
Returns

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

Return type

torch.Tensor

count(_value)

Return number of occurrences of value.

property dim

The dimension of the representation, $$2 l + 1$$.

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)$$

Examples

>>> it = Irrep.iterator()
>>> next(it), next(it), next(it), next(it)
(0e, 0o, 1o, 1e)

property l

The degree of the representation, $$l = 0, 1, \dots$$.

property p

The parity of the representation, $$p = \pm 1$$.

class e3nn.o3.Irreps(irreps=None)

Bases: tuple

Direct sum of irreducible representations of $$O(3)$$

This class does not contain any data, it is a structure that describe the representation. It is typically used as argument of other classes of the library to define the input and output representations of functions.

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$$ values

Type

list of int

lmax

maximum $$l$$ value

Type

int

Examples

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

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

>>> x.dim
250


Create a representation of 100 $$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


Empty Irreps

>>> Irreps(), Irreps("")
(, )


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) Multiplicity of ir. index(_object) Return first index of value. randn(*size[, normalization, requires_grad, …]) Random tensor. Simplify the representations. List of slices corresponding to indices for each irrep. Sort the representations. representation of the spherical harmonics
D_from_angles(alpha, beta, gamma, k=None)

Matrix of the representation

Parameters
Returns

tensor of shape $$(..., \mathrm{dim}, \mathrm{dim})$$

Return type

torch.Tensor

D_from_matrix(R)

Matrix of the representation

Parameters

R (torch.Tensor) – tensor of shape $$(..., 3, 3)$$

Returns

tensor of shape $$(..., \mathrm{dim}, \mathrm{dim})$$

Return type

torch.Tensor

D_from_quaternion(q, k=None)

Matrix of the representation

Parameters
Returns

tensor of shape $$(..., \mathrm{dim}, \mathrm{dim})$$

Return type

torch.Tensor

count(ir)int

Multiplicity of ir.

Parameters

ir (Irrep) –

Returns

total multiplicity of ir

Return type

int

index(_object)

Return first index of value.

Raises ValueError if the value is not present.

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

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])

>>> random_tensor = Irreps("2o").randn(2, -1, 3, normalization='norm')
>>> random_tensor.norm(dim=1).sub(1).abs().max().item() < 1e-5
True

simplify()

Simplify the representations.

Returns

Return type

Irreps

Examples

Note that simplify does not sort the representations.

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


Equivalent representations which are separated from each other are not combined.

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

slices()

List of slices corresponding to indices for each irrep.

Examples

>>> Irreps('2x0e + 1e').slices()
[slice(0, 2, None), slice(2, 5, None)]

sort()

Sort the representations.

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$$

Returns

representation of $$(Y^0, Y^1, \dots, Y^{\mathrm{lmax}})$$

Return type

Irreps

Examples

>>> Irreps.spherical_harmonics(3)
1x0e+1x1o+1x2e+1x3o