Skip to content

Make GaussianEMRestraint score independent of pair list history - #4

Open
aozalevsky wants to merge 1 commit into
salilab:mainfrom
aozalevsky:fix_em_pair_history
Open

aozalevsky wants to merge 1 commit into
salilab:mainfrom
aozalevsky:fix_em_pair_history

Conversation

@aozalevsky

Copy link
Copy Markdown

Fixes the bayesianem part of salilab/imp#1121. A companion salilab/imp PR makes the same change in IMP.isd.GaussianEMRestraint.

Change

The model-density loops in unprotected_evaluate() and debug() now score only pairs whose spheres (XYZR) are closer than the cutoff + 2 Å. The container is built with that cutoff, so it always holds every such pair. A freshly updated list held exactly those pairs before (cutoff + 2 × the default 1 Å slack), so scores don't change whenever the list was just updated.

Since the score no longer depends on the list's history, the restraint doesn't need is_custom_reset_ (cf. salilab/imp@5c585d2f51) to keep evaluate_moved() and evaluate() consistent.

Results

On the rnapolii tutorial system with 1 Å / 0.1 rad rigid-body moves (bayesianem, cutoff 10, weight 5), 1.2-2.3% of Metropolis decisions differed from those with a freshly built list. With this change it's 0 of 5,000, and the score is identical at every step.

Tests

New test/test_pair_history.py: moving a model Gaussian by 0.9 Å across the list edge gives 21.363 on the old list and 22.537 on a new restraint before this change; now both give the same score. The existing tests pass, built in IMP develop.

🤖 Generated with Claude Code

The model-density close pair container lists every pair closer than the
cutoff, plus other pairs that depend on where the particles were at the
last list update. The restraint summed every listed pair, so the same
coordinates could score differently depending on the sampling history, and
Monte Carlo did not sample a fixed distribution when moves were smaller than
the container's slack.

Score only pairs whose spheres are closer than the cutoff plus 2A, and build
the container with that cutoff so that it holds all such pairs. This is the
set of pairs a freshly updated list held before, so scores are unchanged
whenever the list was just updated.
@codecov

codecov Bot commented Oct 15, 2026

Copy link
Copy Markdown

Welcome to Codecov 🎉

Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests.

Thanks for integrating Codecov - We've got you covered ☂️

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