HUB
Sign inSign up
quantumphasetransition-lab logo

credkellar/quantumphasetransition-lab

By credkellar

β€’Updated 17 days ago

QuantumPhaseTransition-Lab: TFIM phase transition lab - ED vs Jordan-Wigner, gap closed at g=1. Sim!

Image
Machine learning & AI
Developer tools
Data science
1

141

credkellar/quantumphasetransition-lab repository overview

⁠QuantumPhaseTransition-Lab πŸŒ‘οΈβš›οΈ

Transverse-Field Ising Quantum Phase Transition Lab β€” by Darion Kellar

Educational quantum phase transition lab in ONE pure-Python file: the 1D transverse-field Ising model H = -J Ξ£ ΟƒzΟƒz - h Ξ£ Οƒx on a ring, solved by two independent engines that cross-check each other β€” exact diagonalization of the full Hamiltonian (Kronecker products, from-scratch Jacobi eigensolver, N ≀ 7) and the Jordan-Wigner / Bogoliubov free-fermion solution (dispersion Ξ΅(k) = 2√(JΒ² + hΒ² βˆ’ 2Jh cos k), thermodynamic ground energy, quasiparticle gap 2|J βˆ’ h| closing exactly at g = h/J = 1). The finite-N Jordan-Wigner sum reproduces the ED ground energy to ~1e-8 at every N tested; the ordered-phase spectral gap collapses exponentially with N (tunnelling: 0.035490 β†’ 0.003146 for N = 4 β†’ 7 at g = 0.5), the critical gap closes like Ο€/(2N) (gap Γ— N: 1.5913 β†’ 1.5774 toward Ο€/2), the labelled Onsager-Yang magnetization (1 βˆ’ gΒ²)^(1/8) is printed next to the ED ⟨|Mz|⟩ that trends toward it, and a from-scratch kNN phase classifier labels the lab's own computed phase diagram.

Pure Python standard library. Zero dependencies. Zero network. Honest scope: the 1D TFIM is exactly solvable and the lab says so β€” the Jordan-Wigner formulas are labelled textbook results, nothing here solves an unsolved model, and no real material is predicted, fitted, or measured. Every materials / hardware / sensor / prediction use is a permanent HOLD gate (14 total).

⁠🐳 Quick start

docker pull credkellar/quantumphasetransition-lab:latest
docker run --rm credkellar/quantumphasetransition-lab:latest

The default command runs the full demo plus the built-in self-checks (CHECKS 49/49).

Run a specific command instead:

docker run --rm credkellar/quantumphasetransition-lab:latest python3 main.py checks   # CHECKS 49/49
docker run --rm credkellar/quantumphasetransition-lab:latest python3 main.py ed       # ED scan at N=6 vs JW (JSON)
docker run --rm credkellar/quantumphasetransition-lab:latest python3 main.py jw       # finite-size ED vs JW report (JSON)
docker run --rm credkellar/quantumphasetransition-lab:latest python3 main.py gap      # the two gap stories (JSON)
docker run --rm credkellar/quantumphasetransition-lab:latest python3 main.py phases   # order parameter + correlation length (JSON)
docker run --rm credkellar/quantumphasetransition-lab:latest python3 main.py classify # kNN phase classifier report
docker run --rm credkellar/quantumphasetransition-lab:latest python3 main.py holds    # 14 HOLD gates

β πŸ”¬ What's inside

  • Two engines, one answer β€” brute-force diagonalization of the full 2^N Γ— 2^N Hamiltonian and the Jordan-Wigner fermion sum agree on the ground energy per site to ~1e-8 at N = 4, 5, 6, 7 (g = 0.5 and g = 1.0); ED walks toward the thermodynamic JW value as N grows (3.33e-02 β†’ 1.07e-02 at criticality).
  • Quasiparticle gap closure β€” 2|J βˆ’ h| is 1.000 at g = 0.5, exactly 0 at g = 1, and 1.000 again at g = 1.5: the gap closes at the transition and reopens on the other side.
  • Tunnelling collapse β€” inside the ordered phase the finite ring's spectral gap is a tunnelling splitting between the two symmetry-broken sectors: 0.035490 β†’ 0.015402 β†’ 0.006892 β†’ 0.003146 (N = 4 β†’ 7), each step under 0.6Γ— the last.
  • Critical finite-size scaling β€” at g = 1 the ED gap Γ— N settles 1.5913 β†’ 1.5838 β†’ 1.5798 β†’ 1.5774 toward Ο€/2 = 1.5708, printed beside the distinct JW fermion gap 4 sin(Ο€/2N).
  • Onsager-Yang order parameter β€” M = (1 βˆ’ gΒ²)^(1/8): 1.0000 at g = 0, 0.9647 at g = 0.5, 0 for g β‰₯ 1; ED ⟨|Mz|⟩ at N = 7, g = 0.5 is 0.9636 and closing with N. Correlation-length proxy ΞΎ = 1/|1 βˆ’ g| diverges at g = 1.
  • Jacobi eigensolver, from scratch β€” cyclic rotations; reconstruction VΞ›Vα΅€ and orthonormality asserted < 1e-9 before any spectrum is trusted.
  • TinyML kNN classifier β€” ordered / critical-region / disordered from (g, Yang M, gap); labels generated by the lab's own JW phase policy (k = 3, with the reason documented in the code).
  • Advisory seats β€” Gemini Argon 4 DECIDER (names-only, tighten-only, sha256 trace), Muse advisor (can never override HOLD), Google Flow plan-only (rendered = False, live = 0).

β βœ… Verified

  • pytest: 36 passed
  • Built-in checks: CHECKS 49/49
  • Deterministic: double-run byte-identical
  • Base image: python:3.12-slim

⁠🏷️ Categories

Science Β· Developer tools Β· Machine learning & AI

  • License: MIT Β© 2026 Darion Kellar
  • Image: credkellar/quantumphasetransition-lab:latest
Tag summary
Recent tags
Content type
Image
Digest
sha256:813451beb…
Size
41.6 MB
Last updated
17 days ago
docker pull credkellar/quantumphasetransition-lab:latest