Skip to content

Click-to-measure atom selection for the Analysis-tab viewer (M-MEASURE) - #62

Merged
NCCU-Schultz-Lab merged 1 commit into
mainfrom
claude/m-measure-atom-selector
Aug 22, 2026
Merged

Click-to-measure atom selection for the Analysis-tab viewer (M-MEASURE)#62
NCCU-Schultz-Lab merged 1 commit into
mainfrom
claude/m-measure-atom-selector

Conversation

@NCCU-Schultz-Lab

Copy link
Copy Markdown
Collaborator

Summary

GaussView-parity: click 2/3/4 atoms in the Analysis tab's top viewer to read a bond length, angle, and dihedral.

  • MEAS.1quantui/measurement.py: distance/angle/dihedral wrappers around ASE's Atoms.get_distance/get_angle/get_dihedral (the read direction of pes_scan.py's existing set_distance/set_angle/set_dihedral), plus describe_picks() building the progressive readout text ("Picked: H1 → O1 (0.958 Å) → H2 (104.5°)"). A collinear inner angle (undefined dihedral plane) is caught and reported in plain language rather than raising ASE's ZeroDivisionError.
  • MEAS.2/3quantui/app_measurement.py: click transport reuses ORBX.1's exact JS→kernel trick (write into a hidden Textarea's DOM node, dispatch an input event) with a new inbox; a Python-side pick-state machine accumulates 1-4 atom indices, resetting on a 5th click.
  • MEAS.4 — picked-atom highlighting pushes to the live viewer via a kernel→JS bridge (mirrors iso_bridge_update), so a re-render never discards the camera orientation the user rotated into.
  • MEAS.5 — a persistent readout panel + Clear button next to the viewer (DEC-009: always visible, content swapped), styled with M-THEME tokens, plus a new Help topic.
  • MEAS.6 — when the Analysis viewer resolves to the plotlymol backend (a static figure, no live click callback), the panel shows an explanatory message instead of controls — never a silent no-op.
  • MEAS.7 — wired into both places that render app._analysis_mol_output (the post-calc render and the backend-toggle re-render), so behavior is identical either way; never touches the Results-tab viewer or any other VizTask.

Test plan

  • pytest -m "not network" — full suite passing
  • ruff / black / mypy — clean
  • Geometry-math unit tests, inbox/pick-state-machine tests, injected-HTML content assertions, router-unaffected check for the sibling STRUCTURE_VIEW_RESULTS task
  • Real browser click-through in Voilà (local/HPC only — not verifiable from cloud session, per roadmap 45)

Authorship

  • Claude (Sonnet 5): code edits, tests, and conceptual discussion
  • Jonathan Schultz: overall vision, planning, review, and orchestration

Generated by Claude Code

…ASURE)

Click 2/3/4 atoms in the Analysis tab's molecule viewer to read a bond
length, angle, and dihedral, GaussView-style. py3Dmol-only for v1 (the
Analysis viewer's plotlymol backend is a static figure with no live
click callback); the panel shows an explanatory message instead of
controls when plotlymol is resolved (MEAS.6), never a silent no-op.

- quantui/measurement.py (MEAS.1): distance/angle/dihedral wrappers
  around ASE's Atoms.get_distance/get_angle/get_dihedral -- the read
  direction of pes_scan.py's existing set_distance/set_angle/
  set_dihedral -- plus describe_picks(), the progressive readout text
  ("Picked: H1 -> O1 (0.958 A) -> H2 (104.5 deg)"). A collinear inner
  angle (undefined dihedral plane) is caught and reported in plain
  language rather than raising ASE's ZeroDivisionError.
- quantui/app_measurement.py (MEAS.2-.6): the click transport reuses
  ORBX.1's exact JS->kernel trick (write into a hidden Textarea's DOM
  node, dispatch an 'input' event) with a new inbox; picked-atom
  highlighting pushes to the LIVE viewer via a kernel->JS bridge
  (mirrors iso_bridge_update) so a re-render never discards the
  camera orientation the user rotated into. A 5th click starts a new
  chain; repicking an already-selected atom is ignored rather than
  producing a degenerate (undefined) measurement.
- Wired into both places that render app._analysis_mol_output
  (app_visualization.show_result_3d and app._rerender_3d_views), so
  it works identically after a calc and after a backend-toggle
  switch. Never touches the Results-tab viewer or any other VizTask.
- Help topic ("measure") added to help_content.py; readout panel
  styled with M-THEME tokens, no new hardcoded hex.

Cloud-tested: geometry-math unit tests, inbox/pick-state-machine
tests (mirroring the existing PNG-inbox test shape), injected-HTML
content assertions, and a router-unaffected check for the sibling
STRUCTURE_VIEW_RESULTS task. The actual browser click-through is a
LOCAL/Voila exit gate per roadmap 45, not attempted here.

Claude (Sonnet 5)
Co-authored-by: Claude <noreply@anthropic.com>
@NCCU-Schultz-Lab
NCCU-Schultz-Lab merged commit 5f90199 into main Aug 22, 2026
5 checks passed
@NCCU-Schultz-Lab
NCCU-Schultz-Lab deleted the claude/m-measure-atom-selector branch August 22, 2026 12:46
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.

1 participant