一键导入
using-xdiag
Use when choosing or running XDiag.jl for exact diagonalization, symmetry-resolved sectors, Lanczos/Krylov calculations, or XDiag setup failures.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Use when choosing or running XDiag.jl for exact diagonalization, symmetry-resolved sectors, Lanczos/Krylov calculations, or XDiag 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.
Generate a challenge completion report from a finished run in tracks/. Checks submission cleanliness first, then walks through each block interactively.
| name | using-xdiag |
| description | Use when choosing or running XDiag.jl for exact diagonalization, symmetry-resolved sectors, Lanczos/Krylov calculations, or XDiag setup failures. |
Use XDiag as the harness's canonical exact-diagonalization stack when the target can be expressed through its Hilbert-space blocks and operators. Method judgment — which route (dense / Lanczos / dynamics / finite-T), which sectors, and the work counts — is owned by /method-ed; this skill owns expressing those decisions in XDiag and the package-level values.
skills/using-xdiag/stack.tomlskills/method-ed/SKILL.mdmake install xdiagjulia --project=julia-env -e 'using XDiag'references/xdiag-api.md/method-ed: model, basis, boundary, the full sector list, and the solver route. If any is still open, return to the method card — don't decide it here.OpSum, run the pre-diagonalization diagnostics (below), then the chosen solver.How to express each method decision in XDiag, and what only XDiag can answer.
Spinhalf / tJ / Electron; conserved charges as nup (and ndn — required for tJ); a spatial sector as a Representation (a PermutationGroup + one character per element). Only 1D irreps are supported. dim(block) is the D that all estimates use.PermutationGroup explicitly (group axioms are validated); characters must satisfy the homomorphism rule. Julia sites count from 1 (C++/TOML from 0). A nonzero-momentum irrep forces complex states. Measuring a non-invariant operator (single bond) on a symmetric state requires symmetrize(op, group) first.Spinhalf(N) space with projector-dressed operators (Op("Matrix", …) built via kron) — dimension consequence per the method card; if that overturns the tool choice, go back to step 2 there.eigval0 / eig0 for the ground state; eigs_lanczos(ops, block; neigvals, precision, max_iterations, deflation_tol) for low-lying towers (returns Ritz values, eigenvectors, criterion); dense matrix(ops, block) + LinearAlgebra.eigen for full spectra of small blocks; csr_matrix only when memory is ample and the matrix is reused many times.time_evolve (real) / imaginary_time_evolve (set shift = e0 for stability); algorithm = "lanczos" (memory-lean, runs twice) vs "expokit" (faster, more memory).dim(block), the sector labels, the OpSum term count, and isreal(ops); set_verbosity(1–2) for Lanczos progress on long runs. Stop on dimension mismatch or memory far above the 8·D²/8·D estimate.Package-level values only; what each route needs is the method card's call.
| Knob | Effect | Starting point |
|---|---|---|
precision | Lanczos convergence target (residual scale) | 1e-12 default; loosen only if the observable tolerance allows |
max_iterations | Lanczos iteration cap | 1000 default; raising it past ~200 without convergence usually signals a problem, not patience |
neigvals | how many low-lying eigenpairs eigs_lanczos returns | the states the figure needs; more states → more iterations and stricter deflation |
deflation_tol | ghost/duplicate suppression in eigs_lanczos | 1e-7 default; tighten when repeated eigenvalues look spurious |
random_seed | Lanczos start vector | fix it in the run plan for reproducibility |
backend | basis encoding: "auto", "32bit", "64bit", "2sublattice"…"5sublattice" | "auto"; sublattice coders are what make N ≳ 40 spin-½ feasible |
| Threads | OpenMP shared-memory matvec | record JULIA_NUM_THREADS / OpenMP settings in manifests |
The exact constructors and keyword names should be checked against references/xdiag-api.md before writing a production script; the harness-level shape is:
using XDiag
# 1. Block: charges + (optionally) a space-group irrep fixed by /method-ed.
N = 16
nup = div(N, 2)
p = Permutation([collect(2:N); 1]) # translation by one site
group = PermutationGroup([p^k for k in 0:(N-1)])
rep = Representation(group) # trivial irrep (k = 0)
block = Spinhalf(N, nup, rep)
# 2. Operator sum. Julia site labels count from 1.
ops = OpSum()
for i in 1:N
ops += "J" * Op("SdotS", [i, mod1(i + 1, N)])
end
ops["J"] = 1.0
# 3. Diagnostics, then the route's solver.
@show dim(block), isreal(ops)
e0, psi0 = eig0(ops, block) # ground state
# res = eigs_lanczos(ops, block; neigvals = 4) # low-lying tower
# psi_t = time_evolve(ops, psi0, t) # Krylov dynamics
# 4. Measure; symmetrize non-invariant operators on symmetric blocks.
corr = symmetrize(Op("SdotS", [1, 2]), group)
@show inner(corr, psi0)
Densify only for deliberately small blocks where the complete spectrum is needed:
H = matrix(ops, block) # 8·D² bytes real; then LinearAlgebra.eigen
The method card owns the work counts and feasibility anchors; this skill measures the XDiag rate and multiplies.
8 D^2 bytes real (×2 complex) plus eigenvector/workspace; time one small dense eigen to fix the D³ rate before promising a wall time.apply(ops, psi) on the target block (or a smaller block with the same terms-per-site); wall = matvec time × iterations × requested states. The probe measures only a rate, is discarded, and is gated per reproduce-paper step 4./using-slurm when the block exceeds local memory or the 15-minute target by a large factor. Distributed XDiag (*Distributed blocks, MPI, C++-only) has no symmetrized blocks yet — a symmetry-resolved target that needs MPI is a real constraint to surface, not a silent fallback.user_basis in /using-quspin is the documented route).eigsh(sigma=…) one-liner, or SLEPc-class tooling)./method-ed, not here.