Skip to content

Alice 0.3.0

Choose a tag to compare

@changkai-zhang changkai-zhang released this 18 Oct 06:00
· 416 commits to stable since this release

Alice 0.3.0 — TDVP: Real-Time Evolution

Release Date: October 18, 2026

Version 0.3.0 introduces TDVP (Time-Dependent Variational Principle), Alice's third
algorithm alongside DMRG and XTRG: a real-time solver that evolves an MPS under
|ψ(t)⟩ = exp(-i H t) |ψ(0)⟩ by projecting the Schrödinger equation onto the tangent
space of the MPS manifold and integrating the projection by projector splitting. Two
update schemes are available — 1-site at fixed bond dimension and 2-site with SVD
truncation — each driven by a Lanczos–Krylov matrix exponential and a first- or
second-order symmetric integrator. Supporting this, the network layer gains complex
amplitudes: Network.to(device, dtype), a dtype keyword on init_mps, and an
observe that contracts a complex state against a real observable. No breaking API
changes.

⏱️ TDVP Algorithm

Tangent-Space Evolution

  • New alice.algorithm.tdvp package exporting Options, Summary, Artifact, and
    run, with tdvp added to the alice.algorithm and top-level alice namespaces.
    alice.xtrg is now exported at the top level as well, alongside the existing
    alice.dmrg.
  • tdvp.run(artifact, H, opts) takes the starting state bundled with its time and
    step in an Artifact and the Hamiltonian MPO as a separate argument — unlike XTRG,
    where the generator is baked into the density matrix being squared — and returns
    (Summary, Artifact).
  • The tangent-space projector is never formed. Its positive terms are the sequence of
    single-site evolutions over a half-sweep, each of which is the projection onto one
    term, since the left and right environments built from canonical neighbors are exactly
    P^L and P^R. Its negative term is the zero-site back-evolution on each bond,
    applied with -dt, which cancels the double counting between consecutive terms.
    Omitting it does not merely degrade the order — it breaks first-order consistency.
  • One full sweep is one time step. There is no inner convergence loop and no e_tol
    analogue: TDVP integrates, it does not optimize.

Update Schemes

  • 1-site ('1s'): single-tensor evolution plus the zero-site bond back-evolution,
    with exact (non-truncating) splits. Conserves norm and energy to roundoff and holds
    every bond dimension fixed.
  • 2-site ('2s', the default): evolves the merged two-site tensor Θ and splits it by
    SVD under max_bond / trunc_thresh, so bonds both grow and shrink as entanglement
    develops. Its back-evolution is a 1-site evolution of the site the split just loaded
    with singular values, reusing evolve_1site from the 1-site module.
  • '1sp' is accepted by Options for forward compatibility and rejected by run() with
    NotImplementedError.
  • Scheme aliases ('2-site', 'two-site', …) resolve in Options.__post_init__,
    matching the DMRG and XTRG convention.

The Frozen-Bond Trap

  • The 1-site manifold is one of fixed bond dimension, so a quench started from a
    product state — every bond of dimension 1 — stays a product state forever while norm
    and energy remain conserved to machine precision and the run looks healthy. This is a
    sharper restriction than the corresponding one in DMRG or XTRG, where a 1-site run
    merely converges less well.
  • run() detects the situation at startup and warns, naming the offending bonds and
    recommending '2s' or a '2s' warm-up until every bond has opened.

Integrator Order

  • order=2 (default, Lubich symmetric): a forward half-sweep at dt/2 then a backward
    one, leaving the orthogonality center back at site 0. The step is its own adjoint.
  • order=1 (Lie-Trotter): a single half-sweep at dt, with the direction alternating
    between steps.
  • Both are globally second order at equal cost: two consecutive order=1 steps of size
    dt are exactly one order=2 step of size 2dt — the same local exponentials in
    the same sequence, verified to 1e-9 in the test suite. What order=2 buys is where the
    accuracy lands. Every order=2 snapshot lands at the end of a complete
    forward-and-backward sweep pair, whereas an order=1 snapshot taken after an odd step
    carries first-order error, so a trajectory measured at every step wants order=2.

Local Exponentials

  • New krylov.py computes exp(-i dt H) v for a Hermitian H given only a
    matrix-vector product, playing the role davidson.py plays for DMRG. It uses the
    Lanczos three-term recurrence with full re-orthogonalization — plain Lanczos loses
    orthogonality rapidly in floating point, and because the output is a propagator rather
    than an eigenvalue, that loss shows up directly as a non-unitary step.
  • The Lanczos tridiagonal is exponentiated exactly via numpy.linalg.eigh, so no
    dedicated matrix-exponential routine (and no SciPy dependency) is needed.
  • Termination is on happy breakdown, on the modulus of the last coefficient of
    exp(-i dt T) e₁ falling below krylov_tol, or on the krylov_dim cap. That
    coefficient is the leading truncation error term and is reported back to the caller.
  • inner_product here always returns complex, unlike its DMRG counterpart: TDVP
    vectors carry physical phases, and dropping the imaginary part would silently corrupt
    the recurrence.

Environments

  • New environ.py with an Environment class holding 3rd-order blocks
    (bra_bond, mpo_bond, ket_bond), instantiated twice per run. The same blocks serve all
    three effective Hamiltonians — 1-site, 2-site, and the zero-site one, which contracts
    env_left[b] against env_right[b-1] across their common MPO bond — so the zero-site
    update adds no storage of its own.
  • Disk spilling reuses the DMRG/XTRG design: a sliding window of env_window blocks in
    memory, asynchronous writes and prefetches through a ThreadPoolExecutor, and
    left/{i:05d}.pt / right/{i:05d}.pt files under a per-run UUID subdirectory of
    env_cache_dir that is removed when run() returns or raises.
  • Block dtypes are deliberately not uniform. The two trivial boundaries come from
    identity and stay real even for a complex state; every other block contracts the
    state in and turns complex at the first step.

Options, Summary, and Artifact

  • Options exposes scheme, dt (which may be negative, to evolve backwards and
    measure accumulated error), n_steps, order, max_bond, trunc_thresh,
    krylov_dim, krylov_tol, renormalize, the env_cache_dir/env_async_io/
    env_window cache triple, checkpoint_dir, artifacts_dir, save_artifacts, and
    save_artifacts_every. Options.from_toml / load_toml work as in the other
    algorithms.
  • renormalize defaults to False so that norm loss from truncation stays visible in
    Summary.norms instead of being silently absorbed.
  • Summary carries times, energies, norms, max_bonds (one entry per recorded
    state, so n_steps + 1 of them), discarded_weights and krylov_errors (one entry
    per step performed, so one fewer), plus the final bond_dims profile. It holds no
    state at all.
  • Energy and norm are conserved exactly by the projected flow, which makes them
    diagnostics of numerical health rather than of physical accuracy — a run that has
    truncated away the real physics still conserves both. discarded_weights is the
    quantity to watch for accuracy, and max_bond the one to converge.
  • Artifact (state, time, step) is both the input and the output of run(), which
    is what makes a resumed run indistinguishable from a fresh one.

Checkpointing and Resumption

  • evolution.ckpt (the latest Summary) and tdvp.ckpt (the latest Artifact) are
    written atomically after every step under checkpoint_dir; tdvp.ckpt is removed when
    run() finishes successfully, so a crash leaves it behind for inspection.
  • Resuming is calling run() again with the Artifact from tdvp.ckpt; the time and
    energy history is recovered from evolution.ckpt automatically. Continuing a finished
    run works the same way from any archived artifacts/step_XXXXX.ckpt, under new options
    such as a larger max_bond. Starting from a step before the end of the history
    truncates it back (with a WARNING) and recomputes forward.
  • n_steps is the absolute step index to stop at, counted from t = 0, not a number of
    additional steps — the same convention XTRG uses for cooling steps.
  • save_artifacts_every thins the archive: step k is written when
    k % save_artifacts_every == 0. The stride is keyed on the absolute step index, so a
    trajectory stitched from several resumed calls lands on exactly the same grid as one
    that ran straight through. Archives use five-digit zero padding so a long run still
    sorts lexicographically.
  • A run never evolves past the last grid point: when n_steps is not a multiple of the
    stride, run() stops at the largest multiple that is not greater than it and warns.
    Since tdvp.ckpt is removed on success, an off-grid endpoint would otherwise finish
    with no snapshot of its own final state anywhere on disk. Only the endpoint is
    constrained, which is why resuming from a crash at an off-grid step still works.

🔢 Complex Amplitudes in the Network Layer

  • New Network.to(device=None, dtype=None) casts and moves every site tensor in place,
    with both arguments optional. Casting the blocks also casts the Bridge intertwiner
    weights, which is what a generic symmetry group needs for the tensor to contract. The
    call is idempotent, so promoting an already-complex state costs nothing. Narrowing a
    complex network to a real dtype raises ValueError; discarding an imaginary part has
    to be asked for explicitly, per tensor.
  • init_mps gains a dtype keyword (default torch.float64), threaded through both the
    product-state and random-MPS paths, so a state intended for real-time evolution can be
    built as complex128 directly.
  • tdvp.run promotes a real state and a real Hamiltonian MPO to complex128 in place,
    logged at INFO. Evolution is unitary, so there is nothing to gain from a real state and
    nothing correct to be had from one — and this is what lets a DMRG ground state be
    handed straight to a quench with no work from the caller.
  • observe handles complex states, including a complex state paired with a real
    observable. The scalar extraction moves into a shared _real_scalar helper that
    discards an imaginary part at roundoff level and raises ValueError beyond it, since a
    large imaginary part means the observable is not Hermitian on this state. A boundary
    tensor carrying no block at all — an annihilated symmetry sector, such as a number
    operator measured on a certainly-empty site — is now read as an exactly vanishing
    expectation value rather than failing.
  • Requires Nicole ≥ 0.4.2 for native complex tensor support; the previous floor was
    0.3.7.

🧪 Tests

  • Seven new test modules under tests/algorithm/tdvp/: test_environ.py,
    test_krylov.py, test_physics.py, test_scheme_1s.py, test_scheme_2s.py,
    test_sweep.py, and test_tdvp.py, plus a shared conftest.py.
  • test_physics.py is the layer that pins the algorithm against physics rather than
    against itself: occupations matched to the analytic single-particle propagator on a
    free chain with second-order convergence in dt; norm, energy, and U(1) charge
    conservation across both schemes and both orders; forward-then-backward reversibility;
    an eigenstate whose overlap magnitude stays at 1 while its phase winds at the
    ground-state energy; exactness at full rank; and the frozen product state under '1s'
    together with its recovery once the bonds are open.
  • New complex-dtype coverage in the network tests: Network.to promotion, norm
    preservation, idempotence, device-only moves, and the real-narrowing error;
    TestObserveComplex checking a complex state against its real counterpart (Abelian and
    SU(2)), a complex observable, global-phase invariance, a non-Hermitian observable, a
    complex thermal density matrix, and the annihilated-sector zero.

📚 Documentation

  • New docs/algorithms/tdvp/ section — overview, Options, Summary, Artifact, and
    run — covering the tangent-space projection, the two schemes and the frozen-bond
    warning, integrator order, the Krylov solver, the on-disk layout and artifact grid, and
    how to read a history whose lists come in two lengths.
  • New docs/examples/tdvp/ walkthroughs, each validated against an analytic reference or
    across symmetry groups: a Gaussian wavepacket against the exact single-particle
    propagator with clean dt² convergence; domain-wall melting against the exact
    correlation matrix, with entanglement entropy as well as occupations; spinful melting
    at U = 0 checked against twice the spinless result in both Abelian and SU(2)
    bookkeeping; and an interaction quench from a DMRG ground state in all four band
    symmetry groups.
  • docs/api/network/observe.md gains a complex-states section, init-mps.md a
    complex-amplitudes section, and network.md renders the new to method. The
    algorithms and examples indexes, mkdocs.yml navigation, and the README all gain TDVP
    sections — and TDVP leaves the README's Upcoming list.
  • New docs/algorithms/xtrg/lessons.md: trunc_thresh is an absolute singular value
    cutoff, and the squaring sweeps apply it to a product of unit-norm factors whose norm is
    2^(-N/2) near infinite temperature, so a longer chain needs a proportionally smaller
    threshold.
  • The algorithms index gains the XTRG Artifact row it had been missing, and the
    entry-point page of each algorithm is now called Launch there, as it already was in
    the sidebar, so a link no longer renames its destination.

📝 Examples

  • examples/examples_tdvp/tdvp_freefermion.py: Gaussian wavepacket propagation on a
    spinless chain against the exact exp(-iht) reference.
  • examples/examples_tdvp/tdvp_domainwall.py: many-body domain-wall melting, occupations
    and entanglement entropy against the exact correlation matrix.
  • examples/examples_tdvp/tdvp_hubbard.py: spinful melting at U = 0, Abelian versus
    SU(2).
  • examples/examples_tdvp/tdvp_hubbard_quench.py: interaction quench from a DMRG ground
    state in all four symmetry groups.
  • examples/examples_tdvp/freefermion_exact.py: the exact free-fermion reference
    implementation the first three build on.

📊 Statistics

  • 1,211 tests across 37 test modules (up from 979 / 30 modules in v0.2.8).
  • 80 commits since v0.2.8.
  • 53 files changed, 10,480 insertions, 43 deletions.
  • 34 source modules in five subpackages: alice.network, alice.physics,
    alice.algorithm.dmrg, alice.algorithm.xtrg, alice.algorithm.tdvp.

✅ Compatibility

Breaking Changes: none.

Behavioral Changes:

  • observe raises ValueError when the expectation value has a non-negligible imaginary
    part (relative tolerance 1e-10, with an absolute floor of the same size), instead of
    returning the real part of a meaningless number.
  • observe returns 0.0 for a boundary tensor with no data block, where it previously
    raised StopIteration.
  • tdvp.run mutates the MPS and MPO it is given, promoting both to complex128 in
    place when they are not already complex.

Requirements:

  • Python ≥ 3.11
  • PyTorch ≥ 2.5
  • Nicole ≥ 0.4.2

📝 Notes

TDVP borrows the shape of the two algorithms already in Alice wherever they are
conceptually alike: Options/Summary follow AlgorithmOptions/AlgorithmSummary, the
scheme names and aliases match, the Artifact and checkpoint-resumption design is XTRG's
with time in place of β, and the disk-spilling Environment reuses the same
sliding-window-plus-async-I/O pattern. What does not carry over is the sweep itself. A
DMRG or XTRG sweep is one iteration of a search that repeats until something converges; a
TDVP sweep advances physical time by a fixed amount and is never repeated. There is no
inner loop to tune and no residual to watch, which is why the sweeps take a dt and
return error diagnostics rather than an energy.

The consequence worth internalizing is that TDVP's conserved quantities are not accuracy
measures. A DMRG run reports an energy that is the answer, and an XTRG run reports a
log Z that is likewise the answer; a TDVP run reports an energy and a norm that the
projected flow conserves by construction, whether or not the trajectory still resembles
the true one. They detect a broken integrator or an undersized Krylov space, nothing
more. The quantities to converge are the observables themselves, measured afterwards from
the archived snapshots, and the knob that moves them is max_bond — entanglement after a
quench grows roughly linearly in time, so the bond dimension needed grows exponentially,
and that, not the step size, is what sets the reachable time horizon.