Skip to content

Commit

Permalink
Add test for contac-matrix with pbc
Browse files Browse the repository at this point in the history
The test are currently only run for the dense arrays.
  • Loading branch information
kain88-de committed Aug 2, 2015
1 parent 841be3d commit 1886597
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion testsuite/MDAnalysisTests/test_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,19 @@ def test_sparse(self):
assert_equal(contacts[0, 3], True, "entry (0,3) should be a contact")
assert_equal(contacts[0, 4], False, "entry (0,3) should be a contact")

def test_box(self):
coord = np.array([[1, 1, 1], [5, 5, 5], [11, 11, 11]],
dtype=np.float32)
box = np.array([10, 10, 10], dtype=np.float32)
contacts = MDAnalysis.analysis.distances.contact_matrix(coord, box=box,
cutoff=1)

res = np.array([[True, False, True],
[False, True, False],
[True, False, True]])

assert_equal(contacts, res)


class TestAlign(TestCase):
def setUp(self):
Expand Down Expand Up @@ -543,4 +556,3 @@ def test_SurvivalProbability(self):
sp = MDAnalysis.analysis.waterdynamics.SurvivalProbability(self.universe, self.selection1, 0, 6, 3)
sp.run(quiet=True)
assert_equal(round(sp.timeseries[1],5), 1.0)

0 comments on commit 1886597

Please sign in to comment.