Python native API
The objects below are thin, typed request builders. Numerical work begins only
when an operation such as eigsh enters the shared Rust library.
qmbed
Native Python request types for the shared QMBED Rust core.
The classes exported here are immutable descriptions of bases, local operator products, couplings, and eigensolver options. Numerical work is executed by the same Rust implementation used by native QMBED applications.
QmbedError
LocalOperator
Bases: str, Enum
Built-in local actions understood by the universal Rust assembler.
Members describe one-site identity, number, Cartesian spin, and
raising/lowering actions. A string may be used in :class:OpProduct for a
custom action supported by a callback-defined basis.
Source code in bindings/python/src/qmbed/model.py
OpProduct
dataclass
Ordered product of local actions.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
local
|
tuple[LocalOperator | str, ...]
|
Local actions in the same order as the coupling's site tuple. |
required |
split
|
int | None
|
Boundary between the up and down species of a two-species product. |
None
|
splits
|
tuple[int, ...]
|
Boundaries for products with more than two species. |
()
|
split and splits are mutually exclusive. Site indices themselves
live in :class:Coupling so one product can be reused over many bonds.
Source code in bindings/python/src/qmbed/model.py
spinful
classmethod
Construct a two-species product from up- and down-sector actions.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
up
|
Iterable[LocalOperator | str]
|
Ordered local actions for the up species. |
required |
down
|
Iterable[LocalOperator | str]
|
Ordered local actions for the down species. |
required |
Returns:
| Type | Description |
|---|---|
'OpProduct'
|
A product whose species boundary is placed after |
Source code in bindings/python/src/qmbed/model.py
request
Serialize the product into the language-neutral C-ABI schema.
Source code in bindings/python/src/qmbed/model.py
Coupling
dataclass
One complex coefficient and the zero-based sites on which it acts.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
coefficient
|
complex
|
Scalar multiplying the local operator product. |
required |
sites
|
tuple[int, ...]
|
Site indices in the same order as the product's local actions. |
required |
Source code in bindings/python/src/qmbed/model.py
request
Serialize the coupling into the language-neutral C-ABI schema.
OperatorSpec
dataclass
A reusable local product together with all of its couplings.
The Rust core validates the product arity against every coupling and assembles the resulting term in the requested storage format.
Source code in bindings/python/src/qmbed/model.py
request
Serialize this term into the language-neutral C-ABI schema.
BasisSpec
Abstract base for immutable basis requests.
Source code in bindings/python/src/qmbed/model.py
SpinBasis
dataclass
Bases: BasisSpec
One-dimensional spin basis with optional conserved and symmetry sectors.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sites
|
int
|
Number of lattice sites. |
required |
spin_twice
|
int
|
Twice the on-site spin quantum number; |
1
|
up
|
int | None
|
Fixed total raising-quantum count, or |
None
|
momentum
|
int | None
|
Translation momentum sector, or |
None
|
parity
|
int | None
|
Reflection eigenvalue, normally |
None
|
pauli
|
bool
|
Use Pauli rather than angular-momentum normalization. |
False
|
Source code in bindings/python/src/qmbed/model.py
request
Serialize this spin basis request.
Source code in bindings/python/src/qmbed/model.py
BosonBasis
dataclass
Bases: BasisSpec
Bosonic lattice basis with a finite local cutoff.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sites
|
int
|
Number of lattice sites. |
required |
states_per_site
|
int
|
Allowed local occupations |
required |
particles
|
int | None
|
Fixed total boson number, or |
None
|
Source code in bindings/python/src/qmbed/model.py
request
Serialize this boson basis request.
SpinlessFermionBasis
dataclass
Bases: BasisSpec
Spinless-fermion Fock basis.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sites
|
int
|
Number of fermionic orbitals. |
required |
particles
|
int | None
|
Fixed particle number, or |
None
|
momentum
|
int | None
|
Translation momentum sector, or |
None
|
Source code in bindings/python/src/qmbed/model.py
request
Serialize this spinless-fermion basis request.
SpinfulFermionBasis
dataclass
Bases: BasisSpec
Two-species fermion basis with independent number sectors.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sites
|
int
|
Number of spatial sites for each species. |
required |
particles_up
|
int | None
|
Fixed up-species particle number, or |
None
|
particles_down
|
int | None
|
Fixed down-species particle number, or |
None
|
Source code in bindings/python/src/qmbed/model.py
request
Serialize this spinful-fermion basis request.
EigshOptions
dataclass
Controls a selected Hermitian eigensolve.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
eigenpairs
|
int
|
Number of requested eigenpairs. |
required |
target
|
str
|
Spectral target such as |
'smallest_algebraic'
|
shift
|
float | None
|
Interior target used when |
None
|
krylov_dimension
|
int | None
|
Maximum search-space dimension. |
None
|
tolerance
|
float
|
Residual convergence tolerance. |
1e-10
|
max_iterations
|
int
|
Maximum restart or iteration budget. |
1000
|
seed
|
int
|
Deterministic initial-vector seed. |
0
|
eigenvectors
|
bool
|
Return eigenvectors in addition to values and residuals. |
False
|
Source code in bindings/python/src/qmbed/model.py
request
Serialize and normalize the eigensolver options.
Source code in bindings/python/src/qmbed/model.py
Eigensystem
dataclass
Result of a QMBED Hermitian eigensolve.
Attributes:
| Name | Type | Description |
|---|---|---|
dimension |
int
|
Hilbert-space dimension. |
eigenvalues |
tuple[float, ...]
|
Ordered real Ritz or exact eigenvalues. |
residuals |
tuple[float, ...]
|
Norm of |
iterations |
int
|
Solver iteration count. |
converged |
bool
|
Whether every requested residual met the tolerance. |
eigenvectors |
tuple[tuple[complex, ...], ...] | None
|
Eigenvectors when requested, otherwise |
Source code in bindings/python/src/qmbed/model.py
eigsh
Solve selected eigenpairs of a Hamiltonian assembled from local terms.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
basis
|
BasisSpec
|
Typed Hilbert-space request. |
required |
terms
|
Sequence[OperatorSpec]
|
Local operator specifications to sum into the Hamiltonian. |
required |
options
|
EigshOptions
|
Spectral target and convergence controls. |
required |
format
|
str
|
Materialization format, normally |
'csc'
|
Returns:
| Type | Description |
|---|---|
Eigensystem
|
Eigenvalues, residuals, convergence evidence, and optional |
Eigensystem
|
eigenvectors from the Rust solver. |
Raises:
| Type | Description |
|---|---|
QmbedError
|
If the basis, terms, storage route, or solver options are invalid, or if the native operation fails. |