Skip to content

Update pymbar#317

Merged
leeping merged 10 commits into
leeping:masterfrom
lilyminium:update-pymbar
Apr 21, 2026
Merged

Update pymbar#317
leeping merged 10 commits into
leeping:masterfrom
lilyminium:update-pymbar

Conversation

@lilyminium

@lilyminium lilyminium commented Apr 1, 2026

Copy link
Copy Markdown
Collaborator

This PR adds a test to compare pymbar v3 and v4 compatiblity and also updates for v4. The main change seems to be moving from the default 'adaptive' solver in v3 to the 'robust' protocol in v4, which also calls the adaptive solver method.

Comment thread src/tests/test_liquid.py
# (water at 249.15 K/1 atm, 273.15 K/1 atm, 298.15 K/1 atm, 373.15 K/1 atm,
# 298.15 K/20 bar, 298.15 K/2000 bar; 801 snapshots each).
# Regenerate with: conda run -n <env> python tools/mbar_mre.py --save-ref
U_KLN_PATH = os.path.join(FIXTURE_DIR, 'U_kln.npy')

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From here downwards: added tests comparing direct pymbar execution. The script referenced here is attached, not sure if I should add it to the repo or if it's clutter.

mbar_mre.py

Comment thread src/liquid.py
_MBAR_SOLVER_KW = {} # v3: self-consistent-iteration default is fine
except ImportError:
import pymbar # pymbar 4: MBAR lives at pymbar top-level
_MBAR_SOLVER_KW = {'solver_protocol': 'robust'} # v4: default hybr diverges on some data

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

v3: used the adaptive solver by default. (https://pymbar.readthedocs.io/en/3.1.1/mbar.html#pymbar.MBAR)
v4: 'robust' uses adaptive, followed by L-BFGS (https://deepwiki.com/choderalab/pymbar/2.1-mbar-implementation) .

I'm not sure why, but plain swapping this out for the plain adaptive protocol results in tests failing, so maybe the fallback to L-BFGS is necessary. @mattwthompson I saw you managed to swap it out for adaptive in your PR, did you notice any differences?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately I don't recall, I was probably trying each option until one worked without really understanding the underlying behavior

@lilyminium lilyminium marked this pull request as ready for review April 2, 2026 14:12
@leeping

leeping commented Apr 21, 2026

Copy link
Copy Markdown
Owner

Thanks so much for adding the pymbar tests. I agree this is ready to merge.

@leeping leeping merged commit 14298f7 into leeping:master Apr 21, 2026
67 of 68 checks passed
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.

3 participants