Skip to content
Open
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
5 changes: 3 additions & 2 deletions package/CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,12 @@ The rules for this file:
??/??/?? IAlibay, orbeckst, marinegor, tylerjereddy, ljwoods2, marinegor,
spyke7, talagayev, tanii1125, BradyAJohnston, hejamu, jeremyleung521,
harshitgajjela-droid, kunjsinha, aygarwal, jauy123, Dreamstick9,
ollyfutur, Amarendra22, charity-g, ParthUppal523
ollyfutur, Amarendra22, charity-g, ParthUppal523, raulloiscuns

* 2.11.0

Fixes
* InterRDF now correctly returns bins in parallel (PR #5344)
* The `principal_axes` method in :class:`Masses` now uses
`np.linalg.eigh` instead of `np.linalg.eig`, improving numerical
stability. This may lead to slightly different results from previous
Expand Down Expand Up @@ -65,7 +66,7 @@ Fixes

Enhancements
* Added ASV benchmark for PDB trajectory reading (PR #5394)
* Read Linear Angle bonded interaction entries from GROMACS TPR files and
* Read Linear Angle bonded interaction entries from GROMACS TPR files and
add the angles to the topology (Issue #5361, PR #5372)
* Enables parallelization for analysis.atomicdistances.AtomicDistances
(Issue #4662, PR #4822)
Expand Down
2 changes: 1 addition & 1 deletion package/MDAnalysis/analysis/rdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ def _get_aggregator(self):
lookup={
"count": ResultsGroup.ndarray_sum,
"volume_cum": ResultsGroup.ndarray_sum,
"bins": ResultsGroup.ndarray_sum,
"bins": ResultsGroup.ndarray_mean,
"edges": ResultsGroup.ndarray_mean,
}
)
Expand Down
27 changes: 18 additions & 9 deletions testsuite/MDAnalysisTests/analysis/test_rdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,11 @@

from MDAnalysisTests.datafiles import two_water_gro

import numpy as np
from numpy.testing import assert_allclose

NFRAMES = 5


@pytest.fixture()
def u():
Expand All @@ -44,6 +47,10 @@ def sels(u):
# (NOTE: requires in-memory coordinates to make them permanent)
for at, (x, y) in zip(u.atoms, zip([1] * 3 + [2] * 3, [2, 1, 3] * 2)):
at.position = x, y, 0.0
# Create a fake trajectory with the same frame for testing parallel backends
trajectory_data = np.tile(u.atoms.positions, (NFRAMES, 1, 1))
dimensions_data = np.tile(u.dimensions, (NFRAMES, 1))
u.load_new(trajectory_data, format="MEMORY", dimensions=dimensions_data)
s1 = u.select_atoms("name OW")
s2 = u.select_atoms("name HW1 HW2")
return s1, s2
Expand Down Expand Up @@ -72,29 +79,31 @@ def test_count_sum(sels, client_InterRDF):
# should see 8 comparisons in count
s1, s2 = sels
rdf = InterRDF(s1, s2).run(**client_InterRDF)
assert rdf.results.count.sum() == 8
assert rdf.results.count.sum() == 8 * NFRAMES


def test_count(sels, client_InterRDF):
# should see two distances with 4 counts each
s1, s2 = sels
rdf = InterRDF(s1, s2).run(**client_InterRDF)
assert len(rdf.results.count[rdf.results.count == 4]) == 2
assert len(rdf.results.count[rdf.results.count == 4 * NFRAMES]) == 2


def test_double_run(sels, client_InterRDF):
def test_double_run(sels):
# running rdf twice should give the same result
# Note: this only make sense for serial backend as results aggregator can not handle
# rdf flag if rdf.results object is not restarted when parallel backend is used
s1, s2 = sels
rdf = InterRDF(s1, s2).run(**client_InterRDF)
rdf.run(**client_InterRDF)
assert len(rdf.results.count[rdf.results.count == 4]) == 2
rdf = InterRDF(s1, s2).run()
rdf.run()
assert len(rdf.results.count[rdf.results.count == 4 * NFRAMES]) == 2


def test_exclusion(sels, client_InterRDF):
# should see two distances with 4 counts each
s1, s2 = sels
rdf = InterRDF(s1, s2, exclusion_block=(1, 2)).run(**client_InterRDF)
assert rdf.results.count.sum() == 4
assert rdf.results.count.sum() == 4 * NFRAMES


@pytest.mark.parametrize(
Expand All @@ -105,7 +114,7 @@ def test_ignore_same_residues(sels, attr, count, client_InterRDF):
s1, s2 = sels
rdf = InterRDF(s2, s2, exclude_same=attr).run(**client_InterRDF)
assert rdf.rdf[0] == 0
assert rdf.results.count.sum() == count
assert rdf.results.count.sum() == count * NFRAMES


def test_ignore_same_residues_fails(sels, client_InterRDF):
Expand Down Expand Up @@ -158,7 +167,7 @@ def test_unknown_norm(sels):


@pytest.mark.parametrize("backend", distopia_conditional_backend())
def test_norm(sels, backend):
def test_backend(sels, backend):
s1, s2 = sels
rdf = InterRDF(s1, s2, norm="none", backend=backend).run()
assert_allclose(max(rdf.results.rdf), 4)
Loading