TwoBodyTerm Class
- class ed_lgt.modeling.twobody_term.TwoBodyTerm(axis, op_list, op_names_list, **kwargs)[source]
Bases:
QMBTermThis function provides methods for computing twobody Hamiltonian terms in a d-dimensional lattice model along a certain axis.
- Parameters:
axis (str) – axis along which the 2Body Term is performed
op_list (list of 2 scipy.sparse.matrices) – list of the two operators involved in the 2Body Term
op_name_list (list of 2 str) – list of the names of the two operators
- get_Hamiltonian(strength, add_dagger=False, mask=None)[source]
The function calculates the TwoBody Hamiltonian by summing up 2body 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. Eventually, it is possible to sum also the dagger part of the Hamiltonian.
- Parameters:
strength (scalar) – Coupling of the Hamiltonian term.
add_dagger (bool, optional) – If true, it add the hermitian conjugate of the resulting Hamiltonian. Defaults to False.
mask (np.ndarray, optional) – 2D array with bool variables specifying (if True) where to apply the local term. Defaults to None.
- Returns:
- TwoBody Hamiltonian term ready to be used for exact diagonalization/
expectation values.
- Return type:
scipy.sparse
- get_expval(psi)[source]
The function calculates the expectation value (and it variance) of the TwoBody Hamiltonian and its average over all the lattice sites.
- Parameters:
psi (numpy.ndarray) – QMB state where the expectation value has to be computed
- print_nearest_neighbors()[source]
See also