Irreps
A group representation \((D,V)\) describe the action of a group \(G\) on a vector space \(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_-\)
The group \(O(3)\) is the direct product of \(SO(3)\) and inversion
The irreps of \(O(3)\) are the product of the irreps of \(SO(3)\) and inversion.
An instance of the class e3nn.o3.Irreps
represent a direct sum of irreps of \(O(3)\):
where \((m_j \in \mathbb{N}, p_j = \pm 1, L_j = 0,1,2,3,\dots)_{j=1}^n\) defines the e3nn.o3.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: int | Irrep | str | tuple, p=None)[source]
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)\)
D_from_axis_angle
(axis, angle)Matrix of the representation, see
Irrep.D_from_angles
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.
Equivalent to
l == 0 and p == 1
iterator
([lmax])Iterator through all the irreps of \(O(3)\)
Attributes:
The dimension of the representation, \(2 l + 1\).
The degree of the representation, \(l = 0, 1, \dots\).
The parity of the representation, \(p = \pm 1\).
- D_from_angles(alpha, beta, gamma, k=None) Tensor [source]
Matrix \(p^k D^l(\alpha, \beta, \gamma)\)
(matrix) Representation of \(O(3)\). \(D\) is the representation of \(SO(3)\), see
wigner_D
.- Parameters:
alpha (
torch.Tensor
) – tensor of shape \((...)\) Rotation \(\alpha\) around Y axis, applied third.beta (
torch.Tensor
) – tensor of shape \((...)\) Rotation \(\beta\) around X axis, applied second.gamma (
torch.Tensor
) – tensor of shape \((...)\) Rotation \(\gamma\) around Y axis, applied first.k (
torch.Tensor
, optional) – tensor of shape \((...)\) How many times the parity is applied.
- Returns:
tensor of shape \((..., 2l+1, 2l+1)\)
- Return type:
See also
o3.wigner_D
,Irreps.D_from_angles
- D_from_axis_angle(axis, angle) Tensor [source]
Matrix of the representation, see
Irrep.D_from_angles
- Parameters:
axis (
torch.Tensor
) – tensor of shape \((..., 3)\)angle (
torch.Tensor
) – tensor of shape \((...)\)
- Returns:
tensor of shape \((..., 2l+1, 2l+1)\)
- Return type:
- D_from_matrix(R) Tensor [source]
Matrix of the representation, see
Irrep.D_from_angles
- Parameters:
R (
torch.Tensor
) – tensor of shape \((..., 3, 3)\)k (
torch.Tensor
, optional) – tensor of shape \((...)\)
- Returns:
tensor of shape \((..., 2l+1, 2l+1)\)
- Return type:
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) Tensor [source]
Matrix of the representation, see
Irrep.D_from_angles
- Parameters:
q (
torch.Tensor
) – tensor of shape \((..., 4)\)k (
torch.Tensor
, optional) – tensor of shape \((...)\)
- Returns:
tensor of shape \((..., 2l+1, 2l+1)\)
- Return type:
- class e3nn.o3.Irreps(irreps=None)[source]
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.
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
D_from_axis_angle
(axis, angle)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.
Remove any irreps with multiplicities of zero.
simplify
()Simplify the representations.
slices
()List of slices corresponding to indices for each irrep.
sort
()Sort the representations.
spherical_harmonics
(lmax[, p])representation of the spherical harmonics
- D_from_angles(alpha, beta, gamma, k=None)[source]
Matrix of the representation
- Parameters:
alpha (
torch.Tensor
) – tensor of shape \((...)\)beta (
torch.Tensor
) – tensor of shape \((...)\)gamma (
torch.Tensor
) – tensor of shape \((...)\)k (
torch.Tensor
, optional) – tensor of shape \((...)\)
- Returns:
tensor of shape \((..., \mathrm{dim}, \mathrm{dim})\)
- Return type:
- D_from_axis_angle(axis, angle)[source]
Matrix of the representation
- Parameters:
axis (
torch.Tensor
) – tensor of shape \((..., 3)\)angle (
torch.Tensor
) – tensor of shape \((...)\)
- Returns:
tensor of shape \((..., \mathrm{dim}, \mathrm{dim})\)
- Return type:
- D_from_matrix(R)[source]
Matrix of the representation
- Parameters:
R (
torch.Tensor
) – tensor of shape \((..., 3, 3)\)- Returns:
tensor of shape \((..., \mathrm{dim}, \mathrm{dim})\)
- Return type:
- D_from_quaternion(q, k=None)[source]
Matrix of the representation
- Parameters:
q (
torch.Tensor
) – tensor of shape \((..., 4)\)k (
torch.Tensor
, optional) – tensor of shape \((...)\)
- Returns:
tensor of shape \((..., \mathrm{dim}, \mathrm{dim})\)
- Return type:
- count(ir) int [source]
Multiplicity of
ir
.- Parameters:
ir (
e3nn.o3.Irrep
) –- Returns:
total multiplicity of
ir
- Return type:
- randn(*size: int, normalization: str = 'component', requires_grad: bool = False, dtype=None, device=None) Tensor [source]
Random tensor.
- Parameters:
- Returns:
tensor of shape
size
where-1
is replaced byself.dim
- Return type:
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
- remove_zero_multiplicities() Irreps [source]
Remove any irreps with multiplicities of zero.
- Return type:
Examples
>>> Irreps("4x0e + 0x1o + 2x3e").remove_zero_multiplicities() 4x0e+2x3e
- simplify() Irreps [source]
Simplify the representations.
- Return type:
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()[source]
List of slices corresponding to indices for each irrep.
Examples
>>> Irreps('2x0e + 1e').slices() [slice(0, 2, None), slice(2, 5, None)]
- sort()[source]
Sort the representations.
- Returns:
irreps (
e3nn.o3.Irreps
)p (tuple of int)
inv (tuple of int)
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: int, p: int = -1) Irreps [source]
representation of the spherical harmonics
- Parameters:
lmax (int) – maximum \(l\)
p ({1, -1}) – the parity of the representation
- Returns:
representation of \((Y^0, Y^1, \dots, Y^{\mathrm{lmax}})\)
- Return type:
Examples
>>> Irreps.spherical_harmonics(3) 1x0e+1x1o+1x2e+1x3o
>>> Irreps.spherical_harmonics(4, p=1) 1x0e+1x1e+1x2e+1x3e+1x4e