Click-to-measure atom selection for the Analysis-tab viewer (M-MEASURE) - #62
Merged
Merged
Conversation
…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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
GaussView-parity: click 2/3/4 atoms in the Analysis tab's top viewer to read a bond length, angle, and dihedral.
quantui/measurement.py:distance/angle/dihedralwrappers around ASE'sAtoms.get_distance/get_angle/get_dihedral(the read direction ofpes_scan.py's existingset_distance/set_angle/set_dihedral), plusdescribe_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'sZeroDivisionError.quantui/app_measurement.py: click transport reuses ORBX.1's exact JS→kernel trick (write into a hiddenTextarea's DOM node, dispatch aninputevent) with a new inbox; a Python-side pick-state machine accumulates 1-4 atom indices, resetting on a 5th click.iso_bridge_update), so a re-render never discards the camera orientation the user rotated into.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 otherVizTask.Test plan
pytest -m "not network"— full suite passingruff/black/mypy— cleanSTRUCTURE_VIEW_RESULTStaskAuthorship
Generated by Claude Code