Exact diagonalization and quantum simulation testbeds

Quantum Lattice Models

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

Small systems with explicit Hamiltonians

The package keeps model construction, spectra, observables, plotting, and export helpers in importable modules under src/quantum_lattice_models/.

Transverse-Field Ising Chain

Construct dense qubit-space matrices with nearest-neighbor ZZ coupling, transverse fields, longitudinal fields, and next-nearest-neighbor Ising variants.

Spin Chain Exact Diagonalization VQE Testbed

Heisenberg Ladder

Build two-leg spin ladders with independent leg and rung couplings for compact quasi-one-dimensional benchmarks.

Spin Ladder Rung Coupling Dense ED

Hubbard Chains

Use truncated Bose-Hubbard chains and spinful Fermi-Hubbard occupation-basis Hamiltonians for small interacting lattices.

Bose-Hubbard Fermi-Hubbard Occupation Basis

Anisotropic Heisenberg Chain

Build XX, YY, and ZZ coupled spin chains with optional longitudinal field terms.

Heisenberg Spin Physics Observables

XY and XXZ Chains

Use compact spin-chain builders for anisotropic exchange, transverse fields, and XXZ Heisenberg specializations.

XY XXZ Spin Gaps

J1-J2 Heisenberg Chain

Add next-nearest-neighbor Heisenberg interactions for a small frustrated spin-chain benchmark.

Frustration NNN Coupling Dense Pauli Terms

SSH Model

Study SSH, Rice-Mele, and Kitaev-chain single-particle or BdG matrices for compact topological-chain examples.

Topology Edge Modes BdG

Generic Tight-Binding Chain

Create one-dimensional single-particle hopping matrices with scalar or site-resolved onsite potentials.

Single Particle Spectra Quantum Walks

Topological and Frustrated Lattices

Build Harper-Hofstadter square lattices, Haldane honeycomb models, triangular lattices, kagome lattices, and AAH chains.

Hofstadter Haldane Kagome Quasiperiodic

Published package

Installable Python tooling

Runtime dependencies are intentionally small: numpy, scipy, and matplotlib. PennyLane export is optional.

Install from PyPI

Use the published package for examples, notebooks, and scripts.

pip install quantum-lattice-models PyPI

Install from source

Use editable mode when developing the package or running tests.

python -m pip install -e ".[dev]" Source

Optional PennyLane export

Convert dense Hamiltonians into PennyLane-compatible terms.

python -m pip install -e ".[pennylane]" Quickstart

Quickstart

Import the package API

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

Reference plots from command-line 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.

Transverse-field Ising spectrum plot
TFIM spectrum: n=5, J=1.0, h=0.7
Heisenberg chain density plot
Heisenberg density: n=5, J=1.0, field=0.2
SSH edge-state localization plot
SSH edge state: 12 cells, t₁=0.4, t₂=1.0
Tight-binding spectrum plot
Open chain: 16 sites, hopping=1.0
Rice-Mele finite-chain spectrum plot
Rice-Mele: 12 cells, δ=0.35, Δ=0.4
Harper-Hofstadter flux spectrum plot
Finite Hofstadter spectrum: 8×8, 121 flux values
Truncated Bose-Hubbard spectrum plot
Bose-Hubbard: 3 sites, U=1.5, t=0.6
Finite Haldane honeycomb spectrum plot
Haldane: 3×3 cells, t₂=0.18, φ=π/2
Kagome lattice graph connectivity plot
Kagome: 2×3 cells with sublattice colors
Haldane Hamiltonian magnitude and phase matrices
Haldane matrix magnitude and hopping phase

Model reference

Equations, conventions, variables, and package use

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.

General theory and conventions

Shared bases, Pauli normalization, hopping signs, boundaries, sparse matrices, and exact diagonalization.

THEORY.md Theory

Complete model index

Spin, Hubbard, tight-binding, topological, and custom-lattice model references.

docs/models/ Browse models

Scientific validation matrix

Analytic limits, symmetry checks, dense/sparse comparisons, and associated tests.

VALIDATION.md Validation

Executed notebooks

Rendered notebook workflows

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.

01. Ising spin chains

TFIM, longitudinal, and next-nearest-neighbor spectra.

notebooks/01_ising_spin_chains.ipynb HTML

02. Spin observables

Magnetization, correlations, and finite-size gap sweeps.

notebooks/02_spin_observables_and_correlations.ipynb HTML

03. Spin-model comparison

XY, XXZ, and J1-J2 spectra and parameter sweeps.

notebooks/03_spin_chain_model_comparison.ipynb HTML

04. Heisenberg ladder

Ladder spectrum, density of states, and rung-coupling gap.

notebooks/04_heisenberg_ladder_spectrum.ipynb HTML

05. Hubbard exact diagonalization

Bose/Fermi dense and sparse low-energy workflows.

notebooks/05_hubbard_exact_diagonalization.ipynb HTML

06. SSH and Rice-Mele

Finite spectra and near-zero edge localization.

notebooks/06_ssh_rice_mele_comparison.ipynb HTML

07. Boundaries and finite size

Open/periodic SSH states and TFIM size scaling.

notebooks/07_boundary_conditions_and_finite_size.ipynb HTML

08. Aubry-André localization

IPR crossover and representative localized states.

notebooks/08_aubry_andre_localization.ipynb HTML

09. Kitaev BdG symmetry

Particle-hole pairing and chemical-potential gap sweep.

notebooks/09_kitaev_bdg_symmetry.ipynb HTML

10. Hofstadter flux sweep

Fixed-flux geometry and finite-lattice butterfly.

notebooks/10_hofstadter_flux_sweep.ipynb HTML

11. Haldane, triangular, and kagome

Two-dimensional spectra and lattice connectivity.

notebooks/11_haldane_kagome_lattices.ipynb HTML

12. Custom lattice workflow

Complex bonds, dense/sparse agreement, and registration.

notebooks/12_custom_lattice_workflow.ipynb HTML

13. Hamiltonian structure gallery

Magnitude patterns and complex hopping phases.

notebooks/13_hamiltonian_structure_gallery.ipynb HTML

14. Sparse and dense scaling

Matrix density, storage reduction, and solver agreement.

notebooks/14_sparse_dense_scaling.ipynb HTML

15. PennyLane export

Pauli-term conversion and matrix-level validation.

notebooks/15_pennylane_export.ipynb HTML

16. Model registry and CLI

Structured model discovery and registry metadata.

notebooks/16_model_registry_and_cli.ipynb HTML

17. CLI plot walkthrough

Command-line spectra and reproducible PNG output.

notebooks/17_cli_plot_walkthrough.ipynb HTML
Notebook-generated Ising spectra
Ising notebook spectra
Notebook-generated spin observable sweep
Spin observables and correlations
Notebook-generated Aubry-Andre localization sweep
Aubry-André localization
Notebook-generated Hamiltonian structure gallery
Hamiltonian structure gallery

Documentation and source

Read the project materials

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.