Skip to content

run

Top-level TDVP entry point.

run

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

Evolve an MPS in real time under a Hamiltonian MPO.

Advances state.state by opts.dt per step, starting at state.step and continuing to opts.n_steps. Preparing the initial state 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, is calling run() again with the Artifact loaded from tdvp.ckpt or from any archived artifacts/step_XXXXX.ckpt; the matching time/energy history is recovered automatically from evolution.ckpt in opts.checkpoint_dir.

When that history reaches past state.step — the case when restarting from an earlier archived step to redo a segment at, say, a larger max_bond — the later entries are truncated (with a warning), then recomputed by this run and overwritten on disk, together with their step_XXXXX.ckpt archives.

Both state.state and mpo are promoted to complex128 in place when they are not already complex.

Parameters:

Name Type Description Default
state Artifact

Starting MPS, paired with its time and step. step=0 for a fresh run; step > 0 to resume or continue.

required
mpo MPO

Hamiltonian MPO. Must be time-independent and Hermitian; the Krylov solver assumes a Hermitian effective Hamiltonian at every site.

required
opts Optional[Options]

TDVP run options. Defaults to Options() if None. n_steps counts steps from the start of the history, so it is the absolute step index to stop at — not a number of additional steps to perform. When artifacts are being saved and n_steps is not a multiple of save_artifacts_every, the run stops at the largest multiple that is not greater than it and warns.

None

Returns:

Type Description
Summary

Trajectory history (times, energies, norms, bond dimensions, and per-step diagnostics). Written to evolution.ckpt under the checkpoint directory.

Artifact

Final state with its time and step.

Raises:

Type Description
ValueError

If opts.scheme is not a recognized scheme, if state.step is past opts.n_steps, or if state.step > 0 and the evolution.ckpt found in opts.checkpoint_dir is inconsistent with state — because it stops before state.step, because its time there disagrees with state.time, or because it was built with a different dt.

NotImplementedError

If opts.scheme is recognized but not yet implemented.

FileNotFoundError

If state.step > 0 and no evolution.ckpt exists in opts.checkpoint_dir to recover the history from.

run() evolves the state in place

The returned Artifact holds the same MPS object that was passed in, not a copy, so the caller's reference to the initial state is advanced along with it. Snapshot it first if the initial state is needed for comparison — cloning tensor by tensor instead of with copy.deepcopy, which cannot pickle the intertwiners of a non-Abelian tensor:

reference = MPS([state[i].clone() for i in range(state.L)],
                center=state.center)
reference.to(dtype=torch.complex128)

See Also