-
Notifications
You must be signed in to change notification settings - Fork 673
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
Add pbc kwarg to Contacts #2646
Changes from 2 commits
921eb56
d796742
856344c
05a442c
c97cacc
8b204d2
ee62918
043819b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,6 +37,8 @@ | |
from MDAnalysisTests.datafiles import ( | ||
PSF, | ||
DCD, | ||
TPR, | ||
XTC, | ||
contacts_villin_folded, | ||
contacts_villin_unfolded, | ||
contacts_file | ||
|
@@ -302,6 +304,29 @@ def test_non_callable_method(self, universe): | |
with pytest.raises(ValueError): | ||
self._run_Contacts(universe, method=2, stop=2) | ||
|
||
def test_distance_box(self): | ||
u = mda.Universe(TPR, XTC) | ||
sel1 = "(resname ARG LYS) and (name NH* NZ)" | ||
sel2 = "(resname ASP GLU) and (name OE* OD*)" | ||
acidic = u.select_atoms(sel2) | ||
basic = u.select_atoms(sel1) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You could focus the test on a particular pair we know is split across the periodic boundary, to make it easier to directly check the distances measured are what we expect given PBC. |
||
|
||
q = contacts.Contacts(u, | ||
select=(sel1, sel2), | ||
refgroup=(acidic, basic), | ||
method="hard_cut", | ||
kwargs={'is_box': True}) | ||
|
||
r = contacts.Contacts(u, | ||
select=(sel1, sel2), | ||
refgroup=(acidic, basic), | ||
method="hard_cut") | ||
|
||
q.r0 = np.array(q.r0).squeeze() | ||
r.r0 = np.array(r.r0).squeeze() | ||
assert_array_equal(q.r0,r.r0) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We expect the distance to be different with or without consideration of the periodic boundaries, so this test is currently failing; maybe you could compare directly with what we expect the values to be instead? |
||
|
||
|
||
|
||
def test_q1q2(): | ||
u = mda.Universe(PSF, DCD) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The name
is_box
isn't particularly intuitive; something likepbc
would be better.Also, since it is only used in
__init__
and not in the fraction_contacts methods wherefraction_kwargs
is passed, it'd make more sense to directly include as an argument of__init__
rather than throughkwargs
. This would also make it easier to include in the docs here.