Skip to content

run

Top-level TgTRG entry point.

run

run(
    state: Artifact, mpo: MPO, opts: Optional[Options] = None
) -> Tuple[Summary, Artifact]

Cool a thermal density matrix along the β grid the options describe.

Starts at state.step and continues to opts.n_steps, cooling by one tangent-space sweep per step. Building ρ(τ₀) (e.g. via thermal_mpo) and wrapping it in an Artifact at step=0 is the caller's responsibility. Resuming an interrupted run, or continuing a finished one under new options — the second phase of a stacked exponential-then- linear schedule, say — is calling run() again with the Artifact loaded from tgtrg.ckpt or from any archived artifacts/step_XXXXX.ckpt; the matching history is recovered from thermal.ckpt in opts.checkpoint_dir.

Parameters:

Name Type Description Default
state Artifact

Starting density matrix, paired with its beta and step. step=0 for a fresh run; step > 0 to resume or continue. Cooled in place, so that one phase of a stacked schedule can hand its artifact to the next; an Artifact loaded from a checkpoint is therefore consumed by the first run() it is given to, and branching two continuations off one checkpoint needs the state reloaded between them.

required
mpo MPO

Hamiltonian MPO. Needed at every step, unlike XTRG, where the squaring never refers back to H.

required
opts Optional[Options]

Run options. Defaults to Options() if None. n_steps is the absolute step index to stop at, not a number of additional steps.

None

Returns:

Type Description
Summary

Thermodynamic history (β grid, log Z, derived observables). Written to thermal.ckpt under the checkpoint directory.

Artifact

Final density matrix with its beta and step.

Raises:

Type Description
ValueError

If state.step is past opts.n_steps, if the exponential grid disagrees with state.beta, or if a recovered thermal.ckpt is inconsistent with state.

NotImplementedError

If opts.scheme is recognized but not yet implemented.

FileNotFoundError

If state.step > 0 and no thermal.ckpt exists in opts.checkpoint_dir.

See Also

  • Overview — grid modes, step size, and the stacked schedule.
  • Lessons — how large a step may be, and that run() cools in place.
  • Options — configure the run.
  • Summary — thermodynamic history.
  • Artifact — starting and final density matrix.