Skip to content

Summary

XTRG thermodynamic summary: β grid, log Z, and derived observables at each cooling step. Density matrices are returned separately as Artifact.

Summary dataclass

Summary(
    betas: list[float] = list(),
    log_z: list[float] = list(),
    free_energies: list[float] = list(),
    energies: list[float] = list(),
    specific_heats: list[float] = list(),
    entropies: list[float] = list(),
    discarded_weights: list[float] = list(),
    finished: bool = True,
    n_steps: int = 0,
)

Bases: AlgorithmSummary

XTRG thermodynamic summary (no density matrix).

Density matrices are returned separately as Artifact (and optionally archived under artifacts/ when Options.save_artifacts is enabled).

Parameters:

Name Type Description Default
betas list[float]

List of β values at each cooling step: [τ₀, 2τ₀, …, 2^n_steps τ₀].

list()
log_z list[float]

log Z(β_n) at each step, computed via NormalMPO.log_trace() (rather than log(NormalMPO.trace())) so that it remains finite even when Z(β_n) itself is far outside float64 range.

list()
free_energies list[float]

Free energy per site: f(β_n) = −log Z(β_n) / (β_n L).

list()
energies list[float]

Internal energy per site: u(β_n) estimated via log-β finite differences (uniform accuracy on the exponential grid).

list()
specific_heats list[float]

Specific heat per site: c_V(β_n) estimated via log-β finite differences.

list()
entropies list[float]

Entropy per site: S(β_n) = β_n (u(β_n) − f(β_n)).

list()
discarded_weights list[float]

Per-step discarded weight from the variational compression (2-site only; 0.0 entries for 1-site). Length equals the number of squaring steps (n_steps), not the length of betas.

list()
finished bool

True only for the summary returned by a completed run() call. False for mid-run thermal.ckpt snapshots written after an intermediate squaring step (e.g. if the process is interrupted).

True
n_steps int

Number of cooling (squaring) steps reflected in this summary.

0

Methods:

serialize

serialize() -> dict

Serialize the summary to a plain dict compatible with torch.save.

Returns:

Type Description
dict

Serialized summary (version 2; no density matrix).

deserialize classmethod

deserialize(data: dict, device: str = 'cpu') -> Summary

Reconstruct a Summary from a dict produced by serialize.

Parameters:

Name Type Description Default
data dict

Dict previously returned by serialize.

required
device str

Unused for version-2 summaries (no tensors). Accepted for API compatibility with AlgorithmSummary.load.

'cpu'

Returns:

Type Description
Summary

Reconstructed thermodynamic summary.

Raises:

Type Description
ValueError

If data["version"] is not 2.

Serialization

Summary supports save/load via torch.save / torch.load:

# Save after a run.
summary.save("thermal_result.ckpt")

# Load later.
from alice.algorithm.xtrg import Summary
summary = Summary.load("thermal_result.ckpt")

During run(), the latest summary is written to thermal.ckpt under Options.checkpoint_dir (or the current working directory when that option is unset). Serialization version is 2 (no density matrix in the payload).

thermal.ckpt is also where a resumed or continued run recovers its β/log Z history from. A continued run appends to that history, so a single summary may merge segments computed under different options (a larger max_bond, say). The merged history records no marker of where the options changed, and the u / c_V finite differences spanning the junction mix both accuracies — copy the checkpoint directory beforehand to keep the original series for comparison.

See Also

  • Artifact — density-matrix snapshot at one cooling step.
  • Options — configuration for the run that produced this summary.
  • run — returns (Summary, Artifact).