Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix RDF normalization when type A and B are different #30

Merged
merged 7 commits into from
Jan 25, 2022

Conversation

chrisjonesBSU
Copy link
Member

@chrisjonesBSU chrisjonesBSU commented Dec 20, 2021

This addresses #28 and fixes the RDF normalization errors that result when types A and B are different, and there are different amount of each type.

I'm leaving this as a WIP, as I don't think we are totally sure of the origin of the issue and might want to discuss it more, but this does fix the normalization issues. In other words, the RDFs returned are the same regardless of what order types A and B are passed into gsd_rdf when there are different amounts of A/B types in the system..

@chrisjonesBSU chrisjonesBSU added the WIP Work in progress label Dec 20, 2021
@chrisjonesBSU chrisjonesBSU linked an issue Dec 20, 2021 that may be closed by this pull request
@codecov
Copy link

codecov bot commented Dec 20, 2021

Codecov Report

Merging #30 (7e12f6d) into master (f367ed2) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master      #30   +/-   ##
=======================================
  Coverage   99.62%   99.63%           
=======================================
  Files           5        5           
  Lines         270      273    +3     
=======================================
+ Hits          269      272    +3     
  Misses          1        1           
Impacted Files Coverage Δ
cmeutils/structure.py 100.00% <100.00%> (ø)

@@ -22,6 +22,15 @@ def test_gsd_rdf_samename(self, gsdfile_bond):
assert norm2 == 1
assert not np.array_equal(rdf_noex, rdf_ex)

def test_gsd_rdf_pair_order(self, gsdfile_bond):
Copy link
Member

Choose a reason for hiding this comment

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

This unit test is a perfect example of testing that the function does what we want 🙌

@@ -145,6 +147,8 @@ def gsd_rdf(
rdf.compute(aq, neighbors=nlist, reset=False)

normalization = post_filter / pre_filter if exclude_bonded else 1
normalization *= ab_ratio
Copy link
Member

Choose a reason for hiding this comment

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

LGTM! I'm not sure theory-wise why this fixes it. @erjank Do you have a good explanation? If we're still stumped, we should reach out to Bradley or Vyas to help us understand.

Copy link
Member Author

@chrisjonesBSU chrisjonesBSU Dec 21, 2021

Choose a reason for hiding this comment

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

I think it's something related to the AABB query module, but I'm not that familiar with it. Maybe something related to exclude_ii?

I left a comment on the issue:

I'm not sure if this is related to the post_filter and pre_filter implementation. Those variables are only defined when exclude_bonded=True, and this issue occurs regardless of what is set for exclude_bonded.

I wonder if it is instead due to the the neighbor list query step. system is always created using A_pos and the query is always done for B_pos which probably explains why the behavior depends on what order A_name and B_name are defined.

@jennyfothergill jennyfothergill merged commit ba7b63c into cmelab:master Jan 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
WIP Work in progress
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Normalization of different atom selections off
2 participants