Skip to content

Fix PBAM/PBSAM regression tests and test them in CI - #323

Merged
sobolevnrm merged 4 commits into
mainfrom
fix-pbam-pbsam-tests
Oct 26, 2026
Merged

sobolevnrm merged 4 commits into
mainfrom
fix-pbam-pbsam-tests

Conversation

@sobolevnrm

Copy link
Copy Markdown
Member

Summary

Fixes the PBAM and PBSAM regression tests and adds a PR-triggered CI job that builds and runs them.
Addresses the test and CI items in #321; it does not decide whether release binaries include PBAM/PBSAM.

Changes

  • examples/pbam/toy_energyforce.in: restore salt 0.01, which commit fb388ee (2021) commented out.
  • examples/pbsam-gly/gly_energyforce.in: restore salt 0.05 and replace the obsolete pbsam-auto keyword with pbsam.
  • examples/pbsam-gly/gly_dynamics.in and gly_electrostatic.in: replace pbsam-auto with pbsam so they parse.
  • tests/test_cases.cfg and examples/pbsam-gly/README.md: update the PBSAM reference energies to 4.941286844454E-03 and 4.968474993771E-03.
  • .github/workflows/build.yaml: new pb-solvers job on Ubuntu 22.04 that builds with only PBAM/PBSAM enabled and runs ctest -R "^(pbam|pbsam)_test$" --no-tests=error.
  • docs/releases.rst: release note.

Why the PBSAM reference energies change

pb_solvers commit 5671943 (2017) changed EnergyCalcSAM::calc_energy to return E*epsS.
The force calculation already multiplied by eps_s_ in 2016, so the change made energies consistent with forces.
New energies are exactly 80× (sdie) the 2016 references, and the forces are unchanged to all printed digits.
A ±0.05 Å finite-difference check gives energy gradients of the same order as the reported forces; without the epsS factor they would be about 100× too small.

Testing

  • Local macOS build with PBAM/PBSAM enabled (pb_solvers bb9298f): pbam_test and pbsam_test pass.
  • The PBAM reference value −4.965018552290E+01 is reproduced exactly, and standalone pb_solvers pbam gives the same result.

Restore the salt concentrations that were commented out in 2021, replace
the obsolete pbsam-auto keyword with pbsam, and update the PBSAM reference
energies for the solvent-dielectric scaling that pb_solvers 5671943 (2017)
applied to energies to match forces. Add a PR-triggered Linux job that
builds with PBAM/PBSAM enabled and runs their regression tests.

Refs #321

Co-authored-by: Copilot <[email protected]>
Copilot-Session: 3eaf20ea-3ac0-4701-958f-28527bf641fc
NOsh_parsePBAM and NOsh_parsePBSAM read writefmt[numwrite - 1] and
writestem[numwrite - 1] even when the input had no write statement,
indexing element -1. Only check the write format when a write exists.

Refs #321

Co-authored-by: Copilot <[email protected]>
Copilot-Session: 3eaf20ea-3ac0-4701-958f-28527bf641fc
@sobolevnrm

Copy link
Copy Markdown
Member Author

The new PBAM/PBSAM job caught a real bug: PBSAM returned 1.25E+306 on Ubuntu while macOS gave the expected value.
AddressSanitizer traced it to a heap-buffer-overflow in pb_solvers BaseSystem, fixed in Electrostatics/pb_solvers#14.
It also found an out-of-bounds read in APBS NOsh_parsePBSAM/NOsh_parsePBAM when there is no write statement, fixed in b7f1cd1.
Once pb_solvers#14 merges, this PR will update the pb_solvers pin so the new job passes.

pb_solvers cef00d7 fixes a heap-buffer-overflow in BaseSystem that made
PBSAM results platform dependent (Electrostatics/pb_solvers#14).

Refs #321

Co-authored-by: Copilot <[email protected]>
Copilot-Session: 3eaf20ea-3ac0-4701-958f-28527bf641fc
pb_solvers 8d254e5 makes PBSAM's matrix multiply work with OpenBLAS
(Electrostatics/pb_solvers#15), which fixes the Linux PBSAM results.

Refs #321

Co-authored-by: Copilot <[email protected]>
Copilot-Session: 3eaf20ea-3ac0-4701-958f-28527bf641fc
@sobolevnrm
sobolevnrm merged commit 8960926 into main Oct 26, 2026
16 checks passed
@sobolevnrm
sobolevnrm deleted the fix-pbam-pbsam-tests branch October 26, 2026 00:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant