Group#

Group Class#

Group database class.

This module provides Group database maneger.

class Group(tag, with_opt=False)[source]#

Bases: dict

Group database manager.

Parameters:
  • tag (str or int) – group tag.

  • with_opt (bool, optional) – load additional data ?

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

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.

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_s/bond_a/vector/bond”.

Returns:

  • (Dict) – cluster SAMB.

Note

  • SAMB is sorted in order of (Q/G/T/M), Gamma, (k,) l, n, p.

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 (Q/G/T/M), s, k, Gamma, l, n, 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.

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

Note

  • bond string is “[tail];[head] / [vector]@[center] / [start]:[vector]”.

  • for SG, Wyckoff bond in order of (plus_set1, plus_set2, …).

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, …).

classmethod global_info()[source]#

Global information.

Returns:

  • (dict) – global information.

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.

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.

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,3), “sss/ssa/aas/aaa/sa/as/s/a/t” (rank 4).

response_tensor_all(X)[source]#

Create all response tensors up to rank 4 (in accordance with MPG).

Parameters:

X (str) – tensor type.

Returns:

  • (dict) – response tensors.

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 group_type#

Group type.

Returns:

  • (str) – PG/SG/MPG/MSG.

property harmonics#

Get harmonics dict (in accordance with PG).

Returns:

  • (dict) – harmonics dict.

Note

  • Harmonics is sorted in order of (Q/G/T/M), s, k, l, Gamma, n, p.

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 opt#

Optional dict (PG only).

Returns:

  • (dict) – optional dict.

Note

  • harmonics_multipole: multipolar harmonics.

  • harmonics_irrep: harmonics grouped by irrep.

  • representation_matrix: representation matrix.

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.

replace_bar(s)[source]#