Skip to content

Make isd GaussianEMRestraint score independent of pair list history - #1124

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

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

Conversation

@aozalevsky

Copy link
Copy Markdown
Contributor

Fixes #1121 (the isd part; bayesianem is in salilab/bayesianem#4).

Change

The model-model and model-density loops now score only pairs whose spheres (XYZR) are closer than the cutoff + 2 Å. The containers are built with that cutoff, so they always hold every such pair. The score is then a function of the coordinates only.

I chose cutoff + 2 Å rather than the cutoff itself because a freshly updated list held exactly the pairs within cutoff + 2 × slack (slack 1 Å). So scores don't change whenever the lists were just updated, which with moves larger than the slack is almost always. Scoring strictly within the cutoff would be simpler to describe, but it would change today's scores, a lot for PMI's default cutoff of 0. With bayesianem in the tutorial, 14-24% of Metropolis decisions would differ. If you'd prefer the strict cutoff, it's a one-line change.

The header now says which pairs are scored.

Results

Replaying 5,000 Metropolis steps on the rnapolii tutorial system with 1 Å / 0.1 rad rigid-body moves, and comparing every proposal with a score computed on a freshly built list:

decisions that differ, before after
isd (PMI defaults, weight 80) 0.2-0.8% 0 of 5,000 (score identical at every step)
bayesianem (cutoff 10, weight 5) 1.2-2.3% 0 of 5,000 (score identical at every step)

Tests

  • New test_score_independent_of_history in medium_test_gaussian_em_restraint.py. It has a model-density case and a model-model case, each moving a Gaussian by less than the slack across the list edge. Both fail on develop (0.69314711 vs 0.69314718, 0.0019 vs −0.0610) and pass with this change.
  • All non-expensive tests pass, as do the expensive tests and examples of isd, pmi, container, core and bayesianem (run together with my other open PRs). The exceptions are 3 that need IMP.gsl, IMP.em2d or IMP.example, which I didn't build.

🤖 Generated with Claude Code

The model-density and model-model close pair containers list 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 containers' slack.

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

codecov Bot commented Oct 15, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 68.08%. Comparing base (7943b62) to head (d8b30bf).
⚠️ Report is 4 commits behind head on develop.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #1124      +/-   ##
===========================================
+ Coverage    67.67%   68.08%   +0.40%     
===========================================
  Files         1809     1783      -26     
  Lines       154480   136380   -18100     
  Branches     18517    17708     -809     
===========================================
- Hits        104547    92855   -11692     
+ Misses       45224    38994    -6230     
+ Partials      4709     4531     -178     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

GaussianEMRestraint (isd and bayesianem) score depends on close pair list history

1 participant