Skip to content

M-EXPORT2: reorg-geometry XYZ export + generalized PNG capture bridge - #54

Merged
jonathanschultzNU merged 2 commits into
mainfrom
claude/m-export2-expanded-exports
Aug 20, 2026
Merged

M-EXPORT2: reorg-geometry XYZ export + generalized PNG capture bridge#54
jonathanschultzNU merged 2 commits into
mainfrom
claude/m-export2-expanded-exports

Conversation

@NCCU-Schultz-Lab

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

Copy link
Copy Markdown
Collaborator

Summary

Third in the stack behind M-METAL (#52) and M-TYPECHECK (#53), both now merged. This branch has main merged in and is green. Next up: #CHECKPOINT.

  • EXP2.1 — "Export XYZ" button on the reorg-geometry viewer: one file per distinct geometry (R_neutral + each R_ion, never per-energy), each carrying charge/multiplicity/method/basis in its header comment. reorg_geometries() now threads charge/multiplicity through (the source payload already had it — this was a pass-through fix).
  • EXP2.3export_destination(), one shared helper deciding folder + sanitised filename for new exporters. Deliberately does not retrofit the 3 existing structure exporters (XYZ/MOL/PDB) — they work today and retrofitting risked a regression for no user-visible gain.
  • EXP2.2 — generalized the isosurface's PNG-capture bridge, which turned out to not be as reusable as the roadmap assumed: _PNG_CAPTURE_JS hardcoded the isosurface's own global (window.__quantuiIsoCapture). Fixed by parameterizing the capture-function name (isosurface's default preserved byte-for-byte, verified by test), then wired a Save-PNG button into the reorg-geometry viewer with its own uid-scoped capture function and inbox — that viewer gets a fresh uid every render, so a shared global would risk one render's button capturing a stale viewer. Molecule/trajectory/vibrational viewers are deliberately deferred; the reusable pattern is now proven on one viewer rather than four at once.
  • EXP2.5 — 20 new tests (tests/test_export2_reorg_and_destination.py) covering the destination helper, the XYZ exporter, the PNG capture handler, and the capture-wiring HTML.

Scope note: this is the first slice of M-EXPORT2. EXP2.4 (general provenance beyond the XYZ header) and the remaining EXP2.2 viewers stay open on the roadmap.

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, which are environmental (this dev box's xtb C-API extension is broken) — they pass on CI where the xtb wheel is intact.
  • 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.

… (EXP2.1-2.3, EXP2.5)

- EXP2.3: export_destination() — one place deciding where a new export lands
  and what it's called, scoped to new exporters only (the 3 existing structure
  exporters are left alone to avoid regressing working code).
- EXP2.1: Export XYZ button on the reorg-geometry viewer, one file per
  distinct geometry (R_neutral + each R_ion), each carrying its own
  charge/multiplicity in the header comment. reorg_geometries() now threads
  charge/multiplicity through (the source payload already had it).
- EXP2.2: generalized the isosurface's PNG capture bridge — _png_capture_controls
  now takes a capture_fn name instead of hardcoding the isosurface's bare
  window.__quantuiIsoCapture global (default preserved for exact backward
  compatibility). Wired a Save-PNG button into the reorg-geometry viewer with
  its own uid-scoped capture function and its own inbox, since every render
  gets a fresh uid and a shared global would risk one render's button
  capturing another's viewer. Molecule/trajectory/vibrational viewers are
  deliberately deferred — the roadmap's "cost of passing a capture_class"
  framing wasn't accurate until this generalization existed; this PR proves
  the reusable pattern on one viewer rather than retrofitting all of them.
- EXP2.5: 20 new tests covering export_destination, the XYZ exporter, the PNG
  capture handler, and the capture-wiring HTML (isosurface default unchanged,
  reorg viewer gets a uid-scoped function, button omitted when capture_class
  is empty).

Full suite: 2538 passed, 14 failed (pre-existing NMR failures, unrelated),
23 skipped. ruff + black + mypy (pre-push hook-stage) all 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-typecheck-restore-ci-mypy to main August 20, 2026 20:51
@NCCU-Schultz-Lab
NCCU-Schultz-Lab marked this pull request as ready for review August 20, 2026 21:04
@jonathanschultzNU
jonathanschultzNU merged commit 090dd90 into main Aug 20, 2026
5 checks passed
@jonathanschultzNU
jonathanschultzNU deleted the claude/m-export2-expanded-exports branch August 20, 2026 21:07
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