Repository navigation
Conversation
There was a problem hiding this comment.
Warning
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Copilot review overview
4 open issues
The docs describe rejection as tied to an eigensolver limit of ~1e-16 * fastest rate, but the… · New This rejection can happen at many (T,P) points during grids, and logging aterrorlevel for each… · New Filtering byjob.__class__.__name__ == "PressureDependenceJob"is brittle (breaks on rename,… · New The test currently asserts exact zeros. If any future refactor introduces tiny nonzero noise (e.g.,… · New
What changed in this PR
Fixes flaky acetyl+O2_cse CI failures by rejecting CSE k(T,P) results when the smallest chemically-significant eigenvalue is below an eigensolver round-off threshold, preventing detailed-balance / equilibrium violations caused by numerical noise.
Changes:
- Add an eigenvalue “noise floor” check to
apply_chemically_significant_eigenvalues_method, returning zeros when CSE eigenvalues are not resolved above round-off. - Add functional tests that assert round-off-dominated conditions are rejected and a high-(T,P) point satisfies detailed balance.
- Document the CSE round-off limitation and rejection behavior.
| File | Description |
|---|---|
rmgpy/pdep/cse.pyx |
Introduces eigenvalue-resolution thresholding to reject numerically unreliable CSE results. |
test/arkane/arkanePdepTest.py |
Adds functional regression tests for rejection behavior and detailed-balance validation. |
documentation/source/reference/pdep/methods.rst |
Notes eigensolver resolution limits and that rejected points yield zero k(T,P). |
Review effort: Lite
| logging.error('Smallest chemically-significant eigenvalue ({0:.3g} s^-1) is not resolved above the round-off ' | ||
| 'level of the eigenvalue calculation ({1:.3g} s^-1) at {2:g} K and {3:g} bar, so the ' | ||
| 'chemically-significant eigenvalues method cannot compute k(T,P) here; rejecting result. ' | ||
| 'Consider the reservoir state or modified strong collision method for these ' | ||
| 'conditions.'.format(abs_omega[0], noise_floor, temperature, pressure * 1e-5)) | ||
| return k, pa |
There was a problem hiding this comment.
Not changed: kept at error. A rejected point means no k(T,P) at that condition. The two existing rejection paths in the same code ("Could only identify N distinct eigenvalues" in cse.pyx and "Negative rate coefficient generated; rejecting result" in network.py) also log at error level, so this is consistent with them. Leaving the thread open for a maintainer to decide.
🤖 Addressed by Claude Code
Review feedback on #3028. The documentation said the eigensolver limit is about 1e-16 times the fastest rate, but the code rejects at CSE_EIGENVALUE_RTOL = 1000 * eps (about 2e-13) times the largest eigenvalue magnitude. State the actual criterion and why it has a margin above machine epsilon. In the new test, pick the PressureDependenceJob with isinstance rather than by class name, and fail with a clear message if the example does not contain exactly one. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The acetyl+O2_cse Arkane example has been failing intermittently in CI since about 31 October 2026 with "Computed k(T,P) values for reaction hydroxyl + lactone <=> hydroperoxyl + ketene do not satisfy macroscopic equilibrium" at 302 K, 0.0125 bar. Conda package lists are identical in passing and failing jobs; every failing job ran on an Ubuntu 26.04 image on an x86_64-v4 (AVX-512) runner, and all failures give exactly the same wrong Keq, so the numbers depend on the CPU's BLAS/LAPACK code path. The cause is that the chemically-significant eigenvalues method is being asked for eigenvalues it cannot resolve. A dense symmetric eigensolver finds eigenvalues to an absolute accuracy of about eps * max|eigenvalue|. For this network at 302 K that is ~5e-5 s^-1 (max|eigenvalue| ~2e11 s^-1), while several chemically-significant eigenvalues are 1e-4 to 1e-6 s^-1. The resulting k(T,P) values are round-off: changing only the LAPACK driver (evr/evd/ev) or the OpenBLAS kernel changes k(OH + lactone -> ...) from -325 to +22. On most CPUs the noise happened to include a negative coefficient, which network.py quietly rejects; on some AVX-512 runners it instead broke detailed balance, which raises NetworkError and fails the test. Now the Allen CSE implementation checks the smallest chemically- significant eigenvalue (excluding the zero, mass-conservation mode when there are no product channels) against 1000 * eps * max|eigenvalue|. Below that it logs an error and returns zeros, the same way it already handles eigenvalues that cannot be separated from internal-energy relaxation. Over the example's T,P grid, results kept by this check agree between LAPACK drivers to within 8% with no negative values and Keq within 7%; below about 10 * eps they are noise. The threshold is somewhat conservative: a few conditions between 100 and 1000 * eps are also rejected. The Georgievskii CSE variant is not changed here. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review feedback on #3028. The documentation said the eigensolver limit is about 1e-16 times the fastest rate, but the code rejects at CSE_EIGENVALUE_RTOL = 1000 * eps (about 2e-13) times the largest eigenvalue magnitude. State the actual criterion and why it has a margin above machine epsilon. In the new test, pick the PressureDependenceJob with isinstance rather than by class name, and fail with a clear message if the example does not contain exactly one. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
4dc8fc6 to
c46f714
Compare


Fixes the intermittent
test/arkane/arkaneMainTest.py::TestArkaneExamples::test_arkane_examplesfailure that has hitmain's nightly and unrelated PRs since about 31 October 2026:Diagnosis
It's the CPU, not a dependency. I compared the conda package lists printed by 114 Ubuntu test jobs from 27 Oct to 4 Nov.
_x86_64-microarch-level: it is 4 (AVX-512) in every failing job.acetyl+O2_cseat 302.47 K and 0.0125 bar, with exactly the same wrong Keq (1.299e-16, against 5.629e-17 expected).The numbers are round-off everywhere, not only on the failing runners.
evr/evd/ev) orOPENBLAS_CORETYPEmoves k(OH + lactone → …) from -325 to +22, and can flip an eigenvalue's sign.network.pythen rejects the result quietly ("Negative rate coefficient generated; rejecting result"), which is why those jobs passed. On some AVX-512 runners the noise breaks detailed balance instead, and that raisesNetworkError.Change
apply_chemically_significant_eigenvalues_method(the Allen CSE) now checks the smallest chemically significant eigenvalue againstCSE_EIGENVALUE_RTOL * max|eigenvalue|, withCSE_EIGENVALUE_RTOL = 1000 * eps. When there are no product channels, it skips the eigenvalue that is genuinely zero (mass conservation).Below the threshold, it logs an error and returns zeros. That is what it already does when it can't separate the chemically significant eigenvalues from internal-energy relaxation.
Results over the example's 8×5 (T, P) grid:
Also in this PR:
test/arkane/arkanePdepTest.py. The rejection test fails before this change on any CPU, because it calls the CSE function directly rather than relying on the negative-value check.documentation/source/reference/pdep/methods.rst.Testing (local, Intel i7 with AVX2,
rmg_env18)OPENBLAS_CORETYPE=SandybridgeandNehalem.test/rmgpy/pdeppasses (20 tests).arkaneMainTest.py -k examplespasses, and "Negative rate coefficient" no longer appears in its output.Not in this PR
get_rate_coefficients_CSE_Advanced) is unchanged. It probably has the same weakness, and CI doesn't exercise it.acetyl+O2_cseexample's T, P range.I'm opening separate issues for both.
🤖 Generated with Claude Code