LocalTerm Class

class ed_lgt.modeling.local_term.LocalTerm(operator, op_name, **kwargs)[source]

Bases: QMBTerm

This function provides methods for computing local Hamiltonian terms in a d-dimensional lattice model.

Parameters:
  • operator (scipy.sparse) – A single site sparse operator matrix.

  • op_name (str) – Operator name

  • **kwargs – Additional keyword arguments for QMBTerm.

get_Hamiltonian(strength, mask=None)[source]

The function calculates the Local Hamiltonian by summing up local terms for each lattice site, potentially with some sites excluded based on the mask. The result is scaled by the strength parameter before being returned.

Parameters:
  • strength (scalar) – Coupling of the Hamiltonian term.

  • mask (np.ndarray, optional) – d-dimensional array with bool variables specifying (if True) where to apply the local term. Defaults to None.

Raises:

TypeError – If the input arguments are of incorrect types or formats.

Returns:

Local Hamiltonian term ready to be used for exact diagonalization/

expectation values.

Return type:

scipy.sparse

get_expval(psi, stag_label=None)[source]

The function calculates the expectation value (and it variance) of the Local Hamiltonian and is averaged over all the lattice sites.

Parameters:
  • psi (instance of QMB_state class) – QMB state where the expectation value has to be computed

  • stag_label (str, optional) – if odd/even, then the expectation value is performed only on that kind of sites. Defaults to None.

Raises:

TypeError – If the input arguments are of incorrect types or formats.