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

Adds test to make sure small box issue is now fixed #2670 #3163

Merged
merged 2 commits into from
Mar 14, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions package/CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ The rules for this file:
* 1.0.2

Fixes
* Adds test for crashes caused by small box NSGrid searches (Issue #2670)
* Replaces decreated NumPy type aliases and fixes NEP 34 explicit ragged
array warnings (PR #3139, backports PRs #2845 and #2834)
* Fixed several issues with NSGrid and triclinic boxes not finding some pairs.
Expand Down
16 changes: 16 additions & 0 deletions testsuite/MDAnalysisTests/lib/test_nsgrid.py
Original file line number Diff line number Diff line change
Expand Up @@ -352,3 +352,19 @@ def test_issue_2345():
c = Counter(len(v) for v in cn.values())

assert c == {9: 50, 12: 50}


def test_issue_2670():
# Tests that NSGrid no longer crashes when using small box sizes
u = mda.Universe(PDB)
u.dimensions = [1e-3, 1e-3, 1e-3, 90, 90, 90]

ag1 = u.select_atoms('resid 2 3')
# should return nothing as nothing except resid 3 is within 0.0 or resid 3
assert len(ag1.select_atoms('around 0.0 resid 3')) == 0

# force atom 0 of resid 1 to overlap with atom 0 of resid 3
u.residues[0].atoms[0].position = u.residues[2].atoms[0].position
ag2 = u.select_atoms('resid 1 3')
# should return the one atom overlap
assert len(ag2.select_atoms('around 0.0 resid 3')) == 1