Skip to content

Options

TDVP run options.

Options dataclass

Options(
    scheme: str = "2s",
    dt: float = 0.05,
    n_steps: int = 20,
    order: int = 2,
    max_bond: Optional[int] = None,
    trunc_thresh: float = 1e-12,
    expand_k: int = 4,
    expand_alpha: Optional[int] = None,
    krylov_dim: int = 16,
    krylov_tol: float = 1e-12,
    renormalize: bool = False,
    env_cache_dir: Optional[str] = None,
    env_async_io: bool = True,
    env_window: int = 2,
    checkpoint_dir: Optional[str] = None,
    artifacts_dir: Optional[str] = None,
    save_artifacts: bool = True,
    save_artifacts_every: int = 1,
)

Bases: AlgorithmOptions

TDVP run options.

All fields have sensible defaults so Options() is a valid minimal configuration. Use Options.from_toml to load from a TOML section, or Options.load_toml to read directly from a file.

Parameters:

Name Type Description Default
scheme str

Update scheme per time step. Canonical values and aliases:

  • '2s' / '2-site' / 'two-site': 2-site update with SVD truncation. The default, because it is the only scheme that can change bond dimensions, and therefore the only one that can follow a quench from a low-entanglement state.
  • '1s' / '1-site' / 'one-site': 1-site update. Cheaper, and conserves norm and energy to roundoff, but holds every bond dimension fixed. See the module docstring for the product-state trap this creates.
  • '1sp' / '1-site-plus' / 'one-site-plus': update on a bond expanded beforehand by controlled bond expansion, by up to expand_k directions per bond per half-sweep. An adaptive-rank scheme of the '2s' kind, truncation and discarded weight included, at close to 1-site cost, and so free of the product-state trap. It is not a '1s' run with an extra step: norm and energy are conserved only to truncation error, and the trajectory is not exactly reversible.
'2s'
dt float

Time increment per step. May be negative to evolve backwards, which is how a run is reversed to check accumulated error.

0.05
n_steps int

Target step index counted from the start of the history, not a number of additional steps to perform. A run from step=0 to n_steps=40 reaches t = 40 dt; resuming at step=20 with the same n_steps performs the remaining 20.

20
order int

Integrator order, 1 or 2.

  • 2 (default, Lubich symmetric): forward half-sweep at dt/2, then a backward half-sweep at dt/2. The step is its own adjoint and leaves the orthogonality center back at site 0.
  • 1 (Lie-Trotter): a single half-sweep at dt, alternating direction between steps.

Both are globally second order at equal cost — two consecutive order=1 steps are exactly one order=2 step of twice the size. The difference is that every order=2 snapshot lands at the end of a complete forward-and-backward sweep pair, whereas order=1 snapshots after an odd step carry first-order error.

2
max_bond Optional[int]

Maximum bond dimension. None means unlimited. Meaningful for '2s' and '1sp', the two schemes whose bonds can grow; the '1s' update never changes a bond dimension, so no truncation is applied there at all.

None
trunc_thresh float

Singular value truncation threshold (relative to the largest singular value per charge sector). As for max_bond, '2s' and '1sp' only.

1e-12
expand_k int

Maximum number of complement directions added to each bond per local update. Only used when scheme = '1sp'. Larger values let the bond profile adapt faster at higher cost. A typical choice is round(sqrt(max_bond)). 0 reduces the scheme to '1s'.

4
expand_alpha Optional[int]

Internal bond dimension of the cheap factorization of Θ inside the expansion, which keeps the complement search cheaper than a 2-site step. Only used when scheme = '1sp'. None keeps the full bond, making the search exact but no cheaper than '2s' per bond. A typical choice is expand_alpha ≈ expand_k ≈ round(sqrt(max_bond)).

None
krylov_dim int

Maximum Krylov subspace dimension per local exponential. The solver stops earlier on happy breakdown or once krylov_tol is met.

16
krylov_tol float

Convergence tolerance for the local matrix exponential, measured as the weight the propagator places on the newest Krylov direction.

1e-12
renormalize bool

If True, rescale the state to unit norm after every step. False by default so that norm loss from truncation stays visible in Summary.norms instead of being silently absorbed; the '1s' scheme conserves the norm regardless.

False
env_cache_dir Optional[str]

Root directory for environment disk caching. When set, run() creates a unique subdirectory inside it (first 8 hex characters of a UUID4, e.g. {env_cache_dir}/a1b2c3d4/) so that concurrent runs sharing the same config do not overwrite each other's blocks. Inside that subdirectory, left/{i:05d}.pt and right/{i:05d}.pt files are written, and are reused across all time steps of the run. The unique subdirectory is removed automatically when run() returns (or raises). None (default) keeps all blocks in memory. Stored as str for TOML compatibility.

None
env_async_io bool

If True (default), disk writes are submitted asynchronously so they overlap with computation. Has no effect when env_cache_dir is None.

True
env_window int

Number of environment blocks to keep in memory at once when disk caching is enabled.

2
checkpoint_dir Optional[str]

Directory for checkpoint files. After every time step an evolution.ckpt file (PyTorch format, loadable via tdvp.Summary.load) is written using an atomic write (evolution_lock.ckpt → rename). Mid-run progress is stored as tdvp.ckpt (an Artifact) and removed when run() finishes successfully. None (default) resolves to Path.cwd() at the time run() is called, mirroring .logging. Stored as str for TOML compatibility.

None
artifacts_dir Optional[str]

Directory for archived Artifact files (step_XXXXX.ckpt), written when save_artifacts is True. None (default) resolves to artifacts/ under checkpoint_dir. Stored as str for TOML compatibility.

None
save_artifacts bool

If True (default), write Artifact files under artifacts_dir for every step on the save_artifacts_every grid. Step 0 is the initial state; step k is after the k-th time step. These snapshots are the only record of the state along the trajectory, since Summary deliberately carries no MPS.

True
save_artifacts_every int

Stride between archived steps: step k is written when k % save_artifacts_every == 0. Must be >= 1; 1 (the default) archives every step. The stride is keyed on the absolute step index and not on an offset from where the run started, so a resumed run archives the same grid as an uninterrupted one.

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, which keeps artifacts_dir an exact grid whose final entry is also the run's resumable endpoint. No clamping happens when save_artifacts is False.

1

TOML Loading

Options can be loaded directly from a TOML section:

import tomllib
from alice.algorithm import tdvp

with open("config.toml", "rb") as f:
    cfg = tomllib.load(f)

opts = tdvp.Options.from_toml(cfg["quench"]["algorithm"])

Example TOML block:

[quench.algorithm]
scheme               = "2s"
dt                   = 0.05
n_steps              = 40
order                = 2
max_bond             = 64
trunc_thresh         = 1e-12
expand_k             = 8
expand_alpha         = 8
krylov_dim           = 16
save_artifacts_every = 4

Choosing dt and max_bond

The two parameters fail in opposite directions and are best converged separately.

Truncation error is set by max_bond and is independent of dt, so a run limited by bond dimension shows no improvement when the step is halved. Integration error scales as dt² for order=2 and is independent of max_bond. A scan that halves dt and sees the error drop by four is integration-limited; one that sees no change is truncation-limited and needs a larger max_bond.

Entanglement grows roughly linearly in time after a quench, so the bond dimension needed grows exponentially. This, not the step size, sets the reachable time horizon.

Choosing expand_k

expand_k matters only for scheme='1sp', where it caps how many directions a bond may gain per local update. The cap is an upper bound and frequently not the binding one: what a bond receives is however many directions its complement holds above the scale the discarded-space projection cancelled on, and for a short-range Hamiltonian that is typically one or two. A typical choice for the cap is round(sqrt(max_bond)).

Too small a value is visible as a max_bonds history that climbs step by step over a stretch where the physics is not changing that fast, and as observables that improve when expand_k is raised at fixed max_bond and dt. Too large a value costs a slightly bigger SVD per update and changes nothing else — if raising it does not move the answer, the complement, not the cap, was the limit. Setting expand_k = 0 disables the expansion and reproduces '1s' exactly, a useful control when attributing an error to the expansion instead of to the integrator.

expand_alpha truncates the two-site tensor the complement search is built from, which keeps the search cheaper than a 2-site step; None leaves the bond intact, making the search exact and the step no cheaper than '2s'. A typical choice is round(sqrt(max_bond)), the same scale as expand_k.

See Also