Repository navigation
Fix: normalize InterRDF(norm='density') by nA reference atoms (#5519) - #5522
sumitsaraswat362 wants to merge 3 commits into
Conversation
Documentation build overview
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #5522 +/- ##
===========================================
- Coverage 93.92% 93.57% -0.35%
===========================================
Files 184 184
Lines 22661 22663 +2
Branches 3223 3223
===========================================
- Hits 21284 21208 -76
- Misses 917 987 +70
- Partials 460 468 +8 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
ab73504 to
a75423e
Compare
kammmran
left a comment
There was a problem hiding this comment.
Thanks for the fix. Checking density == g(r) * density_2 in the test is a nice way to pin this down, because it tests the physical relationship rather than a magic number.
A few thoughts:
InterRDF_s has its own _conclude() in the same file and also supports norm="density". Does it need the same correction, or is it already normalised per reference atom? It might be worth a quick check, or a similar test, so the two classes stay consistent.
This changes the output of norm="density" by a factor of nA, so anyone comparing against older results will see different numbers. Besides the CHANGELOG entry, a .. versionchanged:: note on the norm parameter in the docstring would help users understand why.
Small question: with exclusion_block set, N is reduced, but the density normalization uses nA directly. I think that's correct, since it's per reference atom regardless of exclusions, but I wanted to confirm that was intended.
|
Added the docstring note and a consistency test for InterRDF_s (it calculates per site where nA = 1, so its density already matches g(r) * 1/). And yes, using nA for density with exclusions is intended since the single-particle density is defined per reference atom regardless of excluded pairs. |
|
@kammmran - I have seen several of your reviews across the ecosystem, all being done at pretty much the same time. This indicates to me that you are doing these reviews using AI assistance, and are not declaring it, which would be in breach of of MDAnalysis' AI policy. We ask you to not do this. |
Fixes #5519
Changes made in this Pull Request:
InterRDF._conclude()fornorm="density"by dividing accumulated pair counts by the reference atom counttest_density_matches_rdf_times_bulk_densityverifying the exact relationshiprdf_density == rdf_rdf * results.density_2.test_normto reflect the single-particle normalization (package/CHANGELOGunder 2.12.0 Fixes.LLM / AI generated code disclosure
LLMs or other AI-powered tools (beyond simple IDE use cases) were used in this contribution: no
PR Checklist
package/CHANGELOGfile updated?package/AUTHORS? (If it is not, add it!)Developers Certificate of Origin
I certify that I can submit this code contribution as described in the Developer Certificate of Origin, under the MDAnalysis LICENSE.