Updates#16
Merged
Merged
Conversation
Eliminate visible flicker on IR plot updates (BUG.9) by rendering Plotly HTML via a single atomic outputs assignment in _set_html_output so scripts execute and no intermediate empty state is exposed. Also prevent re-render storms by setting the IR FWHM slider continuous_update=False and give the IR Output a min_height of 300px to avoid container collapse between renders. Tests were added to guard these behaviors and validate the atomic outputs swap. Minor docs adjustments clarify repository scope vs cluster/SLURM features and update the scope table in .github/copilot-instructions.md; README wording about the cluster version was removed.
Replace direct display(viz) rendering with a renderer that returns self-contained HTML and perform atomic Output swaps to avoid blank/viewer-regression bugs. Added render_molecule_html (visualization_py3dmol.py) with info/fallback HTML and robust HTML serialization of py3dmol/plotly objects; updated show_result_3d (app_visualization.py) to call render_html_fn and use app._set_html_output; adjusted imports in app.py. Added tests to verify single-entry atomic outputs and no accumulation on repeated renders.
When a molecule is loaded, refresh the Frequency seed-geometry dropdown and limit entries to prior geometry optimisations whose stored formula matches the active molecule. app.py now triggers a best-effort _refresh_freq_seed_options call when setting the molecule (errors are caught so loading won't be blocked). refresh_freq_seed_options in app_runflow.py was updated to detect the current molecule formula and skip non-matching geo-opt results; behaviour remains unfiltered if no molecule is loaded. Added unit tests (TestFreqSeedDropdownFilter) to verify unfiltered listing with no molecule, formula-based filtering, and auto-refresh on molecule set; also added small docstring and necessary test imports.
Add a feature to export vibrational modes as self-contained HTML animations. UI: new Export Animation button and status widget are added to the Vibrational panel (quantui/app_builders.py) and wired to a new handler (_on_vib_export_animation) in quantui/app.py that validates state, selects backend, builds HTML, sanitises filenames with a timestamp, writes to the results directory, and updates status messages (including error and success logging). Visualization: implement build_vib_export_html in quantui/app_visualization.py which prefers plotlymol3d (producing an embedded Plotly animation) and falls back to py3Dmol (emitting a multi-frame py3Dmol viewer) while raising clear errors if no backend is available. Tests: add tests covering button/status existence, missing-state error, py3Dmol fallback export writing an HTML file, and no-backend error (tests/test_app.py).
Introduce seed-geometry support for UV-Vis (TD-DFT) mirroring the existing Frequency seed workflow. Changes: - quantui/app_builders.py: add TD-DFT seed dropdown, refresh button and status note widgets. - quantui/app_runflow.py: factor seed listing into a shared _refresh_seed_options helper; add refresh_tddft_seed_options and on_tddft_seed_changed handlers; wire the TD-DFT seed dropdown into the calc-type UI and ensure formula-filtered listings. - quantui/app.py: import and wire new runflow handlers, observe the TD-DFT seed widget, add refresh calls during molecule set, and extend the UV-Vis run sequence to load a chosen seed geometry and optionally run a geometry pre-optimization before the TD-DFT step. - tests/test_app.py: add comprehensive tests (TestTDDFTSeedDropdown) verifying widget existence, UI placement, filtering by formula, pre-opt disabling when a seed is chosen, and auto-refresh on molecule set. Also add defensive try/except around seed refresh during molecule load and minor comment/formatting updates. The change keeps behavior consistent with Frequency seeds: selecting a saved geometry disables the global pre-opt checkbox and shows a confirmation note.
Fix BUG.8 where pop_isosurface could raise AttributeError if orbital fields were never set. Initialize _last_orb_info, _last_orb_mo_coeff, _last_orb_mol_atom and _last_orb_mol_basis in QuantUIApp.__init__, reset them in apply_analysis_context, and make pop_isosurface read them defensively via getattr. Add regression tests to ensure fields exist on a fresh app and that apply_analysis_context clears prior orbital state on replay.
Update UI and help copy to use 'energy-level' / 'levels' instead of 'orbital(s)' for clearer terminology. Changed labels and help text in quantui/app_builders.py and quantui/help_content.py (e.g. 'Orbitals shown:' -> 'Levels shown:', and 'orbital diagrams' -> 'energy-level diagrams').
Improve UX for loading past results by providing immediate visual feedback and disabling source buttons while a history load is in-flight. Introduce helper functions (_begin_history_load/_end_history_load) to reliably start/stop the toolbar activity indicator and toggle provided source button widgets (best-effort, tolerant of errors), and propagate a new optional source_btns parameter through history loaders and callers. Ensure activity indicator and buttons are restored in a finally block so state is recovered even on exceptions. Update runflow and app wrappers to pass source buttons, and add tests (HIST.1 and HIST.5) that verify activity counting, button disable/restore behavior, exception safety, and history dropdown calc-type badges.
Add strict atom-order + RMSD-based filtering for geometry-opt seed dropdowns and a per-result cache for parsed starting geometries. Implements _load_starting_geometry to read trajectory.json, _geometries_match (default RMSD tolerance 0.1 Å), and updates _refresh_seed_options to apply formula pre-filtering then atom+coord checks (falling back to formula-only on malformed/missing trajectory.json). Includes tests for inclusion/exclusion, atom-order mismatch, malformed trajectories, and cache hit behavior.
Introduce a _LoadTimer utility to collect per-stage timings for history-load operations and emit a single "history_load_timing" telemetry event. Integrate the timer into history_load_results and history_load_analysis, wrapping key sub-stages (formatting, pyscf.log read, context build, molecule reconstruction, 3D rendering, nav updates, etc.), tracking overall status (ok/error) and ensuring emit failures are swallowed so telemetry cannot block loads. Add tests (TestHistoryHardeningHist2) to verify stage recording, event payload keys, single-event emission, error-status reporting, and that log_event failures do not propagate.
Introduce quantui/c_stderr.py: a POSIX-only context manager capture_c_stderr(relay_stream) that redirects OS fd-2 to a temp file during a block and relays decoded bytes (utf-8, replace errors) to a given text stream on exit (no-op on Windows). Integrate this into major calculation entrypoints so C-extension diagnostics from libcint/BLAS/LAPACK/etc. are routed to the normal progress/log stream instead of Jupyter/Voilà red-text: run_freq_calc, run_tddft_calc, run_nmr_calc, run_session_calc, optimize_geometry, and run_pes_scan. Small refactors split heavy functions into inner _*_body helpers to keep the stderr-wrapper concise. Add comprehensive tests in tests/test_c_stderr.py covering POSIX behavior, Windows no-op, nested contexts, error handling, and byte-decoding. Also update a few typing imports to include Any.
Wire CCSD and CCSD(T) into the codebase: add them to SUPPORTED_METHODS and METHOD_INFO (with user-facing descriptions and scaling warnings), add cost entries to the method-cost table, and extend SessionResult with ccsd_correlation_hartree and ccsd_t_correction_hartree fields. Implement RHF reference handling and post-SCF CCSD / CCSD(T) hooks in session_calc (runs pyscf.cc.CCSD, records correlation and (T) correction, updates energy, and raises clear errors on failure). Update the HTML formatter to render an HF reference row plus CCSD correlation and optional (T) triples rows so users see the breakdown. Adjust tests to use a fictional "NONEXISTENT" method for unsupported-method checks and add a suite of unit and PySCF-gated tests verifying the new CCSD/CCSD(T) scaffolding, formatting, and runtime behavior.
Add optional GPU offload integration using gpu4pyscf/cupy and wire it into the session and UI. pyproject.toml: add a new "gpu" extra for gpu4pyscf and cupy. New module quantui/gpu_offload.py: provides is_gpu_available() (cached, non-raising probe) and try_to_gpu() (attempts mf.to_gpu(), skips unsupported methods and falls back silently). session_calc.py: add gpu_used/gpu_name fields to SessionResult, attempt GPU migration before running SCF, and propagate the outcome; emit a small progress message when offload is active. app_formatters.py: show a Compute device row in result cards (CPU vs GPU and device name). app_builders.py: show GPU offload status in the Status tab using the same detection helper. Add comprehensive tests in tests/test_gpu_offload.py covering detection, caching, try_to_gpu behavior, SessionResult fields, and result/status UI strings. The runtime opt-out QUANTUI_DISABLE_GPU=1 forces CPU even when GPU is available.
Add tests across frequency, geometry-opt, and single-point history replay paths to ensure UI analysis panels behave correctly when orbitals.npz is present or absent. For frequency tests: import save_orbitals, include two virtual MOs in the synthetic result to avoid a no-LUMO edge case, and add tests that Energies activates only when orbitals are saved. For geo-opt and SP tests: add regression tests that replaying saved results without orbitals does not emit ana_panel_error (capture quantui.calc_log.log_event) and that Trajectory/other panels still behave appropriately while Energies/Isosurface remain unavailable.
Introduce an opt-in parallel path for the numerical IR-intensity displacement loop. Adds quantui/freq_ir_workers.py implementing ProcessPoolExecutor workers (init_worker, run_displaced_scf) and heuristics (parallel_enabled_for_run, pick_worker_count, threads_per_worker, _truthy). Integrates the parallel execution in quantui/freq_calc.py: when enabled (QUANTUI_FREQ_PARALLEL), no GPU, and core/displacement thresholds met, displaced SCFs are dispatched to worker processes using a temporary pickle for the shared dm0; otherwise the existing serial path is used. Includes tests (tests/test_freq_ir_workers.py) for gate logic and helper heuristics. The parallel path preserves GPU veto and falls back on errors to keep behavior safe.
Add per-panel "Copy data" buttons and handlers to export Plotly panel data as CSV and attempt a browser clipboard copy. Implements _fig_to_csv to serialize per-trace (x,y) pairs, _copy_plot_data to write a timestamped CSV into the results directory and emit a JS clipboard write, and per-panel _on_*_copy_data handlers (IR/UV/ORB/PES). Wires the new buttons into the UI builder and updates status messaging for success/error cases. Includes tests verifying CSV output, round-tripping via csv.reader, presence of buttons, and file writing/status behavior.
Write a Molden-format companion file for results (orbitals and/or vibrations). Adds save_molden and _append_molden_vibrations helpers to quantui/results_storage.py that build a pyscf.Mole, emit MO blocks via pyscf.tools.molden when available, and append [FREQ]/[FR-COORD]/[FR-NORM-COORD] blocks for vibrational animation. Integrates a best-effort call into quantui/app.py so Single Point / Geometry Opt / Frequency results produce a result.molden alongside saved data; failures are swallowed so calculations don't fail. Includes tests/tests_export_molden.py with platform-independent contract tests and PySCF-gated round-trip and vibration checks.
Export multi-frame trajectories in external-tool-friendly formats and wire them into the save flow. Adds save_trajectory_xyz (extended-XYZ with per-frame energy comments) and save_trajectory_ase (ASE .traj writer that attaches energies via SinglePointCalculator with Hartree→eV conversion) to quantui/results_storage.py. quantui/app.py now attempts to write these additional files after saving a trajectory (best-effort; exceptions are swallowed so the main calculation isn't affected). Adds tests/tests_export_trajectories.py covering XYZ output, ASE .traj round-trip and energy attachment, handling of empty frames, and graceful behavior when ASE is unavailable.
Implement EXPORT.5: allow copying the last-generated orbital cube to the top-level result folder and zipping an entire result directory for sharing. Adds results_storage.export_cube (sanitizes label, overwrites dest, returns None on error) and results_storage.export_result_bundle (creates a zip sibling to the result dir). Wire UI: new Export cube and Export bundle buttons, handlers in QuantUIApp, track _last_cube_path/_last_cube_orbital from isosurface rendering, and enable buttons when appropriate (after generate/save/load). Add tests covering helper behavior and basic UI wiring (tests/test_export_cube_and_bundle.py). Changes touch app.py, app_builders.py, app_exports.py, app_history.py, app_visualization.py, results_storage.py and add tests.
Introduce a small command-line toolkit and analytics dashboard plus documentation and runtime fixes: - Add quantui CLI (quantui.cli) with subcommands: `log tail`, `gpu check`, and `analytics build` and ship an entry point in pyproject.toml. - Add analytics module (quantui.analytics) that builds a self-contained HTML dashboard from perf_log.jsonl (overview cards, GPU vs CPU speedup table, usage charts, timeline). - Expand README with optional NVIDIA GPU acceleration instructions and a short Command-line toolkit section; add docs/CLI.md with full CLI reference. - Record GPU metadata in perf logs: add gpu_used/gpu_name to calc_log.log_calculation so analytics can compute speedups. - App robustness: replace ad-hoc viz Output renders with an atomic _refresh_calc_mol_viewer to fix viewer update/logging races; wrap geometry pre-optimisation calls in try/except to avoid crashing whole calculations on numerical failures and log fallbacks. - Add tests scaffolding for analytics/CLI and bug regressions (tests/*). These changes enable offline reporting, easier GPU verification, and improve stability and UX around molecule rendering and pre-optimisation failures.
Introduce WSL-aware opening logic by adding _is_wsl and _open_in_browser, and update _cmd_analytics_build to use it (falling back gracefully if open fails). Update docs to describe WSL behavior and recommend wslu/explorer.exe as fallbacks. Refactor tests with a _seed_perf_log helper and add TestWslAwareOpener covering wslview/explorer.exe ordering, failure cases, and the non-WSL webbrowser path.
Replace many silent broad-except/pass patterns with logged diagnostics and explicit noqa justifications across calculation modules, and add a CI lint test to prevent new silent broad-excepts in high-risk files. Changes: - quantui/freq_calc.py, tddft_calc.py, session_calc.py, optimizer.py, nmr_calc.py, gpu_offload.py: import/create module loggers and replace bare except/pass blocks with logger.debug/logger.warning calls (or add ``# noqa: BLE001`` where the silence is explicitly justified). Add a telemetry log_event call in session_calc when MO extraction fails to surface regressions. Improve messaging for GPU import/probe and mf.to_gpu() fallbacks. - quantui/gpu_offload.py: log non-ImportError import failures, cupy probe errors, and GPU offload migration failures so offload fallbacks are diagnosable. - tests/test_code_quality.py: introduce _HIGH_RISK_FILES set and add test_no_silent_broad_except_in_high_risk_files to fail CI if a new broad-except+pass appears in a high-risk file without a nearby log call or a ``# noqa: BLE001`` justification. Also add a meta-guard test to ensure the new check flags a known-bad example. Rationale: avoid silently swallowing exceptions that can produce subtly incorrect results (bug class causing missing MO arrays / energies), and make it easier to diagnose offload/import issues via logs. The tests enforce the error-surfacing convention for critical code paths.
Introduce a four-tier calibration flow and make calibration robust and observable. UI: replace short/long toggle with a 4-option tier selector and update panel copy/styles. Benchmarks: add tier3/tier4 suites (geometry optimizations, frequency, MP2/CCSD anchors), keep tier1/tier2 aliases, and provide _normalize_entry and mode→suite mapping. Runflow: wrap calibration in activity begin/end, add per-tier timeout map, show live per-step status lines, and predict GPU usage for estimates. Calibration runner: run each step in a subprocess worker that appends to a per-run log (tail-polled for live updates), allow immediate termination on Stop, persist calibration.json after every step, and record calc_type in results. Calc_log: add IQR outlier filtering, coefficient-of-variation confidence labeling, GPU-aware candidate partitioning with graceful fallback, and use filtered pools when computing medians. Misc: small config tweaks for XC aliasing / D3 handling and add new tests for calibration/estimation behavior.
Rename and polish user-facing strings and behavior across the app: "Status" tab → "System Settings"; user-facing "Pre-optimisation" wording changed to "Geometry optimization" in app, analysis and saved-result notes (filenames kept for back-compat). Update Help toggle from "?" to a fuller "Help" button with an icon and wider layout. Benchmarks: always use multiprocessing spawn context to avoid fork/CUDA collisions, extend progress_cb wrapper to accept live_message and step kwargs (with fallbacks), surface richer worker-exit diagnostics, and pass the full BenchmarkStep to final progress calls. Increase history thumbnail resolution (larger figsize and dpi) for crisper text. Update tests to match the new wording and verify the new pre-opt exception guard.
Port inline SVG/CSS animations into the welcome header so the QuantUI orbital rings spin (with prefers-reduced-motion honored) and replace static rotate transforms with animated classes. Fix calibration runflow bugs and improve UX: use _MODE_TO_SUITE to select the correct benchmark suite, keep the activity badge active during calibration, and add incremental result rendering (new _cal_status_text and _cal_table_html helpers) so rows accumulate as steps finish. Show an in-flight "running" row, preserve a transparent live-message line to avoid accordion height flicker, re-render final table from canonical results, and include several related comment and UI tweaks.
Update refresh_results_browser to prepend an explicit "(select a calculation to view)" placeholder to the History dropdown so ipywidgets doesn't auto-select the most-recent result on render. This clarifies that no calculation is loaded until the user clicks "View Results"/"View Analysis". Preserve existing behavior of keeping a previously-picked real result across refreshes, and fall back to the "(no saved results)" message when every load_result call fails (i.e. when the placeholder would be the only option).
Save calibration runs as regular result dirs and improve calibration control/telemetry. Adds prediction_log (log_prediction/get_prediction_history) and a dashboard "Prediction accuracy" section; the app captures pre-run estimator outputs and persists predicted vs actual pairs. Introduces a Skip button and skip_event to abandon a single long-running calibration step (default per-step timeout removed; timeout becomes optional). Calibration worker now tees PySCF output to an in-memory buffer and saves each step via _save_calibration_step (which uses save_result(extras={...}) to tag results with calibration_run_id); BenchmarkStep gains result_dir. GPU unsupported methods list expanded to avoid unstable GPU runs for MP2/CCSD/CCSD(T). Adds _TeeStream helper and tests covering save_result extras, _TeeStream, and _save_calibration_step plus related behavior. Misc: UI wiring for skip button, inline dashboard integration, and resilient best-effort logging throughout.
Update docs to advertise GPU support, CC methods, exports, CLI and new estimator/analytics features. Replace the welcome banner with a logo served via widgets.Image + text HBox (works around Voilà/Jupyter HTML sanitizer and preserves SVG animations), add a layout_fn parameter and wire the new header into app.py, and hide the logo on shutdown for proper centering. Tweak several ipywidgets Checkboxes/Dropdowns to remove the default description gutter (style.description_width='initial' and indent=False) to avoid unwanted indentation and horizontal scrollbars. Adjust shutdown HTML sizing. Update tests to expect the renamed "System Settings" tab and to skip a new dropdown placeholder when asserting result badges.
Reorganize UI and add richer file preview handlers. The PySCF output Log tab is now an Accordion inside the History tab (root tabs renumbered); _goto_output_tab now navigates to History and expands the log accordion. Calibration and performance accordions are moved to the System Settings tab. _preview_file_path gained specialized handlers for SVG, JSON, CSV, HTML (sandboxed iframe), cube (header + metadata), 3D structures (.xyz/.mol/.pdb via py3Dmol when available) and .molden; handlers cap reads and fall back to the generic text preview on error. Tests updated to expect seven root tabs and tab title changes, and a new test suite tests/test_polish_file_preview.py exercises the file-preview dispatch and safety checks.
UX and visualization refinements across the app: - Auto-preview files when selected (folders still require Open) and update files status hints to guide users. - Remove the quick-start guide from the status panel to simplify the layout. - Tweak IR and UV-Vis plotting: IR sticks now include marker dots with hover templates for exact frequency/intensity; UV-Vis uses a stable x-range across modes to avoid axis shifting and sets the x-axis range explicitly. - Adjust plot control widgets: clarify Line width labels and formats, expand description widths and layout sizes, add continuous_update=False to the UV slider to reduce re-render storms, and set min_height for the TDDFT output to prevent brief collapse during atomic output swaps. - When loading history items, also build and apply the Analysis tab context and render the molecular view so Results and Analysis stay in sync. - Update tests to reflect IR trace split (lines + markers) and to add file-preview-on-select behavior tests. These changes are targeted at improving discoverability, preventing UI flicker/scrolling during control interactions, and keeping different tabs consistent when navigating history.
Add EST.2 frequency cost-model and EST.5 cross-device probe support. - quantui/calc_log.py: introduce Hessian multipliers and _estimate_frequency_cost(), which decomposes a frequency estimate into an SP anchor (via estimate_time), a Hessian multiplier, and a 6N IR-intensity term with optional parallel gating. estimate_time now falls back to the cost model for calc_type="frequency" when direct freq history is absent. - quantui/benchmarks.py: add _CROSS_DEVICE_PROBE_LABELS and _build_execution_plan() to expand selected tier-3/4 entries into GPU/CPU pairs (CPU variants carry force_cpu=True and are labelled with [CPU]/[GPU]). Pass force_cpu to _calibration_worker which sets QUANTUI_DISABLE_GPU=1 early when forcing CPU. Parent probes GPU availability and stores expected_steps in CalibrationResult so progress counters remain correct (0 falls back to suite size for backwards compatibility). - tests/: add integration and unit tests for the frequency cost model, cross-device probe behavior, and end-to-end M-EST boundaries (three new test files). These changes enable SP-anchored frequency estimates and let a single GPU-host calibration produce paired CPU/GPU measurements for analytics without requiring separate reruns.
Add a new user guide (docs/IMPORTING-INTO-AVOGADRO.md) that documents how to open QuantUI result artifacts in Avogadro, IQmol, Jmol, VMD, ASE, Excel/pandas, and bundle exports. Update README.md to advertise the new guide and add a link in docs/index.html. Add an "external_tools" help topic to quantui/help_content.py with a compact table and quick paths. Update tests/test_calc_log.py to expand the docstring and adjust assertions to reflect the EST.2 cost-model fallback behavior (legacy untyped SP records no longer produce direct freq matches but do trigger a structured fallback estimate).
Open generated calculation scripts with explicit UTF-8 encoding to avoid platform-dependent defaults. Update benchmark test to patch the runtime mapping (_MODE_TO_SUITE["tier1"]) instead of the original BENCHMARK_SUITE alias, and adjust assertions to ignore transient "running" heartbeats so only terminal per-step callbacks are counted.
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.
No description provided.