This repository contains a minimal, reproducible example for running METTS (Minimally Entangled Typical Thermal States) with ITensors on the 2D Fermi–Hubbard model wrapped as a cylinder. The example computes finite‑temperature observables and writes results to HDF5.
examples/hubbard_cylinder_metts.jl <-- runnable example script
src/ <-- package code
outfiles.metts/ <-- created at runtime; outputs written here
- Julia 1.11 or newer
- Packages installed into this project:
ITensors,ITensorMPS,HDF5
Note: Do not add
METTSfrom the registry when working inside this repo. Activating this project makesusing METTSwork.
# 1) Enter the project
cd /path/to/METTS.jl
# 2) Instantiate and add required packages *into this project*
julia --project -e 'using Pkg; Pkg.instantiate(); Pkg.add(["ITensors","ITensorMPS","HDF5"])'
# 3) Run an example (L W U filling t T tau maxD seed nmetts Nwarm)
julia --project examples/hubbard_cylinder_metts.jl 24 4 10.0 0.9375 1.0 0.10 0.3 2000 1 100 5
# 4) Find produced HDF5 outputs
find outfiles.metts -maxdepth 8 -name outfile.h5| Argument | Meaning |
|---|---|
L |
Lattice length (total sites = L × W) |
W |
Lattice width (cylinder) |
U |
On‑site interaction |
filling |
Electrons per site (e.g. 0.9375) |
t |
Nearest‑neighbor hopping (usually 1.0) |
T |
Temperature (β = 1/T) |
tau |
TDVP step for imaginary‑time evolution |
maxD |
Maximum MPS bond dimension |
seed |
RNG seed |
nmetts |
Total METTS iterations |
Nwarm |
Warm‑up iterations (not stored) |
Notes
- Measurements are written only after warm‑up.
- Ensure
nmetts > Nwarm.
Default output root: ./outfiles.metts (or the directory set by METTS_OUTDIR).
Each run is saved under:
outfiles.metts/L.<L>.W.<W>/U.<U>/filling.<f>/T.<T>/D.<maxD>/tau.<tau>.seed.<seed>/
Within a run directory you will find:
outfile.h5— parameters undermeta/; groupsstep_xxxxx/for each measured step
(datasets include:energy,Ntotal,DO,SZSZ,SPSM,SMSP,NtotNtot,SS).samples.txt— product‑basis states per measured step. Codes1..4map toEmp,Up,Dn,UpDn.
Resuming a run is automatic if samples.txt already exists.
Sanity check:
julia --project examples/hubbard_cylinder_metts.jl 4 4 10.0 0.9375 1.0 0.10 0.3 100 1 10 5Paper‑grade template:
julia --project examples/hubbard_cylinder_metts.jl 32 4 10.0 0.9375 1.0 0.10 0.2 2000 1 2000 100-
ERROR: Package ITensors not found
Use the project environment: run withjulia --project(orPkg.activate(".")). -
No measured data appears
Setnmetts > Nwarmso that measurements are taken after warm‑up. -
Slow / memory‑heavy
DecreasemaxDor increasetauslightly.
- A short DMRG warm‑up avoids long initial transients.
- Choose
tauandmaxDcarefully; typicaltau = 0.1–0.3.