qstack.spahm.rho.sym

Symmetry operations for SPAHM(a,b) representations.

qstack.spahm.rho.sym.c_split_atom(mol, c, only_i=None)[source]

Split coefficient vector by angular momentum quantum number for each atom.

Organizes expansion coefficients into sublists grouped by angular momentum (l) for each atomic basis function.

Parameters:
  • mol (pyscf Mole) – pyscf Mole object.

  • c (numpy ndarray) – 1D array of expansion coefficients.

  • only_i (list[int]) – List of atom indices to use.

Returns:

List of coefficients (numpy ndarrays) per atom.

Return type:

list

qstack.spahm.rho.sym.get_S(q, basis)[source]

Compute overlap matrix and angular momentum info for an atom.

Creates single-atom molecule and extracts basis function structure.

Parameters:
  • q (str) – Element symbol.

  • basis (str or dict) – Basis set.

Returns:

(S, ao, ao_start) where: - S (numpy ndarray): Overlap matrix - ao (dict): Angular momentum info with ‘l’ and ‘m’ lists for each AO - ao_start (list): Starting indices for each angular momentum shell

Return type:

tuple

qstack.spahm.rho.sym.idxl0(i, l, m)[source]

Return index of basis function (AO) with same L and N quantum numbers but M=0.

Finds the m=0 component of the same angular momentum shell.

Parameters:
  • i (int) – Basis function (atomic orbital) index.

  • l (int) – Angular momentum quantum number.

  • m (int) – Magnetic quantum number.

Returns:

Index of corresponding m=0 atomic orbital.

Return type:

int

qstack.spahm.rho.sym.metric_matrix_short(idx, ao, S)[source]

Compute metric matrix for symmetrization of short-format coefficients.

Parameters:
  • idx (numpy ndarray) – [i, j] basis function pair indices.

  • ao (dict) – Angular momentum info with ‘l’ and ‘m’ lists for each AO.

  • S (numpy ndarray) – Overlap matrix.

Returns:

Square root of metric matrix.

Return type:

numpy ndarray

qstack.spahm.rho.sym.metric_matrix_z(idx, ao, S)[source]

Compute metric matrix for z-axis symmetric representations.

Constructs metric matrix accounting for m and -m degeneracy. Matrix elements are nonzero only when angular momenta match and m quantum numbers satisfy m_i=m_i1 AND m_j=m_j1, or m_i=-m_i1 AND m_j=-m_j1.

Parameters:
  • idx (numpy ndarray) – [i, j] basis function pair indices.

  • ao (dict) – Angular momentum info with ‘l’ and ‘m’ lists for each AO.

  • S (numpy ndarray) – Overlap matrix.

Returns:

Square root of metric matrix for z-symmetric normalization.

Return type:

numpy ndarray

qstack.spahm.rho.sym.store_pair_indices_short(ao, ao_start)[source]

Store basis function pair indices for m=0 components only.

Creates list of (i,j) pairs using only the first basis function of each angular momentum shell, for compact representation.

Parameters:
  • ao (dict) – Angular momentum info with ‘l’ and ‘m’ lists for each AO

  • ao_start (list) – Starting indices for each angular momentum shell.

Returns:

[i, j] index pairs for m=0 components with matching L.

Return type:

numpy ndarray

qstack.spahm.rho.sym.store_pair_indices_z(ao)[source]

Store basis function pairs with matching |m| quantum numbers.

Creates list of all (i,j) pairs where basis functions have equal absolute values of magnetic quantum number m.

Parameters:

ao (dict) – Angular momentum info with ‘l’ and ‘m’ lists for each AO.

Returns:

[i, j] index pairs with |m_i| = |m_j|.

Return type:

numpy ndarray

qstack.spahm.rho.sym.store_pair_indices_z_only0(ao)[source]

Store basis function pairs restricted to m=0 components only.

Creates list of all (i,j) pairs where both basis functions have m=0.

Parameters:

ao (dict) – Angular momentum info with ‘l’ and ‘m’ lists for each AO.

Returns:

[i, j] index pairs where both m_i = m_j = 0.

Return type:

numpy ndarray

qstack.spahm.rho.sym.vectorize_c(idx, c)[source]

Vectorizes density fitting coefficients by forming products.

Creates rotationally invariant representation from coefficient products.

Parameters:
  • idx (numpy ndarray) – [i, j] basis function pair indices.

  • c (numpy ndarray) – 1D array of coefficients.

Returns:

1D array of coefficient products c[i]*c[j].

Return type:

numpy ndarray

qstack.spahm.rho.sym.vectorize_c_MR2021(idx_pair, ao, c)[source]

Vectorizes coefficients using MR2021 scheme.

Reference:

J. T. Margraf, K. Reuter, “Pure non-local machine-learned density functional theory for electron correlation”, Nat. Commun. 12, 344 (2021), doi:10.1038/s41467-020-20471-y

Computes simplified rotationally invariant representation by contracting coefficients within each angular momentum shell.

Parameters:
  • idx_pair (numpy ndarray) – [i, j] basis function pair indices.

  • ao (dict) – Angular momentum info with ‘l’ and ‘m’ lists for each AO.

  • c (numpy ndarray) – 1D array of density fitting coefficients.

Returns:

1D array of contracted coefficient norms per shell.

Return type:

numpy ndarray

qstack.spahm.rho.sym.vectorize_c_short(idx, ao, c)[source]

Vectorizes coefficients using short format with shell-wise dot products.

Computes representation by contracting coefficient vectors of angular momentum shells.

Parameters:
  • idx (numpy ndarray) – [i, j] basis function pair indices (shell starts).

  • ao (dict) – Angular momentum info with ‘l’ and ‘m’ lists for each AO.

  • c (numpy ndarray) – 1D array of density fitting coefficients.

Returns:

1D array of shell-pair dot products.

Return type:

numpy ndarray