Updates#12
Merged
Merged
Conversation
Update environment.yml comments to recommend `conda install -c conda-forge pyscf` (without pyscf-properties) for Linux/WSL and note that pyscf-properties is pip-only and gets installed automatically via the environment. This avoids suggesting a conda package that doesn't exist and clarifies installation behavior.
Add comprehensive end-to-end tests for quantui/results_storage.py. The new tests (tests/test_results_storage.py) exercise save_result/load_result (JSON contents, spectra, pyscf log handling, directory naming, defaults and uniqueness), list_results (filtering and newest-first sorting), save_orbitals/load_orbitals (orbitals.npz, orbitals_meta.json, and missing-file handling), save_trajectory/load_trajectory (trajectory.json roundtrip, molecule atoms, energy handling), and save_thumbnail (PNG generation across calc types). Tests use pytest tmp_path fixtures and do not mock the storage layer.
Add comprehensive integration tests for the frequency-analysis history roundtrip (tests/test_freq_analysis_history.py) covering saving spectra, history context reconstruction, panel activation, and end-to-end _do_run behavior. Adjust quantui/app.py to stop requiring ir_intensities when validating saved IR spectra (now only checks frequencies, displacements and molecule atoms), allowing history/panel activation even if intensities are missing.
launch-native.bat: clear quantui/__pycache__ on every start and set PYTHONDONTWRITEBYTECODE=1 to avoid stale .pyc being loaded under WSL/DrvFs; added explanatory comments. quantui/app.py: harden vibrational/IR rendering paths with additional try/except handlers and non-failing logging (calls to calc_log where available). Replace unsafe with self.vib_output context usage with append_display_data for thread-safety, convert Plotly animation to HTML and append it (avoids displaying Plotly from background threads), and add vib_render_start/done/error logging. Also move _apply_analysis_context to after refreshing the results browser to avoid a race that deactivates panels.
Plotly charts inside hidden accordions can render with zero dimensions and appear blank. This change triggers an IR figure re-render when the "IR Spectrum" panel is made visible (if IR data exists), using the current IR mode and FWHM slider values so the chart paints correctly into the visible container.
Install pyscf-properties from the GitHub repo until a fixed PyPI release is available, because the PyPI 0.1.0 package is missing the infrared module and has an NMR reshape bug. Update freq_calc.py to prefer pyscf.prop.infrared.proc_hessian_ when present so mo1_grad/h1ao_grad can be reused for IR intensities (with a fallback to Hessian.kernel()), and compute IR intensities via the infrared helper classes with warnings on failure. Add integration tests for IR intensities (H2O/RHF) and remove the earlier xfail workaround in the NMR tests now that the package is sourced from GitHub.
Add a _last_calc_type attribute and persist it in the saved context; set it when a run completes to track the type of the last calculation. Update multiple plotly.io.to_html calls to include config={"responsive": True} so the generated HTML is responsive. Improve recent_events selection by fetching a larger window (60), ensuring the 10 most recent non-startup events plus the 5 most recent events of any type are always included (to avoid startup bursts drowning out calculation events), and then filtering the original event list to preserve ordering.
Save pre-optimization geometry trajectories for Frequency runs to disk and load them during history replay. save_trajectory and load_trajectory now accept a filename (defaulting to trajectory.json) so preopt_trajectory.json can be written/read; QuantUIApp writes preopt_trajectory.json when a Frequency run included a pre-opt and will load it for non-live history contexts (with error logging on failure). Tests updated to verify missing preopt file keeps the Trajectory panel inactive and that a saved preopt file activates it on history load.
Replace molecule.to_pyscf_format() with an explicit construction of the PySCF atom list (atom, [float coords]) in quantui/session_calc.py to ensure coordinates are proper floats and avoid depending on the Molecule helper. Add integration tests (tests/test_sp_analysis_history.py) that exercise single-point result storage and orbitals, history context reconstruction, analysis panel activation, and an end-to-end PySCF-gated run to validate the history replay path.
Introduce integration tests for analysis history (geometry optimisation, NMR, PES scan, TD-DFT) and update app behavior and docs. README: document PES Scan and TD-DFT UV-Vis support, add pes_scan entry and update test suite count. quantui/app.py: reconstruct PES scan results from saved spectra when live_result is absent (compute relative energies in kcal, build scan labels) and persist pes_scan spectra on scan runs. quantui/tddft_calc.py: select TDHF when using_hf is set, otherwise use TDDFT. Adds four new test modules under tests/ to validate history roundtrips and panel activation.
Two bugs caused 30 failures on windows-latest: 1. save_result used datetime microseconds for unique directory names, butWindows timer resolution can return the same microsecond for back-to-back calls. Added a collision counter (_1, _2, ...) suffix so directories are always unique regardless of platform clock granularity. 2. PySCF now ships Windows wheels and imports successfully on the CI runner even though actual quantum calculations fail at runtime. The DoRunEndToEnd test classes were skipif(not _PYSCF_AVAILABLE), but import succeeding ≠ calculations working. Added sys.platform == 'win32' to the skipif condition so these tests are skipped on native Windows unconditionally.
Pin pyscf to <=2.13.0 in pyproject.toml and make frequency calculation robust to pyscf API changes. freq_calc.py now prefers proc_hessian_ (when available), falls back to Infrared.kernel(), and finally to hess_obj.kernel(); it captures IR intensities from either path, validates counts against frequencies, and logs failures. Adds a small helper to normalize/store IR intensities and improved exception handling to maintain compatibility across pyscf versions.
Update pyproject to require pyscf < 2.13.0 (replace <=2.13.0 with <2.13.0). Refactor quantui/freq_calc.py to remove legacy proc_hessian_ compatibility code and related temporaries, simplify IR computation to use pyscf.prop.infrared.Infrared.kernel() with a fallback to hess_obj.kernel(), and remove an unused typing.Any import. This streamlines the Hessian/IR code path to match newer pyscf/pyscf-properties APIs while preserving IR intensity capture and logging failures.
Require pyscf>=2.13.0 and remove the pyscf-properties package from optional dependencies. PySCF 2.13+ restores NMR and pyscf.prop.infrared to the core, while pyscf-properties 0.1.0 overwrites core NMR with a CPHF-incompatible implementation and lacks infrared support; the comments were updated to document this.
Clarify PySCF dependency notes in pyproject.toml and add pyscf-properties to the pyscf optional deps. In quantui/nmr_calc.py, prefer importing the core pyscf.nmr module first and only fall back to pyscf.prop.nmr (from pyscf-properties) to avoid incompatible CPHF interfaces and runtime reshape errors. Improved ImportError handling/messages to guide installing a compatible PySCF (>=2.13.0).
Replace use of pyscf.prop.infrared fallback: always compute Hessian via hess_obj.kernel() and add a numerical IR intensity path that computes dipole derivatives by finite-difference displacements of each atom, projects onto normal modes and converts to km/mol. Improve robustness by restoring molecular geometry and verbosity after displacements and updating the warning message for failed IR intensity computation. In NMR code, prefer pyscf.prop.nmr (pyscf-properties) and update the install hint accordingly. Apply runtime patches for pyscf-properties compatibility: fix gen_vind to reshape with -1 (avoids reshape errors with smaller Krylov batches) and patch get_vxc_giao to round blksize down to a BLKSIZE multiple (avoids block_loop asserts). These changes improve compatibility with PySCF/pyscf-properties versions and prevent runtime reshape/blocksize errors.
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 introduces several new features and robustness improvements to the QuantUI application, focusing on enhanced analysis capabilities, improved reliability in rendering visualizations, and better diagnostic logging. Notably, it adds support for 1D potential energy surface (PES) scans, ensures more robust and responsive visualization rendering (especially for Plotly charts and vibrational animations), and improves reproducibility and debugging through better test coverage, cache handling, and error logging.
New Features and Functionality:
pes_scan.pymodule, and UI support for displaying PES scan results and energy profiles. [1] [2] [3] [4]Visualization and UI Improvements:
responsiveconfig for better rendering in dynamic layouts, and IR panels are re-rendered when made visible to fix blank chart issues. [1] [2] [3] [4] [5] [6] [7]append_display_data, and all error/status messages in the vibrational panel use this method for reliability. [1] [2] [3] [4]Robustness and Error Handling:
Developer Experience and Environment:
__pycache__and disables bytecode generation to prevent stale Python caches in WSL2 environments.pyscf-propertiesfrom the latest GitHub source to include recent bugfixes and missing modules.These changes collectively improve the application's scientific capabilities, user experience, and maintainability.