Group#
Group Class#
Group database class.
This module provides Group database maneger.
- class Group(tag)[source]#
Bases:
dictGroup database manager.
- Parameters:
tag (str or int) – group tag.
Note
PG tag is PG:1-47 or Schoenflies.
SG tag is SG:1-230, Schoenflies, or number (1-230).
MPG tag is MPG:HM_ID or HM_ID, HM_ID=(PG.no.ID).
MSG tag is MSG:BNS_ID or BNS_ID, BNS_ID=(SG.no).
the group data is loaded once and kept in memory. The Group objects of the same group share its NumPy arrays, which are read only, and SymPy expressions; dicts and lists are copied for each Group object. Group.clear_cache() releases the data kept in memory (existing Group objects keep theirs).
- atomic_basis(basis_type)[source]#
Get atomic basis set dict.
- Parameters:
basis_type (str) – basis type, “jml/lgs/lg”.
- Returns:
(dict) – atomic basis in each rank.
- static atomic_multipole_operator(X, l, m, s=0, k=0)[source]#
Operator expression of atomic multipole X_{lm}^{(s)}(k), following H. Kusunose, R. Oiwa, and S. Hayami, J. Phys. Soc. Jpn. 89, 104704 (2020).
- Parameters:
X (str) – type, Q/G/T/M.
l (int) – rank.
m (int) – component of the spherical basis, -l <= m <= l.
s (int, optional) – 0 (spinless) or 1 (spinful).
k (int, optional) – -s <= k <= s, l + k >= 0.
- Returns:
- the position x, y, z, the orbital angular
momentum l_x, l_y, l_z (dimensionless), and the Pauli matrices sigma_x, sigma_y, sigma_z (sigma_0 = 1, the spin is sigma/2).
- Return type:
(sympy) – expression in the noncommutative operators
Notes
spinless (Eqs. 1-4), with l = -i (r x nabla) and nabla acting only on O_lm = sqrt(4pi/(2l+1)) r^l Y_lm: Q_lm = O_lm, M_lm = [(nabla O_lm).l + l.(nabla O_lm)]/(l+1), T_lm = [(nabla O_lm).(r x l) - (l x r).(nabla O_lm)]/((l+1)(l+2)), G_lm = 2i [(nabla O_lm).l l^2 - l^2 l.(nabla O_lm)]/((l+1)^2 (l+2)).
spinful (Eq. 13 and Table I): X_lm^(1)(k) = i^(1+k) (-1)^(l+m) sqrt(2l+1) sum_n (l+k, l, 1; m-n, -m, n) X’_(l+k,m-n) sigma_(1,n), with sigma_(1,0) = sigma_z, sigma_(1,+-1) = -+(sigma_x +- i sigma_y)/sqrt(2), and X’ of Table I.
commutation relations: [l_i, l_j] = i eps_ijk l_k, [sigma_i, sigma_j] = 2i eps_ijk sigma_k, [l_i, x_j] = i eps_ijk x_k, [x_i, x_j] = 0, and sigma commutes with l and the position.
the order of the operators in the definition is kept (no simplification by the commutation relations), except that a run of consecutive position operators is sorted as x, y, z, and the Pauli matrices are moved to the right end. G_lm with l < 2 is 0.
the operator acts on any orbitals, including those of different ranks (e.g., p-d).
- atomic_samb(basis_type, rank_bra_ket, mask_bra_ket=None)[source]#
Get atomic SAMB Dict (in accordance with PG).
- Parameters:
basis_type (str) – basis type, “jml/lgs/lg”.
rank_bra_ket (tuple) – bra-ket rank, 0-3, (bra,ket).
mask_bra_ket (tuple, optional) – mask orbital index to use, (bra:[int],ket:[int]).
- Returns:
(Dict) – atomic SAMB.
Note
SAMB is sorted in order of (Q/G/T/M), s, k, Gamma, l, n.
mask_bra_ket (bra,ket) can be given as ([int],[int]), ([str],[str]), (ndarray,ndarray) or (str,str).
([int],[int]) orbital indices of tesseral basis for given basis_type.
([str],[str]) orbital names of tesseral basis for given basis_type.
(ndarray,ndarray) or (str,str) unitary matrix from JML/Lgs/Lg to n basis, <JML/Lgs/Lg | n>.
- cg(tag1, tag2, tag)[source]#
Clebsch-Gordan (CG) coefficient, < tag1; tag2 | tag > (PG/SG only).
- Parameters:
tag1 (tuple) – multipole tag1.
tag2 (tuple) – multipole tag2.
tag (tuple) – multipole tag.
- Returns:
(ndarray) – CG coefficient, CG[gamma1][gamma2][gamma].
- cluster_samb(wp, cluster_type=None)[source]#
Get cluster SAMB Dict (PG/SG only).
- Parameters:
wp (str) – wyckoff position.
cluster_type (str) – cluster type, “site/bond”.
- Returns:
(samb, expression)}.
- Return type:
(Dict) – cluster SAMB, {PGMultipoleType
Note
a site wp (“1a”) gives site cluster SAMB, and a bond wp (”3a@1a”) bond cluster SAMB.
bond cluster SAMB of Q/G (symmetric) is real, and that of T/M (anti-symmetric) is pure imaginary.
- combined_object(wp, samb_type, samb)[source]#
Create combined object for given atomic multipole (X,l) and cluster (PG/SG only).
- Parameters:
wp (str) – wyckoff site/bond of cluster.
samb_type (str) – combined SAMB type.
samb (Dict) – combined SAMB dict (obtained by multipole_cluster_samb).
- Returns:
(ndarray) – combined object in terms of (xyz) polynomial for each cluster site.
- combined_samb(a_samb_key, c_samb_key, toroidal_priority=False, **kwargs)[source]#
Get combined SAMB Dict (PG/SG only).
- Parameters:
a_samb_key (dict_keys) – named key of atomic SAMB, [PGMultipoleType].
c_samb_key (dict_keys) – named key of site or bond cluster SAMB, [PGMultipoleType].
toroidal_priority (bool, optional) – use (G,T) prior to (Q,M) in creation ?
kwargs (dict, optional) – select conditions for multipoles with keywords, [“X”, “l”, “Gamma”, “s”].
- Returns:
(Dict) – combined SAMB.
Note
SAMB is sorted in order of Gamma (as the character table), electric (Q, G) / magnetic (T, M), s, k, l, X (Q, G, T, M), n, p (see, combined_samb_order).
- coset_decomposition(parent, embedding=None, modulo='parent')[source]#
Get all the left cosets g H of a supergroup P.
- Parameters:
parent (Group or str) – supergroup P.
embedding (None, int, dict or array, optional) – embedding (index of embedding(), its dict, or A); default: the first one.
modulo (str, optional) – “parent” (modulo the lattice of P) or “self” (modulo the lattice of H, the cosets of the translations of P included).
- Returns:
- [translation in the coordinates of H]”),
”rep_matrix” (4x4 in the coordinates of H), “ops” (tags), “order” (smallest n with g^n in H), “kind” (“identity”, “translation”, “rotation”, “improper”, “inversion”), H first.
- Return type:
(list) – [dict] with “rep” (tag “point operation of P
- create_atomic_samb_L(basis_rank)[source]#
Create atomic multipoles X_{lm}^{(0)}(0) for given LM (in accordance with PG).
- Parameters:
basis_rank (int) – bra-ket rank (integer only).
- Returns:
(dict) – atomic multipoles, Dict[SphericalMultipoleType, ndarray].
(list) – basis.
- create_cell_bond(bond)[source]#
Create bonds in unit cell (sorted, nondirectional and with plus set).
- Parameters:
bond (ndarray or str) – bond.
- Returns:
(ndarray) – bonds (sorted) in unit cell.
(list) – SO mapping (index from 1).
(str) – Wyckoff bond or None.
Note
bond string is “[tail];[head] / [vector]@[center] / [start]:[vector]”.
if group is PG/SG, return Wyckoff bond as well.
- create_cell_multipole(multipole_site, X='Q', average=True)[source]#
Create transformed multipole in unit cell.
- Parameters:
multipole_site (str) – multipole # site/bond. multipole (site/bond) in cartesian (fractional) coordinate.
X (str, optional) – vector type, “Q/G/T/M”.
average (bool, optional) – average at same site ?
- Returns:
(ndarray) – transformed multipoles at each unique site, [[ma, mb],[mc, md],…].
(ndarray) – transformed unique sites (sorted).
(list) – SO mapping.
(str) – Wyckoff site (for bond center).
Note
if average is True, e.g., [ma, mb] is averaged as (ma+mb)/2.
if group is PG/SG, return Wyckoff site as well.
result in order of plus_set for SG.
- create_cell_site(site)[source]#
Create sites in unit cell (sorted and with plus set).
- Parameters:
site (ndarray or str) – site.
- Returns:
(ndarray) – sites (sorted) in unit cell.
(list) – SO mapping (index from 1).
(str) – Wyckoff site or None.
Note
site string is “[x,y,z]”.
if group is PG/SG, return Wyckoff site as well.
- create_cell_vector(vector_site, X='Q', average=True, cartesian=False)[source]#
Create trasformed vector in unit cell.
- Parameters:
vector_site (str) – vector # site/bond. site/bond in fractional coordinate.
X (str, optional) – vector type, “Q/G/T/M”.
average (bool, optional) – average at same site ?
cartesian (bool, optional) – vector in cartesian coordinate ?
- Returns:
(ndarray) – transformed vectors at each unique site, [[va, vb],[vc, vd],…].
(ndarray) – transformed unique sites (sorted).
(list) – SO mapping.
(str) – Wyckoff site (for bond center).
Note
if average is True, e.g., [va, vb] is averaged as (va+vb)/2.
if group is PG/SG, return Wyckoff site as well.
result in order of plus_set for SG.
- embedding(parent)[source]#
Get the embeddings of the group H in a supergroup P.
- Parameters:
parent (Group or str) – supergroup P.
- Returns:
(list) – [dict] with “parent”, “A” (x_P = A x_H, 4x4), “R”, “shift”, “origin”, “index”, “index_parent”, “path”; [] if P is not a supergroup.
Note
embeddings are different when they give different sets of the operations of P in the coordinates of H: they give different parent structures for the same atoms of H.
- find_wyckoff(site_bond)[source]#
Find Wyckoff site (all types) or bond (PG/SG only).
- Parameters:
site_bond (ndarray or str) – site or bond (vector+center) to find.
- Returns:
(str) – Wyckoff site or bond (return None when not found).
(ndarray) – set of Wyckoff site or bond (vector+center).
Note
for SG, Wyckoff site or bond in order of (plus_set1, plus_set2, …).
- find_wyckoff_bond(bond)[source]#
Find Wyckoff bond (PG/SG only).
- Parameters:
bond (ndarray or str) – bond (vector+center) to find.
- Returns:
(str) – Wyckoff bond (return None when not found).
(ndarray) – set of Wyckoff bond (vector+center) (return None when not found).
Note
bond string is “[tail];[head] / [vector]@[center] / [start]:[vector]”.
for SG, Wyckoff bond in order of (plus_set1, plus_set2, …).
for MPG/MSG, (None, None) is returned.
- find_wyckoff_site(site)[source]#
Find Wyckoff site.
- Parameters:
site (ndarray or str) – site to find.
- Returns:
(str) – Wyckoff site (return None when not found).
(ndarray) – set of Wyckoff site.
Note
site string is “[x,y,z]”.
for SG, Wyckoff site in order of (plus_set1, plus_set2, …).
- latex(detail=False, tp=None)[source]#
Group info. in LaTeX format.
- Parameters:
detail (bool, optional) – detailed info ?
tp (str, optional)
- Returns:
(str) – info. in LaTeX format.
- map_site(op, wyckoff, parent, embedding=None, limit=0)[source]#
Get the atoms of a Wyckoff site moved by an operation of a supergroup P on its parent structure.
- Parameters:
op (str or array) – element of P (“point operation of P:[translation in H]” or 4x4 in the coordinates of H).
wyckoff (str) – Wyckoff site of H.
parent (Group or str) – supergroup P.
embedding (None, int, dict or array, optional) – embedding (see coset_decomposition).
limit (int, optional) – index of the parent structure in parent_limit().
- Returns:
- (j, n)}: op r_i = r_j + n on the parent structure, i, j: atoms (from 1, in the order of the
Wyckoff positions and the plus set), n: lattice vector (conventional).
- Return type:
(dict) – {i
- classmethod multipolar_harmonics_expression(X, l, m, s=0, k=0, x='q', internal='cubic')[source]#
Expression of multipolar spherical harmonics with internal degree of freedom, O_{lm}^{(s)}(k).
- Parameters:
X (str) – type, Q/G/T/M.
l (int) – rank.
m (int) – component of the spherical basis, -l <= m <= l.
s (int, optional) – internal rank, 0 <= s <= 3.
k (int, optional) – internal component, -s <= k <= s, l + k >= 0.
x (str, optional) – internal type, q (polar, symbols Q_{…}) or g (axial, symbols G_{…}).
internal (str, optional) – internal basis, cubic or hexagonal.
- Returns:
(sympy) – polynomial in x, y, z multiplied by the internal basis symbols.
Notes
the definition is that of the PG multipolar harmonics (multipolar_harmonics): O_{lm}^{(s)}(k) = i^{k+s} (-1)^{l+m} sqrt(2l+1) sum_n (l+k, l, s; m-n, -m, n) O_{l+k,m-n}(r) e_n.
the spatial part O_{l+k,m-n}(r) is always polar, so that x is fixed by X and the parity of s+k: for X = Q/T, x = q if s+k is even and g if odd; for X = G/M, the opposite. A combination of X and x of the wrong parity gives 0.
for X = T/M, the internal symbols Q/G are renamed T/M (magnetic internal degree of freedom).
for s = 0, the internal symbol is multiplied only for G_{0} and M_{0}; Q_{0} and T_{0} are omitted.
the internal basis is that of the orbitals of rank s, info[“harmonics”][“atomic_basis”][“spinless”][internal], with the symbols info[“harmonics”][“internal_basis”][internal][(s, x)].
- multipole_cluster_samb(X, l, site_bond)[source]#
Create atomic multipole and cluster combined SAMB (PG/SG only).
- Parameters:
X (str) – head of atomic multipole.
l (int) – rank of atomic multipole.
site_bond (str) – site or bond.
- Returns:
(Dict) – combined SAMB.
(str) – wyckoff site/bond.
(ndarray) – cluster sites or center of bonds.
- name(detail=False, tp=None)[source]#
Group info. in text format.
- Parameters:
detail (bool, optional) – detailed info ?
tp (str, optional)
- Returns:
(str) – info. in plain text format.
- parent_limit(parent, wyckoff=None, embedding=None)[source]#
Get the parent structures of the Wyckoff sites for a supergroup P.
- Parameters:
parent (Group or str) – supergroup P.
wyckoff (str or [str], optional) – Wyckoff sites (default: all with free parameters).
embedding (None, int, dict or array, optional) – embedding (see coset_decomposition).
- Returns:
- [{“param”: {parameter: expression}, “position”, “parent_wyckoff”}]}, the values of the
parameters at which the orbit is invariant under P (modulo 1, the orbits with coinciding sites excluded).
- Return type:
(dict) – {wyckoff
- response_tensor(X, rank, comp=None, opt=None)[source]#
Get response tensor (in accordance with MPG).
- Parameters:
X (str) – tensor type, “Q/G/T/M”.
rank (int) – tensor rank, (0,1,2,3,4).
comp (int or tuple, optional) – tensor component, index=(1:x,2:y,3:z).
opt (str, optional) – tensor type option.
- Returns:
(sympy) – tensor component.
Note
tensor type, None (rank 0,1), “s/a” (rank 2), “ss/sa/a” (rank 3), “sss/ssa/aas/aaa/sa/as/s/a/t” (rank 4).
- response_tensor_all(X=None)[source]#
Get all response tensors up to rank 4 (in accordance with MPG).
- Parameters:
X (str, optional) – tensor type, “Q/G/T/M”. If None, the tensors of all the types.
- Returns:
(tensor of symbols, {symbol: expression})}.
- Return type:
(dict) – response tensors, {(X, rank, opt)
Note
the tensors are in the group database (the same as those given by response_tensor).
the type is the first element of the key, so that X is not needed to use the tensors, e.g., response_tensor_all()[(“Q”, 2, “s”)].
tensor type opt, “” (rank 0,1), “s/a” (rank 2), “ss/sa/a” (rank 3), “sss/ssa/aas/aaa/sa/as/s/a/t” (rank 4).
- supergroups(max_index=None, chain=False)[source]#
Get the supergroups of the group (PG and SG), not only the direct parents.
- Parameters:
max_index (int, optional) – upper limit of the index [P:H] (modulo the lattice of H).
chain (bool, optional) – only the chain of the representative parents (Group.global_info()[“parent”]) ?
- Returns:
(list) – [dict] with “group”, “A” (x_P = A x_H, 4x4), “R”, “shift”, “origin” (the origin of P in the coordinates of H), “index”, “index_parent” ([P:H] modulo the lattice of P), “path” (a chain of direct supergroups H, …, P), “direct”, one for each supergroup up to the normalizer of H.
Note
the direct supergroups (H is a maximal subgroup) are Group.global_info()[“supergroup”] of the binaries; the others are their chains. Without max_index, every chain up to the top groups is followed (slow for a group of low symmetry).
- static tag_atomic_basis(tag, rank, ket=True, latex=False)[source]#
Tag atomic basis.
- Parameters:
tag (str) – basis tag.
rank (int) – rank.
ket (bool, optional) – ket or bra ?
latex (bool, optional) – LaTeX format ?
- Returns:
(dict or str) – info dict or LaTeX.
- tag_atomic_basis_proj(basis_type, rank, mask=None, ket=True)[source]#
Tag atomic basis for given option.
- Parameters:
basis_type (str) – basis type, “jml”, “lgs”, “lg”.
rank (int) – rank.
mask (list, optional) – mask, [int], [str], U=<JML/Lgs/Lg | n>.
ket (bool, optional) – ket or bra ?
- Returns:
(list) – list of basis in sympy.
- static tag_irrep(tag, latex=False)[source]#
Tag irrep.
- Parameters:
tag (str) – irrep. tag.
latex (bool, optional) – LaTeX format ?
- Returns:
(dict or str) – info dict or LaTeX.
- static tag_multipole(tag, comp=None, latex=False, superscript='', vector=False, internal=False)[source]#
Tag multipole.
- Parameters:
tag (tuple) – multipole index (harmonics key with any X).
comp (int, optional) – component.
latex (bool, optional) – LaTeX format ?
superscript (str, optional) – additional superscript in LaTeX.
vector (bool, optional) – vector symbol in LaTeX ?
internal (bool, optional) – with internal variable in LaTeX ?
- Returns:
(str or list) – multipole tag, if comp is None, all components in list.
- static tag_symmetry_operation(tag, latex=False)[source]#
Tag symmetry operation (fractional coordinate).
- Parameters:
tag (str) – symmetry operation tag.
latex (bool, optional) – LaTeX format ?
- Returns:
(dict or str) – info dict (fractional coordinate) or LaTeX.
- transform_atomic_samb(dic, U_ket=None, U_bra=None, spinful=False)[source]#
Transform atomic basis from tesseral rep. to cubic/hexagonal/given one.
- Parameters:
dic (Dict) – atomic SAMB dict.
U_ket (ndarray or int, optional) – U matrix from tesseral ket to given one, <t|n> or ket rank for lg/lgs.
U_bra (ndarray or int, optional) – U matrix from tesseral bra to given one, <t|n> or bra rank for lg/lgs.
spinful (bool, optional) – spinful basis ?
- Returns:
(Dict) – transformed atomic SAMB.
- transform_multipole(multipole, X='Q')[source]#
Transform multipole.
- Parameters:
multipole (str) – multipole in terms of (x,y,z,r) in cartesian coordinate.
X (str, optional) – vector type, “Q/G/T/M”.
- Returns:
(ndarray) – transformed multipoles in order of symmetry operations.
- transform_vector(vector, X='Q', cartesian=False)[source]#
Transform vector.
- Parameters:
vector (ndarray or str) – vector.
X (str, optional) – vector type, “Q/G/T/M”.
cartesian (bool, optional) – vector in cartesian coordinate ?
- Returns:
(ndarray) – transformed vectors in order of symmetry operations.
- property ID#
Get ID of group.
- Returns:
(str) – ID of group.
- property active_multipole#
Get active multipole (in accordance with MPG).
- Returns:
(dict) – active multipole.
- property character#
Get character dict (in accordance with PG).
- Returns:
(dict) – character dict.
- property coset#
Get the first coset of the group in its direct parent (PG and SG).
- Returns:
(dict) – coset data (“parent”, “R”, “index”, “ops”, “rep”, “rep_matrix”, “order”, “kind”, “frame”, “inversion”, “parent_limit”), None for a group without a parent or a complex PG.
Note
the parents and the cosets in all parents are in Group.global_info()[“parent”] and [“coset”].
- property group_type#
Group type.
- Returns:
(str) – PG/SG/MPG/MSG.
- property harmonics#
Get harmonics dict (in accordance with PG).
- Returns:
(expression, U)} of Q and G (rank <= 11).
- Return type:
(Dict) – harmonics, {PGMultipoleType
Note
expression (ndarray): polynomial in x, y, z for each component.
U (ndarray): (2l+1, dim) unitary matrix from the spherical harmonics O_lm (rows: m = l, …, -l).
harmonics are sorted in order of Gamma, l, (Q/G), n.
- property info#
Group info.
- Returns:
(namedtuple) – group info.
- property is_hexagonal_subgroup#
Check hexagonal subgroup.
- Returns:
(bool) – is hexagonal subgroup ?
- property is_magnetic_group#
Check magnetic group.
- Returns:
(bool) – is magnetic group ?
- property is_point_group#
Check point group.
- Returns:
(bool) – is point group ?
- property multipolar_harmonics#
Multipolar harmonics (in accordance with PG).
- Returns:
(coeff, expression)}.
- Return type:
(Dict) – multipolar harmonics (rank <= 3, internal rank s=1-3), {PGMultipoleType
- property representation_matrix#
Representation matrix (in accordance with PG).
- Returns:
[symmetry operation], “matrix”: {irrep: ndarray}}.
- Return type:
(dict) – representation matrix, {“tag”
- property symmetry_operation#
Get symmetry operation.
- Returns:
(dict) – symmetry operation.
- property wyckoff#
Get wyckoff site (all types) or bond (PG,SG only).
- Returns:
(dict) – wyckoff site/bond.