Transverse-Field Ising Chain
Construct dense qubit-space matrices with nearest-neighbor
ZZ coupling, transverse fields, longitudinal fields,
and next-nearest-neighbor Ising variants.
Exact diagonalization and quantum simulation testbeds
A lightweight, package-first Python library for constructing, analyzing, plotting, and exporting small lattice Hamiltonians used in physics workflows and quantum algorithm research prototypes.
Implemented models
The package keeps model construction, spectra, observables, plotting,
and export helpers in importable modules under
src/quantum_lattice_models/.
Construct dense qubit-space matrices with nearest-neighbor
ZZ coupling, transverse fields, longitudinal fields,
and next-nearest-neighbor Ising variants.
Build two-leg spin ladders with independent leg and rung couplings for compact quasi-one-dimensional benchmarks.
Use truncated Bose-Hubbard chains and spinful Fermi-Hubbard occupation-basis Hamiltonians for small interacting lattices.
Build XX, YY, and ZZ
coupled spin chains with optional longitudinal field terms.
Use compact spin-chain builders for anisotropic exchange, transverse fields, and XXZ Heisenberg specializations.
Add next-nearest-neighbor Heisenberg interactions for a small frustrated spin-chain benchmark.
Study SSH, Rice-Mele, and Kitaev-chain single-particle or BdG matrices for compact topological-chain examples.
Create one-dimensional single-particle hopping matrices with scalar or site-resolved onsite potentials.
Build Harper-Hofstadter square lattices, Haldane honeycomb models, triangular lattices, kagome lattices, and AAH chains.
Published package
Runtime dependencies are intentionally small: numpy,
scipy, and matplotlib. PennyLane export
is optional.
Use the published package for examples, notebooks, and scripts.
pip install quantum-lattice-models
PyPI
Use editable mode when developing the package or running tests.
python -m pip install -e ".[dev]"
Source
Convert dense Hamiltonians into PennyLane-compatible terms.
python -m pip install -e ".[pennylane]"
Quickstart
Quickstart
from quantum_lattice_models.models import transverse_field_ising
from quantum_lattice_models.spectra import ground_energy, spectral_gap
H = transverse_field_ising(n_sites=4, j=1.0, h=0.5, periodic=False)
print(H.shape)
print(ground_energy(H))
print(spectral_gap(H))
Generated examples
Each script under examples/ imports the package and saves
a PNG under images/, keeping notebooks and scripts as
thin clients of the public API.
Model reference
Each model family has a concise reference page covering its structure, Hamiltonian, basis, scaling, generated parameter table, Python and CLI use, validation status, and computational cautions. Shared foundations remain in the general theory guide.
Shared bases, Pauli normalization, hopping signs, boundaries, sparse matrices, and exact diagonalization.
THEORY.md
Theory
Spin, Hubbard, tight-binding, topological, and custom-lattice model references.
docs/models/
Browse models
Analytic limits, symmetry checks, dense/sparse comparisons, and associated tests.
VALIDATION.md
Validation
Executed notebooks
The notebooks are executed with saved outputs and exported to HTML
under docs/notebooks/. They include printed spectra,
parameter summaries, tables, and generated plots. The numeric
prefixes define the recommended learning order.
TFIM, longitudinal, and next-nearest-neighbor spectra.
notebooks/01_ising_spin_chains.ipynb
HTML
Magnetization, correlations, and finite-size gap sweeps.
notebooks/02_spin_observables_and_correlations.ipynb
HTML
XY, XXZ, and J1-J2 spectra and parameter sweeps.
notebooks/03_spin_chain_model_comparison.ipynb
HTML
Ladder spectrum, density of states, and rung-coupling gap.
notebooks/04_heisenberg_ladder_spectrum.ipynb
HTML
Bose/Fermi dense and sparse low-energy workflows.
notebooks/05_hubbard_exact_diagonalization.ipynb
HTML
Finite spectra and near-zero edge localization.
notebooks/06_ssh_rice_mele_comparison.ipynb
HTML
Open/periodic SSH states and TFIM size scaling.
notebooks/07_boundary_conditions_and_finite_size.ipynb
HTML
IPR crossover and representative localized states.
notebooks/08_aubry_andre_localization.ipynb
HTML
Particle-hole pairing and chemical-potential gap sweep.
notebooks/09_kitaev_bdg_symmetry.ipynb
HTML
Fixed-flux geometry and finite-lattice butterfly.
notebooks/10_hofstadter_flux_sweep.ipynb
HTML
Two-dimensional spectra and lattice connectivity.
notebooks/11_haldane_kagome_lattices.ipynb
HTML
Complex bonds, dense/sparse agreement, and registration.
notebooks/12_custom_lattice_workflow.ipynb
HTML
Magnitude patterns and complex hopping phases.
notebooks/13_hamiltonian_structure_gallery.ipynb
HTML
Matrix density, storage reduction, and solver agreement.
notebooks/14_sparse_dense_scaling.ipynb
HTML
Pauli-term conversion and matrix-level validation.
notebooks/15_pennylane_export.ipynb
HTML
Structured model discovery and registry metadata.
notebooks/16_model_registry_and_cli.ipynb
HTML
Command-line spectra and reproducible PNG output.
notebooks/17_cli_plot_walkthrough.ipynb
HTML
Documentation and source
The repository documents practical usage, model conventions, and the package's truth contract for small-system exact diagonalization. The notebook tree provides thin-client workflows for spin chains, SSH/Rice-Mele, Hofstadter sweeps, Hubbard models, and finite topological lattices.