NBodyTerm Class
N-body interaction terms defined by an ordered list of operators and relative displacements on a hypercubic lattice.
- class edlgt.modeling.nbody_term.NBodyTerm(op_list, op_names_list, distances, **kwargs)[source]
Bases:
QMBTermOrdered N-body term generated from a site and fixed displacements.
Initialize an N-body lattice term.
- Parameters:
op_list (
list) – Operators participating in the N-body term.op_names_list (
list[str]) – Labels corresponding toop_list.distances (
list[tuple]) – Relative lattice displacements from the starting site to each additional operator. Its length must belen(op_list) - 1.**kwargs – Additional arguments forwarded to
QMBTerm.
- Raises:
ValueError – If
len(distances) != len(op_list) - 1.
- get_hamiltonian(strength, add_dagger=False, mask=None)[source]
Assemble the lattice-summed N-body Hamiltonian term.
- Parameters:
strength (
scalar) – Coupling constant multiplying the term.add_dagger (
bool, optional) – IfTrue, add the Hermitian conjugate of the assembled term.mask (
numpy.ndarray, optional) – Boolean mask selecting the starting sites where the term is applied.
- Returns:
Return type depends on the current workflow:
if
self.sector_configs is None: sparse matrix Hamiltonian term;otherwise:
(row_list, col_list, value_list)as three NumPy arrays in the symmetry-reduced basis.
- Return type:
- Raises:
TypeError – If
strengthis not scalar.NotImplementedError – If
add_dagger=Trueis requested in unsupported momentum-basis pair mode.
- get_Hamiltonian(strength, add_dagger=False, mask=None)
Assemble the lattice-summed N-body Hamiltonian term.
- Parameters:
strength (
scalar) – Coupling constant multiplying the term.add_dagger (
bool, optional) – IfTrue, add the Hermitian conjugate of the assembled term.mask (
numpy.ndarray, optional) – Boolean mask selecting the starting sites where the term is applied.
- Returns:
Return type depends on the current workflow:
if
self.sector_configs is None: sparse matrix Hamiltonian term;otherwise:
(row_list, col_list, value_list)as three NumPy arrays in the symmetry-reduced basis.
- Return type:
- Raises:
TypeError – If
strengthis not scalar.NotImplementedError – If
add_dagger=Trueis requested in unsupported momentum-basis pair mode.
- get_expval(psi, component='real', print_values=True)[source]
Compute site-resolved expectation values of the N-body term.
- Parameters:
psi (
edlgt.modeling.qmb_state.QMB_state) – Quantum state used to evaluate the term.component (
str, optional) – Output component selector:"real"or"imag".print_values (
bool, optional) – IfTrue, log the measured values site by site.
- Returns:
Results are stored in
self.obsas a 1D NumPy array.- Return type:
- Raises:
- get_nbody_neighbors(coords)[source]
Compute the ordered lattice sites touched by the N-body pattern.
- Parameters:
coords (
tuple) – Coordinates of the starting site.- Returns:
(neighbor_coords, neighbor_sites). If the pattern exits the lattice under open boundaries, returns(None, None).- Return type:
Notes
Distances are interpreted as displacements from the starting site
coords(not cumulative displacements between successive operators).