How-to guides
These pages are task recipes: short, runnable answers to "how do I do X?". They assume you already know the basics — if you are new to MPSKit, start with Your first ground state instead. Each recipe below stands on its own, so feel free to jump straight to the one you need.
States and operators
Constructing states — building FiniteMPS, InfiniteMPS, WindowMPS, and MultilineMPS objects.
A finite MPS — random states, initializers and element types, per-site spaces, product states, and wrapping your own site tensors.
An infinite MPS — single- and multi-site unit cells, from spaces or from tensors.
A window MPS — a mutable finite region embedded in infinite environments.
A multiline MPS — stacking
InfiniteMPSrows for boundary-MPS methods.States with symmetries — building MPS with
Rep[G]graded spaces.
Building Hamiltonians — assembling MPO Hamiltonians from local operators.
Finite Hamiltonian from local terms —
FiniteMPOHamiltonianfrominds => operatorpairs.Infinite (translation-invariant) Hamiltonian —
InfiniteMPOHamiltonianon a unit cell.Converting between boundary conditions — open vs. periodic finite chains from an infinite Hamiltonian.
A window Hamiltonian — carving a finite interval out of an infinite Hamiltonian with
WindowMPOHamiltonian.
Finding ground states
Ground-state algorithms — configuring find_groundstate.
Get a ground state with defaults — letting
find_groundstatepick an algorithm for you.Configure finite-system DMRG — explicit
DMRG/DMRG2, and chaining them with&.Configure infinite-system algorithms —
VUMPS,IDMRG, andIDMRG2.Refine convergence with GradientGrassmann — Riemannian gradient descent after a cheaper warm-up.
Control output and tolerances —
verbositylevels and reusingenvsbetween calls.
Controlling bond dimension — inspecting, growing, and shrinking bond dimension.
Inspecting the current bond dimension —
left_virtualspace/right_virtualspaceanddim.Growing bond dimension —
RandExpand(no Hamiltonian needed) andOptimalExpand.Reducing bond dimension —
SvdCutand the in-placechangebonds!.Truncation schemes —
truncrank,trunctol,notrunc,truncspace, and combining them with&.Growing during finite MPS optimization —
DMRG2and thetrschemekeyword offind_groundstate.Growing during infinite MPS optimization —
IDMRG2andVUMPSSvdCut.Chaining algorithms — composing bond-change and ground-state algorithms with
&.
Dynamics
Time evolution — real- and imaginary-time evolution of an MPS.
Evolve a state through one time step —
timestepwithTDVP.Evolve over a time span —
time_evolveacross a vector of time points.Grow the bond dimension while evolving —
TDVP2with a mandatorytrscheme.Evolve an infinite state — single-site
TDVPon anInfiniteMPS.Imaginary-time evolution —
imaginary_evolution = trueto cool towards the ground state.Build a time-evolution MPO —
make_time_mpo(WII,TaylorCluster,WI) plusapproximate.
Measurements
Computing observables — extracting physical quantities from an MPS.
Local (one-site) expectation value —
expectation_value(ψ, i => O).Multi-site (contiguous) expectation value — tensor-product operators on an index tuple.
Energy (full-MPO expectation value) —
expectation_value(ψ, H)for a Hamiltonian MPO.Two-point correlators —
correlator, including a full correlation profile over a range.Energy variance as a convergence check —
varianceas a diagnostic after a ground-state search.
Entanglement entropy and spectrum — reading off entanglement from the gauge tensors.
Entanglement entropy at a single cut —
entropy(ψ, site).Entropy profile across every cut — collecting
entropyover all sites.The entanglement spectrum —
entanglement_spectrumas a sector-resolved vector.Sector-resolved spectrum — indexing the spectrum by symmetry sector with
keys/pairs.Entanglement of an infinite MPS —
entropy/entanglement_spectrumper unit-cell site.Plotting the spectrum — the
entanglementplotrecipe (requires Plots.jl).
Excitations
Excited states — computing energy eigenstates beyond the ground state.
Get a single excitation gap on an infinite chain —
QuasiparticleAnsatzat a fixed momentum.Scan the dispersion relation — passing a range of momenta in one call.
Target a symmetry sector — a charged quasiparticle via the
sectorkeyword.Excited states on a finite chain —
QuasiparticleAnsatz,FiniteExcited, and the Chepiga ansätze.Check excitation quality —
varianceon a quasiparticle state.Domain-wall excitations — quasiparticles interpolating between two distinct ground states.
Missing a recipe?
If the task you're after isn't listed here, please open an issue at QuantumKitHub/MPSKit.jl describing what you're trying to do. Concrete task descriptions make the best new recipes.