一键导入
using-itensors
Use when choosing or running ITensors.jl or ITensorMPS.jl for DMRG, TEBD, MPS calculations, tensor-network checks, or ITensors setup failures.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Use when choosing or running ITensors.jl or ITensorMPS.jl for DMRG, TEBD, MPS calculations, tensor-network checks, or ITensors setup failures.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Use when the user wants a numerical result (ED / DMRG / QMC / VMC / any method) checked against an exact solution, or names a model from the solvable-models catalog in a verification context. Trigger phrases: "verify against the exact solution", "check my DMRG/ED/QMC result", "benchmark <method> on <model>", "is this energy right", "does this match the exact answer", "sanity-check this against Bethe ansatz / Onsager / free-fermion solution". Also fires when the user names any of the 63 catalog models below in a verification context — not only when they use the word "verify": - T1 quadratic/free-particle: tfim-chain (TFIM), xy-chain, kitaev-chain, ssh-chain, kitaev-honeycomb, hofstadter-harper, haldane-chern, anderson-1d, harmonic-chain - T2 2D classical/transfer matrix: ising-2d-onsager (Onsager / 2D Ising), ising-triangular, dimer-kasteleyn, six-vertex, eight-vertex, hard-hexagons - T3 Bethe ansatz/Yang–Baxter: xxz-chain, heisenberg-xxx, hubbard-1d-lieb-wu (Lieb–Wu / 1D Hubbard), lieb-liniger, yang
Use when an exact diagonalization track, ED reproduction, full spectrum, symmetry sector, scar, ETH, level statistics, quench dynamics, finite-temperature ED (FTLM/TPQ), spectral function, interior-spectrum / MBL eigenstates, or finite-cluster oracle needs method-level route and tool selection.
Use when the user names or describes a harness-tracked quantum lattice model. Match user prose to one of: - transverse-field-ising (TFIM): quantum-critical Ising chain / 2D Wilson-Fisher - heisenberg: SU(2) magnet, AFM or FM by sign of J - xxz-chain: spin-1/2 XXZ, Bethe-ansatz integrable, Δ tunes FM / Luttinger / Néel - j1-j2: frustrated Heisenberg, J2/J1≈0.5 spin-liquid candidate - shastry-sutherland: orthogonal-dimer AFM, exact dimer phase, magnetization plateaus - spin-1-xxz: Haldane phase, single-ion anisotropy - aklt: spin-1 bilinear-biquadratic, exact VBS ground state - kitaev-honeycomb: bond-dependent exchange, exactly solvable Z2 spin liquid, anyons - spin-ice-pyrochlore: 2-in-2-out ice rule, Coulomb phase, magnetic monopoles - mbl-disordered-heisenberg: random-field XXZ chain, ETH-to-MBL transition - rydberg-pxp: blockaded Rydberg chain, quantum many-body scars, |Z2⟩ revivals - dissipative-spin-lindblad: open spin lattice, Liouvillian spectrum, steady states - potts-clock: q-state, first-order / cont
Use when the user wants to reproduce a paper's figure or main result. Triggers include "reproduce paper X", "redo the figures of Y", "reproduce arXiv <id>", "put this paper through the harness as a calibration target", "walk me through reproducing this paper", "beginner reproduction", "I don't know what size to choose", "explain while reproducing", or right after `/download-ref` lands a new paper.
Use when choosing or running QuSpin as the Python fallback for exact diagonalization, constrained-basis ED, spin-chain ED examples, or QuSpin setup failures.
Use when choosing or running XDiag.jl for exact diagonalization, symmetry-resolved sectors, Lanczos/Krylov calculations, or XDiag setup failures.
| name | using-itensors |
| description | Use when choosing or running ITensors.jl or ITensorMPS.jl for DMRG, TEBD, MPS calculations, tensor-network checks, or ITensors setup failures. |
Software-stack skill for ITensors.jl / ITensorMPS.jl — the harness's canonical 1D and quasi-1D tensor-network workflows. It owns the software layer: run mechanics, software parameters (step 3), and the time estimate (feeds step 4). It is the step-2 handoff target from /method-mps (DMRG/TEBD) and /method-ltrg.
It does not own method selection or the method algorithm / "why" — the DMRG, TEBD, and LTRG algorithms and their convergence criteria live in /method-mps and /method-ltrg (## Details); model choice → .knowledge/models/; paper figure facts → /reproduce-paper. This card carries the ITensors API surface and parameter values to express those methods, not the methods themselves.
skills/using-itensors/stack.tomlskills/method-mps/SKILL.md, skills/method-ltrg/SKILL.mdmake install itensorsjulia --project=julia-env -e 'using ITensors, ITensorMPS, KrylovKit, MPSKit'https://docs.itensor.org/ITensors/dev/, ITensorMPS.jl https://github.com/ITensor/ITensorMPS.jlreferences/itensors-api.mdWhat /method-mps and /method-ltrg route here for, and what to confirm before running.
conserve_qns is on; first-run Julia precompilation is setup time, not physics time.S=1/2, Electron, …), quantum-number conservation, OpSum → MPO Hamiltonian build, dmrg / apply, and svd with maxdim / cutoff. Confirm the current spelling against the official docs in Sources — the ITensors / ITensorMPS split moved several names.stack.toml before setup and run /setup-julia first when Julia is not usable./using-slurm) when bond dimension, cylinder width, or scans exceed the local threshold.using ITensors, ITensorMPS
sites = siteinds("S=1/2", N; conserve_qns=true) # conserve_qns pins the S^z sector
ampo = OpSum() # Hamiltonian as an MPO
for j in 1:N-1
ampo += "Sz", j, "Sz", j+1
ampo += 0.5, "S+", j, "S-", j+1
ampo += 0.5, "S-", j, "S+", j+1
end
H = MPO(ampo, sites)
psi0 = MPS(sites, n -> isodd(n) ? "Up" : "Dn") # initial state in the target sector
nsweeps = 20
maxdim = [10, 20, 50, 100, 200, 200] # grow the bond dimension per sweep
cutoff = [1e-10]
energy, psi = dmrg(H, psi0; nsweeps, maxdim, cutoff, outputlevel=1)
sz = expect(psi, "Sz")
SiSj = correlation_matrix(psi, "Sz", "Sz")
For Hubbard / fermion problems use siteinds("Electron", N; conserve_qns=true) and operators "Cdagup", "Cup", "Cdagdn", "Cdn", "Nup", "Ndn".
using ITensors, ITensorMPS
sites = siteinds("S=1/2", N; conserve_qns=true)
function trotter_gates(sites, J, τ) # 2nd-order Trotter: half-step forward + reverse
gates = ITensor[]
for j in 1:N-1
s1, s2 = sites[j], sites[j+1]
hj = J * (op("Sz", s1) * op("Sz", s2)
+ 0.5 * op("S+", s1) * op("S-", s2)
+ 0.5 * op("S-", s1) * op("S+", s2))
push!(gates, exp(-τ/2 * hj))
end
append!(gates, reverse(gates))
return gates
end
psi = MPS(sites, n -> isodd(n) ? "Up" : "Dn")
gates = trotter_gates(sites, J, τ)
for step in 1:round(Int, T_total / τ)
psi = apply(gates, psi; cutoff=1e-10, maxdim=200)
normalize!(psi)
end
energy = inner(psi', H, psi)
The LTRG algorithm — build local transfer tensors, then repeatedly absorb a layer into the boundary, SVD-truncate to Dc, normalize, and accumulate log scale factors — is owned by /method-ltrg (## Details). ITensors supplies the primitives to express it; keep index tags explicit, write convergence data incrementally, and record the normalization convention with the output.
using ITensors
s1, s2 = Index(q, "site1"), Index(q, "site2") # typed local-basis indices, primed for adjacent layers
gate = exp(-tau * h) # imaginary-time gate from local h(s1,s2,s1',s2')
U, S, V = svd(T, (s1, s2); maxdim = Dc, cutoff = 1e-12) # truncate the boundary to Dc
The source for ITensors / MPS-specific reproduction knobs unless the paper or official code fixes a value. Starting points are software practice, not paper-anchored: begin from each, then converge it — the convergence check (maxdim/bond dimension, cutoff, sweep count), not the starting number, is what makes the result trustworthy.
What to pin:
maxdim schedule, sweep count, cutoff, noise schedule if needed, TEBD time step and total time, Krylov/Trotter settings.chi, variance / residual proxy, discarded weight, tau extrapolation for TEBD. The criteria for "converged" are the method card's.Concrete starting points (DMRG and TEBD share the bond-dimension / cutoff controls):
| Knob | Effect | Starting point |
|---|---|---|
maxdim schedule | Maximum bond dimension per sweep. Drives accuracy and cost. | Grow gently from ~10. Targets: 50–200 (1D chains), 200–1000 (cylinders), 1000+ (frustrated 2D). |
cutoff | SVD truncation threshold. | 1e-10 for entry/medium accuracy; tighten for critical points or if variance is non-zero at convergence. |
nsweeps | Number of sweeps. | 10–30; stop when the energy stops changing within the accuracy goal. |
| Initial state | Random MPS or a product state in the target sector. | Product state for sectors (e.g. Néel for S^z = 0); random when there is no clear product-state representative. |
noise | Adds noise to break stuck states (older API). | Use only if convergence stalls. |
| Knob | Effect | Starting point |
|---|---|---|
τ (Trotter step) | Trotter error scales as τ^2 (2nd order). Smaller is more accurate but slower. | 0.05–0.1 for entry; reduce if energy not converged. |
T_total | Imaginary-time evolution length. Need T_total ≫ 1/Δ. | Start at 10–20 (units where the largest coupling = 1); extend until energy stops dropping. |
maxdim | MPS bond dimension cap. | 50–200 for 1D entry-level. |
cutoff | SVD truncation per gate application. | 1e-10. |
The scientific values — model, lattice, sectors, observable, bond-dimension target, convergence criteria, validation target — are caller-supplied; resolve open ones via the step-4 brainstorm, deferring the method algorithm / "why" and the convergence criteria to /method-mps or /method-ltrg and model physics to the model card. This skill turns agreed values into a runnable ITensors script; it does not originate them.
Estimate from length L, local dimension d, bond dimension chi, sweeps / time steps, and whether symmetries are used; the result feeds /reproduce-paper's step-4 resource confirmation.
sweeps · L · chi^3 times the local MPO/site factor; memory roughly L · chi^2 tensors, with a dtype and conserved-sector factor.time_steps · gates · chi^3; memory follows the same L · chi^2 pattern.chi sweeps or TEBD steps, then extrapolate to the paper chi and the largest local-PC-in-15-min setting.