Repository navigation
Fix the High findings from the 2026-11-10 audit - #169
Merged
Merged
Conversation
When Sella's inner loop failed, the atoms were left at an inner-iteration geometry nothing had recorded. If the steepest descent found that point already converged it took no step, so the branch ended on the previous IRC point while reporting "reached a minimum": wrong end structure, end energy and barriers, with no warning (NH3 inversion, RHF/STO-3G: end fmax 0.82 eV/A, barrier 44.3 instead of 46.6 kJ/mol). Record that geometry before minimizing, and drop BFGS's repeated first frame at the index where BFGS started rather than assuming the descent took no step (it used to delete the first real descent point instead). tests/test_irc_endpoint.py drives run_irc with a harmonic stand-in for PySCF and Sella; the at-minimum case fails on the old code. Contributions: - Claude (Opus 5.5): code edits, review, and conceptual discussion - Jonathan Schultz: overall vision, planning, review, and orchestration Co-authored-by: Jonathan Schultz <nccu-schultz-lab@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…PC-1) sacct reports a cancelled job as "CANCELLED by <uid>". The parser kept the whole string and every consumer compared against bare state names, so a cancelled job fell through to "submitted": Cancel reported failure after a successful scancel, and once the job left squeue the record stayed active for good, holding one of the two job slots. Preempted, boot-failed and deadline-killed jobs did the same. - normalize_slurm_state() reduces sacct/squeue states to the bare name (drops "by <uid>" and a trailing "+"); used by the sacct parser and both squeue paths. - PREEMPTED, BOOT_FAIL, DEADLINE, REVOKED are terminal (error); COMPLETING/SUSPENDED map to running and REQUEUED to pending instead of "submitted". - The cancel confirmation loop waits through non-final states instead of giving up on the first one that is not PENDING/RUNNING. - The mock sacct prints "CANCELLED by <uid>" like real Slurm, so the existing cancel test now exercises the real string. New tests fail on the old code; still to confirm on NCShare. Contributions: - Claude (Opus 5.5): code edits, review, and conceptual discussion - Jonathan Schultz: overall vision, planning, review, and orchestration Co-authored-by: Jonathan Schultz <nccu-schultz-lab@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…APP-6) APP-4: on_run_clicked never checked _calc_running, and the worker thread set it (and disabled Run) only after it started, so a double-click started two runs sharing the cancel flag, live log and checkpoint directory; loading a molecule mid-run also re-enabled Run. The run is now claimed on the main thread before the worker starts, a click while one is in flight is ignored, and _set_molecule leaves Run disabled while a run is going. APP-2: _do_run read method, basis, solvent, fmax, step limit and the pre-opt flag from the live widgets at every stage, and used the active molecule object the Charge/Multiplicity fields write into. Changing the basis during a Geometry Opt gave a final single point at the new basis saved under the old label. They are now read once when the run starts and the molecule is copied; the Calculation Setup controls (plus charge, multiplicity and calculation type) are disabled for the run and restored to their previous state afterwards (help buttons stay usable). APP-6: an exception before _do_run's own try/finally (e.g. an unwritable log directory) left Run disabled for the session. The worker entry point now releases the run and reports the error if _do_run did not. APP-3: every seed path (Geometry Opt, TD-DFT, NMR, PES, and Frequency / IRC / TS via resolve_seed_geometry, which batch submission also uses) took the seed trajectory's last frame with that run's charge and multiplicity, so "the cation at the neutral's optimized geometry" recomputed the neutral and saved it as the cation's method. seed_with_run_charge() keeps the seed geometry and the current run's charge and multiplicity. tests/test_run_lock.py covers a seeded cation run, the click guard, freeze/restore, an early error, and a mid-run basis/charge change during Geometry Opt. Contributions: - Claude (Opus 5.5): code edits, review, and conceptual discussion - Jonathan Schultz: overall vision, planning, review, and orchestration Co-authored-by: Jonathan Schultz <nccu-schultz-lab@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
The structure search rebuilt the molecule from the resolved XYZ text alone, so it always loaded as a neutral singlet: sulfate, acetate or ammonium with an even electron count loaded as the wrong species with no warning, and odd-electron ions and radicals ([OH-], [CH3], NO2) failed as "Not found: Multiplicity Error". 26 bundled library entries (O2 triplet, charged complexes, ...) were affected the same way. - The resolvers' metadata now carries a multiplicity (radical electrons RDKit perceives + 1) next to the formal charge, and ResolvedStructure keeps it. - resolve_structure_with_details() returns the full ResolvedStructure; resolve_structure_with_message() is a wrapper over it (unchanged API). - molecule_from_resolved() builds the Molecule with that charge and multiplicity, falling back to the lowest multiplicity consistent with the electron count when a resolver knows the charge but not the spin. - The resolve message states a non-default charge/multiplicity. tests/test_search_charge_multiplicity.py drives the app's search handler offline for [NH4+], [OH-], sulfate, [CH3] and library O2. Contributions: - Claude (Opus 5.5): code edits, review, and conceptual discussion - Jonathan Schultz: overall vision, planning, review, and orchestration Co-authored-by: Jonathan Schultz <nccu-schultz-lab@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…dit APP-1) Banked IR dipoles and Raman polarizabilities were keyed only by (atom, axis, sign). The app's resume key is built from the input molecule, but the finite differences are taken around the geometry actually used: after an optional pre-optimization, a seed, or a mode displacement. Cancel a Frequency run, tick "Geometry optimization before calculation", Run again with Resume (ticked by default): the old geometry's dipoles were spliced into the new derivative and the result saved as normal (water: 12632 / 22014 / 17598 km/mol instead of 7 / 44 / 30). Changing density fitting had the same effect. The item set is now named "<freq|raman>_displacements-<digest>", the digest covering the reference geometry (Bohr, 1e-6), atoms, charge, spin, basis, ECP, functional, density fitting, solvent, step size and restricted/unrestricted. Results banked for anything else are not found, so those displacements are recomputed; an unchanged resume still reuses them. Parallel workers get the directory from the parent, unchanged. New test resumes at a moved geometry and compares with a clean run; it fails on the old code. Existing checkpoint tests find the set by prefix. Contributions: - Claude (Opus 5.5): code edits, review, and conceptual discussion - Jonathan Schultz: overall vision, planning, review, and orchestration Co-authored-by: Jonathan Schultz <nccu-schultz-lab@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
The Viewer opens other people's result folders and zips, and History
replays from disk; three paths pasted folder content into the page, which
has a live kernel connection:
- Cached vibrational-animation HTML (vib_frames/mode_NNN.html) was served
verbatim, and index.json's "file" was joined unchecked ("../x.html" or
an absolute path was read). Each entry now carries an HMAC-SHA256 of the
HTML under a per-user key (vib_cache.key next to the settings file,
created 0600); a file is served only if its name is a plain
mode_NNN.html and the MAC verifies. Foreign, altered and older caches are
misses and get re-rendered.
- The saved HOMO/LUMO cube's index "file" was joined unchecked, and cube
text was embedded in a <script> with json.dumps, which leaves
"</script>" intact. The file must now be a plain name, and every value
pasted into an inline script in the viewer builders goes through
viz_assets.script_json(), which escapes "</" and "<!--" (same value in
JS/JSON).
- Mode-symmetry labels and the Gamma_vib caption from result.json went raw
into the mode table. html_irrep / html_gamma / html_group now escape
their input.
tests/test_results_folder_trust.py covers each vector (altered, foreign
and path-traversal cache entries; traversal in the cube index; a cube
containing </script>; label escaping). Not checked in a browser.
Contributions:
- Claude (Opus 5.5): code edits, review, and conceptual discussion
- Jonathan Schultz: overall vision, planning, review, and orchestration
Co-authored-by: Jonathan Schultz <nccu-schultz-lab@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
"wB97X-D" mapped to LibXC's hyb_gga_xc_wb97x_d, which holds only the
exchange-correlation part. The atom-pair dispersion term that completes
the functional (Chai & Head-Gordon 2008) was never added, and PySCF's own
dispersion module rejects wb97x-d, so every wB97X-D energy, gradient and
Hessian had no dispersion while the help text called it "excellent for
non-covalent interactions" (audit F03 fixed the XC part only).
quantui/chg_dispersion.py implements the term:
E = -sum_{i<j} C6_ij / (R^6 (1 + 6 (R/Rr)^-12)),
C6_ij = sqrt(C6_i C6_j), Rr = R0_i + R0_j, Grimme-2006 (D2) C6/R0,
with analytic gradient and Hessian, and hooks it into PySCF's existing
dispersion entry points (do_disp / get_dispersion on SCF, Gradients and
Hessian) for objects with mf.disp == "chg-d2"; everything else goes
through PySCF unchanged. maybe_apply_d3 sets it for wB97X-D, so single
points, optimizations, TS/IRC/PES, frequencies, TD-DFT ground states and
batch jobs all include it. The D2 table matches ASE's copy of Grimme 2006;
elements past Xe have no parameters and are refused with a clear message.
- The exported script embeds the same module (numpy + pyscf only), so a
wB97X-D script reproduces the app's energy (and Hessian).
- wB97X-D skips GPU offload: gpu4pyscf objects would drop the term.
- Method description and stale comments corrected.
Tests: derivatives vs finite differences, a hand-computed pair value, the
term in single-point energy, gradient and Hessian through PySCF, refusal
past Xe, and an executed exported script matching the app to 1e-6 Ha.
Not compared against another program's wB97X-D numbers; the formula and
parameters need an instructor check.
Contributions:
- Claude (Opus 5.5): code edits, review, and conceptual discussion
- Jonathan Schultz: overall vision, planning, review, and orchestration
Co-authored-by: Jonathan Schultz <nccu-schultz-lab@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…CF-1) delta = sigma(TMS) - sigma, and the sigma(TMS) table held literature-style constants (several round numbers) that did not match this code's GIAO shieldings: TMS itself came out at delta(13C) = -7.7 ppm at B3LYP/6-31G* (the default, also used as the fallback for unlisted levels) and -52 ppm at RHF/STO-3G, so every reported 13C shift was off by that much; 1H by 0.1-2.9 ppm. The rows were presented as calibrated references. Every row is now run_nmr_calc on TMS optimized at the same level (optimize_geometry, fmax 0.01 eV/A, Td, all converged): level old H / C new H / C B3LYP/6-31G* 31.72 / 183.71 32.19 / 190.22 B3LYP/6-311G** 31.60 / 188.94 32.01 / 184.49 B3LYP/cc-pVDZ 31.54 / 186.12 31.31 / 192.19 B3LYP/def2-SVP 31.65 / 184.20 31.37 / 189.07 RHF/6-31G* 32.00 / 196.00 32.93 / 202.04 RHF/STO-3G 30.50 / 195.00 33.75 / 249.43 PBE0/6-31G* 31.60 / 184.50 32.12 / 195.06 PBE/6-31G* 31.50 / 185.00 31.75 / 189.09 NMR_DEFAULT_REFERENCE is now derived from the B3LYP/6-31G* row. The B3LYP/6-31G* value agrees with the commonly quoted B3LYP/6-31G(d) TMS shieldings (~32.2 / ~190). Help text says how the table is made. tests/test_nmr_tms_reference.py runs NMR on the RHF/STO-3G-optimized TMS and requires |delta| < 0.1 ppm (H) and < 0.5 ppm (C); it fails on the old table (3.3 ppm for H). Contributions: - Claude (Opus 5.5): code edits, review, and conceptual discussion - Jonathan Schultz: overall vision, planning, review, and orchestration Co-authored-by: Jonathan Schultz <nccu-schultz-lab@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Nov 12, 2026
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.
Fixes the High-severity findings from the 2026-11-10 codebase audit, one commit per finding (APP-2/3/4 share one, as they share the run-start code). Each fix has a regression test; where possible the test was confirmed to fail on the old code.
CANCELLED by <uid>and other final Slurm states (PREEMPTED, BOOT_FAIL, DEADLINE, REVOKED) are recognised. Cancelled jobs no longer hold a job slot for good. The mocksacctnow prints the real string.Not verified here, local/HPC follow-ups:
sacct.Authorship