Expansion#11
Merged
Merged
Conversation
Add interactive result visualizations to the Results panel: a result 3D view, a geometry-optimization trajectory accordion with animation and energy plot, and a vibrational-mode viewer with mode selector. Introduce helper methods in QuantUIApp to render 3D molecules, build/render vibrational data (via plotlymol3d) and show optimization trajectories; wire up a vib mode dropdown observer and hide/show panels on runs. Extend FreqResult to include normalized displacement vectors and populate them in run_freq_calc when available. Add tests (tests/test_visualization.py) covering plotlyMol trajectory creation and the _build_vib_data_from_freq_result behavior; visual features are no-ops when optional deps (plotlymol3d/RDKit) are missing.
Support PlotlyMol's file-based API and add related UI documentation and deps. - quantui/visualization_py3dmol.py: call draw_3D_rep with an on-disk .xyz file (create tmp file, write full XYZ block, pass xyzfile, and unlink after use) and set paper/scene background colors. Import os and tempfile. This addresses PlotlyMol's API that expects a file path rather than an in-memory string. - pyproject.toml: add runtime dependency "plotlymol>=0.2.1" and expose modules matching "plotlymol3d.*" in the module list. - .github/copilot-instructions.md: update references to use your project STATUS.md/feature-requests.md and document new UI widgets/fields (result_viz_output, traj_accordion, vib_accordion, vib_mode_dd, _last_vib_data, _last_vib_molecule). These changes fix the PlotlyMol integration and update developer-facing docs to reflect new visualization/vibration UI elements.
Collect Mulliken charges and dipole moment from PySCF runs and surface them in results and UI. Updated SessionResult dataclass to include atom_symbols, mulliken_charges and dipole_moment_debye, and modified run_in_session to extract these (skipping for UHF and guarded with try/except). QuantUI app rendering now appends dipole and per-atom Mulliken charges to the results HTML. Added tests for default/returned values and PySCF-backed checks. Also tweaked the notebook startup cell to ensure the local repository is importable so `import quantui` finds the local source.
Introduce ThermoData and attach an optional thermo field to FreqResult; compute thermochemical H, S, G in run_freq_calc (best-effort using pyscf_thermo) and add the _HARTREE_TO_JMOL constant. Surface computed thermo info in the frequency-analysis HTML. Enhance 3D visualization handling: detect PlotlyMol/py3Dmol availability, prefer PlotlyMol for auto, add a ToggleButtons selector when both backends are present, wire the callback and pass the selected backend to display_molecule. Add tests (tests/test_freq_calc.py) covering the ThermoData dataclass, the FreqResult.thermo field, and run_freq_calc thermo population (PySCF-dependent tests marked).
Add UI elements to display the saved result directory and a collapsible full output log (pyscf.log). Track the last saved result dir (_last_result_dir), clear/hide the log and dir label when a run starts, and populate/show them after saving results via a new _show_result_log method (prefers on-disk pyscf.log but falls back to in-memory log string). Update tests to cover existence, initial hidden/collapsed state, clearing on run, and population/fallback behavior.
Add UI and logic for exporting molecular structures (XYZ, MOL, PDB). Introduces export_xyz_btn, export_mol_btn, export_pdb_btn and struct_export_status, updates the advanced accordion title to "Export", and shows RDKit-required hints when RDKit is not available (gated by a new _RDKIT_AVAILABLE flag derived from PUBCHEM_AVAILABLE). Implement handlers _on_export_xyz/_on_export_mol/_on_export_pdb, helper _export_molecule_and_label to pick the appropriate molecule/method/basis, and _molecule_to_rdkit to convert Molecule -> RDKit Mol for MOL/PDB export. Wire up button callbacks and enable/disable buttons when a molecule is loaded. Add tests covering button existence, initial state, XYZ file output, and RDKit conversion behavior.
Introduce NMR shielding calculations, MP2 support, implicit solvent (PCM), and a timing calibration suite. Key changes: - New modules: quantui/nmr_calc.py (GIAO NMR shielding → chemical shifts) and quantui/benchmarks.py (timing calibration suite + persistence). - UI updates in quantui/app.py: solvent checkbox/dropdown, calibration widgets/accordion, calibration run/stop/progress handlers, NMR result formatting, MP2 warnings, and hook-ups to new features. - Session runner (quantui/session_calc.py): MP2 post-HF correction, optional PCM solvent wrapping, XC aliasing and D3 handling, and SessionResult extended to store mp2_correlation_hartree and solvent. - Config updates (quantui/config.py): new methods (wB97X-D, CAM-B3LYP, M06-L, HSE06, PBE-D3, MP2), METHOD_INFO entries, SOLVENT_OPTIONS, and NMR reference shieldings. - calc_log cost table updated with new method costs including MP2. - README.md expanded to document new methods, calculation types, exporters, viewers, and package layout changes. - Tests updated/added to cover extended DFT list, MP2 fields, benchmarks and NMR (tests modified/added). These changes add classroom-facing features (NMR prediction, solvent models), improve time-estimation via local benchmarks, and extend method coverage (including MP2 and dispersion-corrected functionals).
Introduce IR spectrum plotting and orbital isosurface support across the UI and backend. Added quantui.ir_plot with stick and Lorentzian-broadened Plotly figures, and wired an IR Spectrum accordion + controls into the app (show/hide, mode and FWHM callbacks). Extended app UI to include an Orbital Diagram accordion (matplotlib energy-level image) and isosurface controls, and implemented rendering that generates cube files and plotly isosurfaces when MO data and PySCF are available. Capture MO arrays and PySCF atom/basis info from run_in_session and the geometry optimizer (non-fatal if extraction fails) so visualization can use in-session results. Added generate_cube_from_arrays to orbital_visualization and adjusted plotting to avoid interactive backends in tests. Updated README to document IR, NMR, orbital and timing features, and added unit tests for ir_plot, orbital visualization, and new app widgets.
Introduce UI controls for 3D viewer style and lighting: add dropdowns, state, and handlers in quantui.app and pass style/lighting through to display_molecule calls. Extend visualization_py3dmol to support a "ball+stick" style, add style and lighting constants/presets, map UI style keys to backend-specific modes, and apply PlotlyMol lighting presets when available. Add a native Windows/WSL launcher (launch-native.bat) and guidance in launch-dev.bat for using native mode during package-level development. Minor .gitignore tweak.
Introduce multiple UI and result-handling improvements: add a Post-calculate panel with on-demand orbital isosurface generation and orbitals controls (plotly interactive diagram + matplotlib fallback), and a lazy-rendering trajectory viewer with pre-rendering, export-to-HTML and a step slider. Add Frequency seed dropdown + optional pre-optimization flow and persist frequency displacements and molecule data for history replay. Improve history/Output handling: safer HTML-escaped log display, richer log line styling, load-and-reconstruct calc-specific panels (orbitals/trajectory/IR) when viewing past results, and save orbitals/trajectory to result storage. Wire up new widgets, observers and background threads to keep UI responsive. Also update notebook metadata/outputs and a test file to reflect UI changes.
Introduce quantui/log_utils.py to produce structured calculation headers and footers (machine info, timing, energies, warnings digest) and helper routines to detect CPU/RAM/GPU. Integrate this into quantui/app.py: track process CPU time, write formatted log header before a run and a footer after success or on exception (wrapped in try/except to avoid breaking behavior), and add UI styling rules to highlight the structured log sections. Also adjust the BFGS parsing branch to account for the new header styling.
Reorganize the main UI: split the previous Post-calculate/Results into distinct Results and Analysis tabs, add a completion banner with quick navigation buttons (View Results / View Analysis) and a small help [?] toggle in the top bar. Introduce results_tab_panel and analysis_tab_panel (with backward-compatible aliases results_panel and post_calc_panel) and splice the advanced accordion into the Results panel. Improve History interactions: history result cards now include View Results / View Analysis actions and per-row Analyse buttons; loading from history will populate the Analysis panels (orbitals, trajectory, IR/vibrations) where available. Add thumbnail generation (save_thumbnail) in results_storage and embed thumbnails into formatted history result cards; save_thumbnail is called when persisting results. Wire up new callbacks, update tab indices, and adjust log/result display behavior. Update tests to cover the new widgets and behaviors.
Add a dedicated 3D viewer in the Analysis tab and mirror result-panel structures there. Introduces a small viz label (shown for optimized geometries), a new _analysis_mol_output widget, and a helper _mol_from_result_dir() to reconstruct Molecule objects from saved result directories (frequency, orbitals_meta, trajectory fallback). Allow _show_result_3d() to render into the main result panel and an optional extra_output (used to mirror into Analysis). History/result-loading paths now attempt to recover geometry and display it in both tabs. Clear relevant outputs and reset the viz label on new runs. Make long-running rendering tasks non-blocking: vibrational animations and orbital isosurface generation now show an immediate loading message, run in background threads, and present clearer error messages (including missing-dependency hints). Also auto-open relevant accordions (vibrations/trajectory) so rendered content is visible immediately.
Replace FigureWidget usage with an HTML widget and render Plotly figures using plotly.io.to_html to avoid requiring FigureWidget/anywidget dependencies. The app now always creates an HTML container for the orbital diagram and attempts to populate it with Plotly HTML; if that fails, it falls back to the existing matplotlib PNG rendering path. Also update the orbital-range update path to write HTML via to_html instead of mutating a FigureWidget. Add a pytest session fixture to suppress Plotly from opening browser tabs during tests, and relax the test assertion to accept either a Plotly <div> or a matplotlib <img> in the diagram HTML.
Introduce a 1D potential energy surface (PES) scan capability. Adds a new quantui/pes_scan.py module providing PESScanResult and run_pes_scan (constrained QM optimizations using ASE + PySCF), and wires it into the app: a new "PES Scan" calc type, scan widgets (type, atom indices, range, steps), UI handlers, result formatting, Plotly-based energy plot, and reuse of the trajectory accordion. Tests updated/added: tests/test_app.py now expects six calc options and a new tests/test_pes_scan.py covers the dataclass, validation paths, widget integration and (Linux-only) integration scans. Note: PES scan is optional and requires ASE and PySCF (Linux/WSL/macOS) and Plotly for plotting; imports are guarded to keep the feature optional.
Replace use of plotly FigureWidget with an HTML widget fallback and render Plotly charts to HTML so the app no longer requires FigureWidget. Introduce theme-aware helpers (_plotly_theme_colors, _apply_plotly_theme, _rerender_plotly_theme) and apply theme colors to IR, orbital, PES and molecule Plotly figures. Ensure py3dmol background follows the selected theme and persist last PES result for re-rendering. Robustify IR update to export HTML via plotly.io and remove nil-checks/skips in tests so UI behavior is independent of FigureWidget availability.
Introduce a welcome header (SVG logo + app title/version) and a Status tab to surface system capabilities. Adds _build_welcome_header(), a _status_tab_panel, and wires them into the main UI (_build_widgets and root_tab). Adds a Getting Started help topic and updates tests to expect seven tabs. Also trims the notebook title/header in notebooks/molecule_computations.ipynb.
Introduce a persistent panel switcher for the Analysis tab that centralizes showing/hiding of result-specific panels. Adds _build_ana_switcher, _on_ana_panel_click, _select_ana_panel, _activate_ana_panel and _deactivate_all_ana_panels to manage button states, availability and accordion visibility; integrate the switcher into analysis_tab_panel and replace many direct accordion display toggles with these helpers. Default visibility for the isosurface accordion is hidden until activation. Adds comprehensive tests (TestAnaSwitcher) to cover button existence, activation/deactivation behavior and unavailable-panel UX.
Add an extended benchmark suite and UI support for a full calibration run, and make timing estimates basis-function aware. - benchmarks.py: introduce BENCHMARK_SUITE_LONG and include mode in calibration results; support short/long calibration runs and longer timeouts for long mode. - app.py: add calibration mode toggle, integrate long-suite progress/counts, display calibration label in status, add Quick Start guide, show Python/env info, add Exit button that shuts down the server, suppress Jupyter stderr styling in dark mode, tune logo/welcome layout, and improve Plotly/3D viewer theme handling (scene_bgcolor) so the 3D canvas matches dark/light themes. - calc_log.py: add basis-function lookup table and count_basis_functions(); include n_basis and n_cores in perf logs; enhance estimate_time to use basis-function efficiency and method-specific scaling exponents for more accurate predictions. - visualization_py3dmol.py: accept bgcolor param and forward it to the viewer. - __init__.py: add logging.NullHandler to avoid noisy package logging by default. These changes improve calibration accuracy, produce better time estimates using basis counts, and polish the UI/visualization behavior.
Rename the Analysis panel label from "Orbitals" to "Energies" and update related activation logic and tests. Show a user-friendly message for single-frame trajectory results. Only auto-activate Vibrational/IR panels when frequencies exist. Make n_iterations optional in calc_log and normalize SCF iteration display to show an em-dash for missing or sentinel values (None or -1). Update tests to match the new panel name and behavior.
Introduce _AnalysisContext dataclass and a _PANEL_REGISTRY to centralize population and activation of Analysis panels. Add UV-Vis and NMR accordions and implement per-panel _pop_* handlers that read from live results or saved spectra. Change several show_* helpers (IR, vibrational, orbital diagram, PES) to return booleans and no longer auto-activate panels; activation is handled by _apply_analysis_context. Refactor history/result log handlers to build an _AnalysisContext from disk (_build_history_context) and apply it via the registry. Persist NMR spectra when saving results and update tests to expect the new return values and added panels. Overall this unifies live-run and history-replay behavior and centralizes panel logic.
Introduce a local issue tracker and UI for filing session issues, plus support for clearing the session event log. - Add quantui/issue_tracker.py: lightweight SQLite-backed issues.db with public API log_issue/get_issues/clear_issues; issues are mirrored to the event log. - Add tests/tests/test_issue_tracker.py covering persistence, retrieval, mirroring, and clear semantics. - Add clear_event_log() to quantui/calc_log.py to remove event_log.jsonl without touching perf_log.jsonl or issues.db. - Integrate UI in quantui/app.py: generate a session_id, add 'Report Issue' button and overlay, submit/cancel handlers, issue context snapshot builder, log cache (clear) UI and handlers, and several log_event calls (molecule_load, history_view, pubchem_search_failed). - Update documentation (.github/copilot-instructions.md) to reflect new analysis panels, supported calculations (NMR/PES), IR plotting, tests, dependencies, and the panel-registry pattern. These changes enable users to file reproducible issue reports from the app and to clear the transient event log while preserving performance records and stored issues.
UX, data and robustness improvements for frequency/IR handling and save/log flows. - Remove "(local)" from app title. - Update analysis registry: IR Spectrum and Energies panels enabled by default and Trajectory reordered. - _show_ir_spectrum now only fails if frequencies are missing; when intensities are unavailable it falls back to unit weights so the stick plot still renders and the accordion title reflects that. A flag tracks whether real intensities were present and the IR plot y-axis label is adjusted accordingly. - Expose y-axis title in plot_ir_spectrum (new yaxis_title parameter) and use it when building the Plotly figure. - Persist MO/orbital data for Frequency results: run_freq_calc now attempts a best-effort extraction of MO energies, occupancies and PySCF molecule atom/basis and these fields were added to the FreqResult. - Save logic now also saves orbitals for Frequency result types. - Add non-fatal logging for panel/show/save exceptions via calc_log.log_event to aid debugging without interrupting user flow. These changes make IR visualization more resilient when intensities are missing, preserve orbital data from frequency runs, and improve observability of errors during panel population and result saving.
Rebrand the project from "QuantUI-local" to "QuantUI". This changeset updates package metadata (pyproject.toml name), conda environment name, Apptainer definition filename and references (apptainer/quantui.def and quantui.sif), build script variables, docs (README, docs/index.html, apptainer/README.md), launch .bat scripts, notebook kernelspecs and in-notebook messages, module docstrings/help content, and tests. No behavioral changes were made — these are naming/path and documentation updates to align the repo with the "QuantUI" name.
Add favicon assets and reference them from docs/index.html. Adds docs/logo.ico and an animated docs/logo.svg (orbital rings, glow/halo filters, and prefers-reduced-motion support) and inserts <link rel="icon"> tags into the docs HTML so browsers can load the new icons.
Handle PySCF 2.x return types and complex frequencies in freq_calc: coerce complex imaginary-mode frequencies to real, and accept (value, unit) tuples from pyscf_thermo. Simplify NMR handling in nmr_calc by using mf.NMR() and removing the direct import of pyscf.prop.nmr. Add a spin parameter to generate_cube_from_arrays and pass it to gto.M so open-shell MOs can be visualized. Fix PES scan logic to skip BFGS for diatomic bond scans (workaround FixInternals off-by-one on 2-atom systems) and import contextlib where needed. Update tests to supply the new spin argument.
Add support for the separate pyscf-properties package and make frequency/NMR calculations robust to PySCF API changes. Updates: - local-setup/environment.yml & pyproject.toml: add pyscf-properties and comments explaining NMR moved out of main pyscf in PySCF 2.x. - quantui/freq_calc.py: handle thermo() signature differences (optional pressure arg), normalize returned values (tuples, numpy scalars), accept multiple possible dict keys for H, S and ZPE, raise a clear KeyError when H/S missing, and log thermo failures instead of silently passing. - quantui/nmr_calc.py: detect missing mf.NMR() (AttributeError) and raise a user-friendly ImportError directing users to install pyscf-properties. These changes improve compatibility with PySCF 2.x and provide clearer errors and guidance when optional components are unavailable.
Update code and packaging to be compatible with PySCF 2.x API changes. In nmr_calc.py import pyscf.prop.nmr and construct the appropriate NMR object (RHF/UHF/RKS/UKS) based on method/mol spin, with a clearer ImportError when the module is missing and a RuntimeError on kernel failure. In freq_calc.py accept the new "H_tot"/"S_tot" keys (falling back to older names), adjust key search order, and include sorted thermo keys in the KeyError message for clearer diagnostics. Remove the now-unneeded pyscf-properties entry from pyproject and environment.yml and adjust related install comments.
Add pyscf-properties to the conda environment and the pyscf optional dependencies in pyproject.toml (pyscf.prop for NMR/other properties was moved out of PySCF core in v2.0). Also update the environment.yml conda install note and add '/temp - untracked/' to .gitignore.
Add a pytest xfail marker for NMR integration tests due to a reshape bug in pyscf-properties 0.1.0 (nmr/rhf.py) that is incompatible with pyscf>=2.13.0. The marker documents the issue, cites the upstream fix on properties master (commit 4eee5a4) and suggests temporarily installing the fixed repo with pip install git+https://github.com/pyscf/properties.git. Apply the @_nmr_xfail decorator to the slowed PySCF NMR tests so CI will xfail until a fixed PyPI release is available.
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.
This pull request makes major updates to the
.github/copilot-instructions.mdfile to reflect the expanded features, new modules, and updated architecture of the QuantUI project. The documentation now describes the new Analysis tab panel registry pattern, new calculation types (NMR, PES scan), expanded result schema, and updated project structure. It also details best practices for panel population, result saving, and the new performance logging API.Key documentation and architecture updates:
Project structure and naming
QuantUI-localtoQuantUIand updated directory and file names (e.g.,apptainer/quantui.definstead ofquantui-local.def, package name inpyproject.toml) to match the new project naming convention. [1] [2]nmr_calc.py,pes_scan.py,ir_plot.py) and increased test count, reflecting new features.Analysis tab and panel registry
_pop_xxx). This is now the core architecture for analysis panel management._AnalysisContextdataclass,_PANEL_REGISTRY, and the process for adding new panels.Supported calculations and results schema
result.jsonschema to include new fields for NMR and PES scan results, and clarified schema rules. [1] [2]Performance logging and API
log_calculation, etc.), additional logged fields, and the improved estimation strategy.Best practices and usage
These changes ensure that the documentation accurately reflects the current architecture, features, and best practices for developing and maintaining QuantUI.