Trace moments#

Trace moments of a SAMB Hamiltonian, the model-dependent part of the response tensors.

For the Hamiltonian h = sum_j z_j Z_j of a model and operators O_1, …, O_n,

Gamma^{i_1 … i_n}_{O_1; …; O_n} = (1/N) sum_k Tr[O_1(k) h(k)^{i_1} O_2(k) h(k)^{i_2} … O_n(k) h(k)^{i_n}]

(per unit cell, N: number of k points), Eqs. (31)-(33) of R. Oiwa and H. Kusunose, J. Phys. Soc. Jpn. 91, 014701 (2022). Gamma is a polynomial in z_j: its lowest nonzero terms show the essential parameters of a response.

  • Operators. A matrix dict {(n1,n2,n3,m,n): value} (as the SAMB matrices of MultiPie, the indices of the full matrix from 0, value may be (value, bond_no)), a file in the format of seedname_hr.dat of Wannier90 (indices from 1, divided by the Wigner-Seitz degeneracy), the name of a SAMB of the model (zj), or the velocity operator of the Hamiltonian “v_a1a2…”, v_{a1…an}(k) = d_{a1} … d_{an} h(k) (a = x, y, z, Cartesian; hbar = 1; the length unit of the cell). In real space, v_{a1…an}(R)_{mn} = (i x_{a1}) … (i x_{an}) h(R)_{mn} with the bond vector x = (R + r_n - r_m) A, so that v is linear in z_j.

  • Exact k sum. O(k) = sum_R O(R) exp(2 pi i k.R) (lattice gauge; a trace does not depend on the gauge). A product of operators whose ranges are r^(1), r^(2), … in a_i reaches at most sum r^(.), and the uniform grid of N_i = sum r^(.) + 1 points gives the exact k sum (the R = 0 component of the product).

  • Numerical values. With h(k) = U e U^dagger at each k, O~ = U^dagger O U and V_{i,b} = e_b^i (or T_i(e_b) in the Chebyshev form), Gamma^{i_1…i_n} = sum_{b_0…b_{n-1}} O~1_{b0 b1} V_{i1 b1} O~2_{b1 b2} V_{i2 b2} … O~n_{b_{n-1} b0} V_{in b0}: one diagonalization gives all orders.

  • Polynomials. The word O_1 h^{i_1} O_2 … is multiplied as a dict {monomial: matrix(k)} with h = h_0 + sum_{j in V} z_j Z_j (V: the variables, h_0: the fixed part), and the trace is summed on the exact grid. A polynomial is identically zero if its value at random z vanishes; the variables on which Gamma does not depend are dropped before the expansion.

class TraceMoment(samb, atom, A, parameter=None, operator=None, topdir=None)[source]#

Bases: object

Trace moments of a SAMB Hamiltonian.

Parameters:
  • samb (dict) – SAMB matrices, dict[zj, dict[(n1,n2,n3,m,n), value or (value, bond_no)]].

  • atom (array-like) – positions of the kets (fractional, primitive).

  • A (array-like) – primitive vectors, [a1, a2, a3].

  • parameter (dict, optional) – values of zj (missing: 0).

  • operator (dict, optional) – operators, dict[name, spec] (see add_operator).

  • topdir (str, optional) – directory of the operator files.

add_operator(name, spec)[source]#

Add an operator.

Parameters:
  • name (str) – name of the operator.

  • spec (dict or str) – matrix dict {(n1,n2,n3,m,n): value} (indices from 0), file name of the format of seedname_hr.dat (indices from 1), SAMB name zj, or the velocity “v_a1a2…” (d_{a1}…d_{an} h).

lowest(ops, n_term=1, max_order=10, part=None, variable=None, parameter=None, simplify=True, factor=False, expand=True, seed=0)[source]#

Lowest nonzero trace moments as polynomials in zj.

Parameters:
  • ops (tuple) – names of the operators, (O_1, …, O_n).

  • n_term (int, optional) – number of nonzero terms from the lowest total order sum i.

  • max_order (int, optional) – maximum total order.

  • part (str, optional) – “re”/”im”/None.

  • variable (list, optional) – zj kept as symbols; the others are fixed to the current values. [default: all]

  • parameter (dict, optional) – values of the fixed zj overriding the current ones.

  • simplify (bool, optional) – simplify the coefficients ?

  • expand (bool, optional) – expand the polynomials ? if False, only “variable” and “essential” are given (fast for many zj).

  • factor (bool, optional) – factorize the polynomials fully (sympy.factor, slow for many terms) ? if False, only the common factors are taken out (sympy.factor_terms).

  • seed (int, optional) – seed of the random values for the zero test.

Returns:

  • (list) – list of dict with “order” (tuple), “variable” (zj appearing), “essential” (zj whose zero makes the term vanish), “polynomial” (sympy), “factor” (sympy, common factors taken out).

Notes

  • the terms are in the order of the total order sum i, and in lexicographic order of (i_1, …, i_n) for the same total order.

  • a term is nonzero if its value at random zj (variables) is nonzero; “variable” and “essential” are also determined numerically at random zj.

  • the number of terms of a polynomial grows as (number of zj)^(degree): use variable (a subset of zj) or expand=False for a model with many zj.

polynomial(ops, order, part=None, variable=None, parameter=None, simplify=True, grid=None)[source]#

Trace moment as a polynomial in zj.

Parameters:
  • ops (tuple) – names of the operators, (O_1, …, O_n).

  • order (tuple) – orders (i_1, …, i_n).

  • part (str, optional) – “re”/”im”/None.

  • variable (list, optional) – zj kept as symbols; the others are fixed to the current values. [default: all]

  • parameter (dict, optional) – values of the fixed zj overriding the current ones.

  • simplify (bool, optional) – simplify the coefficients (sqrt of small integers) ?

  • grid (tuple, optional) – k grid. [default: the exact grid]

Returns:

  • (sympy) – Gamma^{i_1…i_n} per unit cell.

set_parameter(parameter)[source]#

Set values of zj.

Parameters:

parameter (dict) – dict[zj, value].

value(ops, order, parameter=None, polynomial='power', scale=None, grid=None, part=None)[source]#

Numerical trace moments at the current parameter.

Parameters:
  • ops (tuple) – names of the operators, (O_1, …, O_n).

  • order (int) – maximum order of each power of h.

  • parameter (dict, optional) – values of zj overriding the current ones.

  • polynomial (str, optional) – “power” (h^i) or “chebyshev” (T_i(h~), h~ = (h - Ec)/W).

  • scale (tuple, optional) – (W, Ec) of h~ = (h - Ec)/W. [default: (1, 0) for power, the spectrum for chebyshev]

  • grid (tuple, optional) – k grid. [default: the exact grid]

  • part (str, optional) – “re”/”im”/None.

Returns:

  • (ndarray) – Gamma[i_1, …, i_n] per unit cell.

property operator#

Names of the operators.

Returns:

  • (list) – list of names.

property variable#

Names of the SAMB, zj.

Returns:

  • (list) – list of zj.

derivative_matrix(OR, atom, A, axis)[source]#

k derivative of an operator in real space.

Parameters:
  • OR (dict) – dict[((n1,n2,n3),m,n), value].

  • atom (ndarray) – positions of the kets (fractional).

  • A (ndarray) – primitive vectors, [a1, a2, a3].

  • axis (str) – Cartesian axes, e.g., “xy” for d_x d_y.

Returns:

  • (dict) – d_{a1} … d_{an} O, dict[((n1,n2,n3),m,n), value], (i x_{a1}) … (i x_{an}) O(R)_{mn}, x = (R + r_n - r_m) A.

matrix_dict(O, dim)[source]#

Normalize an operator matrix dict.

Parameters:
  • O (dict) – dict[(n1,n2,n3,m,n), value or (value, bond_no)] or dict[((n1,n2,n3),m,n), value].

  • dim (int) – dimension of the full matrix.

Returns:

  • (dict) – dict[((n1,n2,n3),m,n), complex], without zeros.

matrix_range(OR)[source]#

Range of an operator.

Parameters:

OR (dict) – dict[((n1,n2,n3),m,n), value].

Returns:

  • (ndarray) – maximum of abs(n_i) for i = 1, 2, 3.

order_tuples(n, total)[source]#

Orders (i_1, …, i_n) with sum i = total in lexicographic order.

Parameters:
  • n (int) – number of operators.

  • total (int) – total order.

Returns:

  • (list) – list of tuples.

read_operator_hr(filename, topdir=None)[source]#

Read an operator in the format of seedname_hr.dat.

Parameters:
  • filename (str) – file name.

  • topdir (str, optional) – directory of the file.

Returns:

  • (dict) – dict[(n1,n2,n3,m,n), value] (indices from 0, divided by the Wigner-Seitz degeneracy).