Quantum Many Body (QMB) Operations
Low-level helpers to assemble local, two-body, and plaquette-like operators in the full many-body Hilbert space, including optional basis projections.
Helpers to assemble lattice operators in the full many-body Hilbert space.
This module provides low-level functions used by term classes to construct local, two-body, and four-body sparse operators on a lattice, including support for site-dependent basis projections (e.g. gauge bases).
- edlgt.modeling.qmb_operations.qmb_operator(ops, op_names_list, add_dagger=False, get_real=False, get_imag=False)[source]
Build a many-body sparse operator from an ordered list of site operators.
- Parameters:
ops (
dict) – Dictionary mapping operator names to single-site sparse matrices.op_names_list (
list) – Ordered list of operator names to tensor together, one per lattice site, following the project site ordering convention.add_dagger (
bool, optional) – IfTrue, symmetrize by adding the Hermitian conjugate.get_real (
bool, optional) – IfTrue, return only the Hermitian (real) part.get_imag (
bool, optional) – IfTrue, return only the anti-Hermitian-derived imaginary part.
- Returns:
Sparse many-body operator in the full Hilbert space.
- Return type:
- edlgt.modeling.qmb_operations.local_op(operator, op_site, lvals, has_obc, staggered_basis=False, gauge_basis=None, loc_dims=None)[source]
Construct a single-site operator embedded in the full lattice Hilbert space.
- Parameters:
operator (
scipy.sparse.spmatrix) – Single-site operator.op_site (
int) – Site index where the operator acts.lvals (
list[int]) – Lattice sizes along each axis.has_obc (
list[bool]) – Boundary-condition flags for each axis (Truefor OBC).staggered_basis (
bool, optional) – Whether a staggered basis is used.gauge_basis (
dict, optional) – Site-label-dependent basis projectors.loc_dims (
numpy.ndarray, optional) – Per-site local dimensions used when operators are already projected and provided as 3D site-resolved arrays.
- Returns:
Embedded local operator.
- Return type:
- edlgt.modeling.qmb_operations.two_body_op(op_list, op_sites_list, lvals, has_obc, staggered_basis=False, gauge_basis=None, loc_dims=None)[source]
Construct a two-site operator embedded in the full lattice Hilbert space.
- Parameters:
op_list (
list) – Two single-site operators.op_sites_list (
list[int]) – Two site indices where the operators act.lvals (
list[int]) – Lattice sizes along each axis.has_obc (
list[bool]) – Boundary-condition flags for each axis.staggered_basis (
bool, optional) – Whether a staggered basis is used.gauge_basis (
dict, optional) – Site-label-dependent basis projectors.loc_dims (
numpy.ndarray, optional) – Per-site local dimensions used when operators are already projected and provided as 3D site-resolved arrays.
- Returns:
Embedded two-body operator.
- Return type:
- edlgt.modeling.qmb_operations.four_body_op(op_list, op_sites_list, lvals, has_obc, staggered_basis=False, gauge_basis=None, loc_dims=None, get_real=False)[source]
Construct a four-site (plaquette-like) operator in the full Hilbert space.
- Parameters:
op_list (
list) – Four single-site operators.op_sites_list (
list[int]) – Four site indices where the operators act.lvals (
list[int]) – Lattice sizes along each axis.has_obc (
list[bool]) – Boundary-condition flags for each axis.staggered_basis (
bool, optional) – Whether a staggered basis is used.gauge_basis (
dict, optional) – Site-label-dependent basis projectors.loc_dims (
numpy.ndarray, optional) – Per-site local dimensions used when operators are already projected and provided as 3D site-resolved arrays.get_real (
bool, optional) – IfTrue, return only the Hermitian (real) part.
- Returns:
Embedded four-body operator.
- Return type:
- edlgt.modeling.qmb_operations.construct_operator_list(op_list, op_sites_list, lvals, has_obc, staggered_basis, gauge_basis, loc_dims=None)[source]
Create per-site operator labels/matrices for a lattice operator product.
- Parameters:
op_list (
list) – Operators to place on the lattice.op_sites_list (
list[int]) – Lattice sites where the operators inop_listact.lvals (
list[int]) – Lattice sizes along each axis.has_obc (
list[bool]) – Boundary-condition flags for each axis.staggered_basis (
bool) – Whether a staggered basis is used.gauge_basis (
dictorNone) – Site-label-dependent basis projectors, orNonefor a uniform basis.loc_dims (
numpy.ndarray, optional) – Per-site local dimensions. Required whenop_listcontains projected site-resolved operators with shape(n_sites, max_loc_dim, max_loc_dim).
- Returns:
(ops_dict, op_names_list)whereops_dictis a dictionary of projected operators andop_names_listis the ordered list of names passed toqmb_operator().- Return type:
- edlgt.modeling.qmb_operations.apply_basis_projection(op, op_name, basis_label, gauge_basis)[source]
Project a single-site operator into a site-dependent basis if needed.
- Parameters:
op (
scipy.sparse.spmatrix) – Operator to project.op_name (
str) – Base operator name.basis_label (
str) – Site label used to select the projector.gauge_basis (
dictorNone) – Dictionary of projectors keyed bybasis_label.
- Returns:
Projected operator and its (possibly updated) name.
- Return type: