Fix blank Mulliken 3D viewer (geometry persistence + lazy render) - #103
Merged
Conversation
The Mulliken Populations panel now resolves geometry from result.json, history context, and disk sidecars; defers py3Dmol rendering until the accordion is visible; shows an inline message when coordinates are missing; and refreshes on theme/backend re-render like other Analysis viewers. Co-authored-by: Jonathan Schultz <jonathanschultzNU@users.noreply.github.com>
jonathanschultzNU
marked this pull request as ready for review
August 30, 2026 16:19
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
Fixes the blank molecule viewer in the Mulliken Populations accordion while keeping the charge table and bar chart working.
Root cause: the dedicated Mulliken viewer needs a full
Molecule(coordinates), but history replay often had Mulliken charges inresult.jsonwithout any reachable geometry. Rendering also happened while the accordion content was still hidden, which Voilà can skip for<script>execution.Changes
save_result(..., molecule=calc_mol)writes a top-levelgeometryfield toresult.json;mol_from_result_dir()andbuild_history_context()load it for history replay._mulliken_molecule()falls back throughctx.molecule,mol_from_result_dir(),_analysis_displayed_molecule, and_molecule._mulliken_pending_molecule; the authoritative draw happens in_on_mulliken_accordion_showwhen the panel is visible._rerender_3d_views()now refreshes the Mulliken viewer alongside the other Analysis 3D viewers.result.jsongeometry replay, unavailable message, and theme rerender.Test plan
pytest tests/test_mulliken_panel.py tests/test_results_storage.py tests/test_populations_overlay.pypytest tests/test_sp_analysis_history.py tests/test_theme_contrast.py