Skip to content

Options

TgTRG run options.

Options dataclass

Options(
    scheme: str = "2s",
    grid: str = "exp",
    tau_0: float = 2**-12,
    tau: float = 0.1,
    n_steps: int = 13,
    taylor_order: int = 10,
    order: int = 2,
    max_bond: Optional[int] = None,
    trunc_thresh: float = 1e-12,
    krylov_dim: int = 16,
    krylov_tol: float = 1e-12,
    obs_exact: 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

TgTRG 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 cooling step. Canonical values and aliases:

  • '1s' / '1-site' / 'one-site': fixed-rank 1-site update with the zero-site back-evolution on each bond.
  • '2s' / '2-site' / 'two-site': 2-site update with a truncating SVD split, so the bond dimension adapts as the run cools. The default, and what a cooling run almost always wants: ρ(τ₀) starts at the Hamiltonian's own bond dimension, far below what a cold density matrix needs.
'2s'
grid str

β-grid mode, 'exp' / 'exponential' or 'lin' / 'linear'. One per run, never both; stacking the two is a continuation (see the module docstring).

'exp'
tau_0 float

Inverse temperature of the initial Taylor state, ≈ 2⁻¹². Small enough that the Taylor expansion converges. On the exponential grid it also fixes the whole grid, β_k = 2^k τ₀.

2 ** -12
tau float

Step size for grid='lin', ignored on the exponential grid, where the step is β_k itself.

0.1
n_steps int

Absolute step index to stop at, counted from the Taylor state — not a number of additional steps to perform. On the exponential grid the final inverse temperature is β_max = 2^n_steps τ₀, and the default stops at β = 2, where the handover to a linear phase belongs (see the module docstring on step size).

13
taylor_order int

Truncation order of the Taylor series for ρ(τ₀) = e^{-τ₀ H}. Used only by the caller that builds the initial state; recorded here so a run is reproducible from its options alone.

10
order int

Integrator order: 1 for a single half-sweep per step (Lie-Trotter), 2 for the symmetric forward-and-backward pair (Lubich). Defaults to 2, which puts second-order accuracy at every recorded β — and for a cooling run the trajectory is the output.

2
max_bond Optional[int]

Maximum bond dimension of ρ. None means unlimited. The cap is applied to the handed-in state before the first step as well as at every 2-site split, so it holds over the whole run. For '1s', whose tangent space has fixed rank by construction, that initial compaction is the only way the cap takes effect, and it sets the rank the run then keeps.

None
trunc_thresh float

Singular-value truncation threshold: a value is discarded when it falls below trunc_thresh × ‖Θ‖, and the cooling sweeps hold ‖Θ‖ at 1. Being relative, the same setting carries over between chain lengths and temperatures. 0.0 disables threshold truncation, leaving max_bond in charge.

1e-12
krylov_dim int

Maximum Krylov subspace dimension per local propagator.

16
krylov_tol float

Relative convergence threshold for the Krylov expansion, on the weight the propagator puts on the newest direction.

1e-12
obs_exact bool

If True, measure u = Tr[ρH] / (Tr[ρ] L) directly through observe after every step, recorded as Summary.exact_energies. Off by default so a cooling run pays for nothing but the cooling; on, it is the natural cross-check against the finite-difference u, which carries the discretization error of the grid.

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) so that concurrent runs sharing the same config do not overwrite each other's blocks. The subdirectory is removed 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. 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 cooling step a thermal.ckpt file (loadable via tgtrg.Summary.load) is written using an atomic write (thermal_lock.ckpt → rename). Mid-run progress is stored as tgtrg.ckpt (an Artifact) and removed when run() finishes successfully. That mid-run name carries the algorithm, so a TgTRG and an XTRG run can share a directory. None (default) resolves to Path.cwd() at the time run() is called. Stored as str for TOML compatibility.

None
artifacts_dir Optional[str]

Directory for per-step 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 per-step Artifact files under artifacts_dir.

True
save_artifacts_every int

Stride on the step index for archiving artifacts, independent of the cooling grid. The final step of a run is always archived whatever the stride, so a finished run leaves a resumable endpoint for the next phase of a stacked schedule to pick up.

1

TOML Loading

Options can be loaded directly from a TOML section:

import tomllib
from alice.algorithm import tgtrg

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

opts = tgtrg.Options.from_toml(cfg["free_fermion"]["algorithm"])

Every option is a scalar or a string, so a stacked schedule is two sections:

[free_fermion.cooling_exp]
scheme       = "2s"
grid         = "exp"
tau_0        = 0.000244140625   # 2^{-12}
n_steps      = 13               # -> beta = 2
order        = 2
max_bond     = 64
trunc_thresh = 1e-12

[free_fermion.cooling_lin]
scheme       = "2s"
grid         = "lin"
tau_0        = 0.000244140625
tau          = 0.5
n_steps      = 33               # -> beta = 2 + 31 * 0.5
order        = 2
max_bond     = 64
trunc_thresh = 1e-12

tau_0 is carried into the linear section because the recovered history was built on it; n_steps counts from the Taylor state in both.

See Also

  • Overview — grid modes, step size, and the stacked schedule.
  • Lessons — how large a step may be, and why max_bond is the knob that moves the floor.
  • Summary — thermodynamic history.
  • Artifact — density-matrix snapshots.
  • run — pass Options here.