dmrg: resuming with a smaller SWEEPS silently skips to the final sweep

Open Beginner friendly
#495 0 comments 0 reactions 1 assignee View on GitHub

Maintainers usually reply within 2 days

@skilledwolf is already working on this.

Since Nov 30, 2026.

  • #509 by @skilledwolf — open

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
72/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
cpp
Domain
hpc

Research direction

Start in src/apps/dmrg/dmrg/dmrg.h at the read_progress branch just before S.resume, where the checkpoint's at.sweep is already available, and read checkpoint_cache.h:56 to see why SWEEPS is no longer in the fingerprint. Implement the guard so a checkpoint whose last completed at.sweep is beyond SWEEPS is refused with a message naming both numbers, while a run killed in its final sweep (SWEEPS + 1) still resumes. Done looks like the L=16 Heisenberg reproducer: SWEEPS=3 killed in sweep 2, then RESUME=1 SWEEPS=1 refuses instead of exiting 0, and equal or larger SWEEPS behaves as before.

Written by the indexing model from the issue text.

Description

area:dmrg bug P2

A DMRG run resumed with RESUME=1 and a SWEEPS smaller than the number of sweeps the checkpoint has already done goes straight to the final sweep, exits 0 and reports a result that is not that of a SWEEPS run.
This affects RESUME=1 and KEEP_CHECKPOINT=1 (new in 3.1, so not in a release). It is a small fix in dmrg.h.

Reproducer

L = 16 Heisenberg chain, 8 states, so not converged:

  1. Run with SWEEPS=3 and kill it in sweep 2, so the checkpoint is at "sweep 2/3".
  2. Rerun the same input with RESUME=1 and SWEEPS=1.

Expected: the run refuses, or at least warns that the checkpoint is past SWEEPS.
Observed: it exits 0 with an energy between the 1-sweep and 2-sweep results, and the output lists SWEEPS=1.

Fix

When resuming (src/apps/dmrg/dmrg/dmrg.h, the read_progress branch before S.resume), refuse if the checkpoint's last completed iteration (at.sweep) is in a sweep beyond SWEEPS. Not the next sweep to run: that is SWEEPS + 1 for a run killed in its final sweep, which must still resume. The message should name both numbers and say to set SWEEPS to at least the checkpoint's count, or to delete the checkpoint and start over. A larger or equal SWEEPS keeps working as now.

Cause

SWEEPS and the states kept were taken out of the checkpoint fingerprint (checkpoint_cache.h:56), so that a run kept with KEEP_CHECKPOINT can be continued with more sweeps. Nothing checks the other direction, so a smaller SWEEPS resumes the checkpoint and S.resume finds no regular sweep left to run.

Context: #373. Seen on master 6d72261.

Dominant language
C++
Stars
32
Forks
10
Avg merge
3d 23h
Merged PRs (30d)
109

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from ALPSim/ALPS

All issues in ALPSim/ALPS

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.