Skip to content

M-CHECKPOINT CHK.7: checkpoint Reorganization Energy's geometry optimizations - #55

Merged
jonathanschultzNU merged 2 commits into
mainfrom
claude/m-checkpoint-chk7-chk4
Aug 20, 2026
Merged

M-CHECKPOINT CHK.7: checkpoint Reorganization Energy's geometry optimizations#55
jonathanschultzNU merged 2 commits into
mainfrom
claude/m-checkpoint-chk7-chk4

Conversation

@NCCU-Schultz-Lab

@NCCU-Schultz-Lab NCCU-Schultz-Lab commented Aug 16, 2026

Copy link
Copy Markdown
Collaborator

Summary

Last in the stack behind M-METAL (#52), M-TYPECHECK (#53), and M-EXPORT2 (#54) — all merged. This branch has main merged in and is green.

Reorganization Energy runs 2-3 independent geometry optimizations under one Calculate-tab run (the neutral reference plus one per ion channel) and was dispatched with no checkpoint at all — arguably the longest-running calc type in the app had nothing to resume into.

  • New Checkpoint.sub(tag, *, charge, multiplicity, coords) on the Checkpoint class derives a nested per-leg checkpoint (own resume key, own directory under <parent.dir>/legs/) — a single shared checkpoint would let one leg's trajectory/BFGS Hessian overwrite another's. has_progress() extended to read progress from nested legs, since the parent itself never writes a trajectory directly.
  • run_reorganization_energy() now takes checkpoint/resume, builds+begins a leg checkpoint for the neutral optimization and each ion-channel optimization, and marks the parent complete once every required single point has converged (mirrors pes_scan.py's "every point attempted" convention).
  • Two real bugs found while wiring this up, not part of the design: _CALC_TYPE_KEYS never listed "Reorganization Energy" — every reorg checkpoint silently collided with an actual single-point checkpoint on the same molecule/method/basis, and the runtime estimator scored reorg runs against single-point history. And the parent checkpoint was never marked complete on success, so a finished run would have lingered forever in the "unfinished calculations" list.
  • Verified end-to-end against real PySCF (RHF/STO-3G, H2, hole channel): distinct leg checkpoints with correct steps_done, parent correctly marked complete afterward.
  • CHK.4 (frequency displacement restart) is not implemented here — the roadmap scoped it as a real design task, not a wiring one. A grounded, code-specific design proposal is written up in the planning repo instead of a rushed implementation.

Scope note: this ships CHK.7. The milestone stays open — CHK.8 (live real-PySCF verification, LOCAL/Voilà only) and CHK.4 (deferred) remain.

Test plan

  • pytest -m "not network" — full suite passes on CI (ubuntu 3.9/3.10/3.11 + windows 3.11). Locally the only failures are the two GFN-FF test_preopt_gfnff tests, environmental to this dev box (broken xtb C-API extension); they pass on CI where the xtb wheel is intact.
  • 19 new tests in tests/test_checkpoint_reorg_legs.py (no PySCF — optimize_geometry/run_in_session monkeypatched) + a manual real-PySCF smoke test.
  • ruff + black clean.
  • pre-commit run --hook-stage pre-push mypy --all-files — clean (re-confirmed on the main-merged branch).
  • CI green on main base: Lint & type check + all test matrix jobs.

…izations

Reorganization Energy runs 2-3 independent geometry optimizations under one
Calculate-tab run (the neutral reference plus one per ion channel) and was
dispatched with no checkpoint at all — the run most likely to be interrupted
(two full geometry opts plus four SCF energies) had nothing to resume into.

- checkpoint.py: new Checkpoint.sub() derives a nested child checkpoint (own
  resume_key, dir nested under <parent.dir>/legs/) for one leg of a
  multi-stage run — a single shared checkpoint would let one leg's
  trajectory/Hessian overwrite another's. has_progress() now also checks
  nested legs, since the parent itself never writes a trajectory directly;
  without this the run would never be offered as resumable no matter how
  much of a leg had completed.
- reorganization_energy.py: run_reorganization_energy() takes
  checkpoint/resume params, builds+begins a leg checkpoint for the neutral
  optimization and each ion-channel optimization, and marks the parent
  complete once every required single point has converged (mirrors
  pes_scan.py's "every point attempted" convention) — without this a
  successful run would linger forever in the "unfinished calculations" list.
- app.py: the Reorganization Energy branch of _do_run now passes
  checkpoint=_ckpt, resume=_resume like the PES Scan and Single Point
  branches already did.
- app_runflow.py: fixed a real bug found while wiring this up —
  _CALC_TYPE_KEYS (the dropdown-label -> checkpoint/estimator key map) never
  listed "Reorganization Energy", so checkpoint_identity() silently built
  every reorg checkpoint under the "single_point" key, colliding with actual
  single-point checkpoints on the same molecule/method/basis, and the
  runtime estimator was scoring reorg runs against single-point history.

Verified against real PySCF (RHF/STO-3G, H2 hole channel): two leg
checkpoints written with distinct resume keys, correct steps_done, parent
correctly marked complete and no longer offered as resumable.

CHK.4 (frequency displacement restart) stays deferred, per the roadmap's own
scope note — logged as a grounded design proposal in the planning repo
rather than implemented this pass.

Full suite: 2557 passed, 14 failed (pre-existing NMR failures, unrelated),
23 skipped. ruff + black + mypy (pre-push hook-stage) clean.

Contributions:
- Claude (Opus 4.8): implementation, tests, verification
- Jonathan Schultz: direction and review

Co-authored-by: Jonathan Schultz <schultzdjon@gmail.com>
Co-authored-by: Claude <noreply@anthropic.com>
Base automatically changed from claude/m-export2-expanded-exports to main August 20, 2026 21:07
@NCCU-Schultz-Lab
NCCU-Schultz-Lab marked this pull request as ready for review August 20, 2026 21:17
@jonathanschultzNU
jonathanschultzNU merged commit 54cc121 into main Aug 20, 2026
5 checks passed
@jonathanschultzNU
jonathanschultzNU deleted the claude/m-checkpoint-chk7-chk4 branch August 20, 2026 21:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants