Skip to content

Commit f6664ac

Browse files
authored
Merge branch 'develop' into fix-filelocktest-5382
2 parents aa09735 + a1ec115 commit f6664ac

5 files changed

Lines changed: 29 additions & 18 deletions

File tree

.github/CONTRIBUTING.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,17 @@
22

33
Thanks for contributing to MDAnalysis!
44

5-
All members of the MDAnalysis community adhere to our [Code of Conduct](https://www.mdanalysis.org/pages/conduct/). By contributing code and interacting with us on GitHub, the forums, or by any other means you consent to follow the Code of Conduct.
5+
All members of the MDAnalysis community adhere to our [Code of Conduct](https://github.com/MDAnalysis/mdanalysis/?tab=coc-ov-file). By contributing code and interacting with us on GitHub, the forums, or by any other means you consent to follow the Code of Conduct.
66

77
#### Reporting issues
88

99
If you've found a defect with MDAnalysis we'd love to know so we can fix it. Please follow the Issue template so we can quickly diagnose the problem, in particular the piece of code that causes the problem.
1010

11-
If your issue isn't a defect with the code and instead you require help using MDAnalysis, drop by the [discussion forum](https://groups.google.com/forum/#!forum/mdnalysis-discussion).
11+
If your issue isn't a defect with the code and instead you require help using MDAnalysis, drop by in [discord #users or GitHub discussions](https://www.mdanalysis.org/community/#ask-questions--get-help).
1212

1313
#### Contributing code
1414

15-
If you're contributing code, please check out [How to contribute](https://www.mdanalysis.org/UserGuide/contributing.html) in the User Guide and look at the [Style guide](https://github.com/MDAnalysis/mdanalysis/wiki/Style-Guide).
15+
We welcome your code contributions! Please check out the [Contributing](https://www.mdanalysis.org/contribute/) section on our web page for how you can contribute to the whole MDAnalysis project and in particular the [User Guide's section on Contributing](https://userguide.mdanalysis.org/stable/contributing_code.html) for the MDAnalysis package in particular. Please also familiarize yourself with the current version of our [AI Policy](https://github.com/MDAnalysis/mdanalysis/blob/develop/AI_POLICY.md)
1616

17-
MDAnalysis devs are most easily reached through the [development list](https://groups.google.com/forum/#!forum/mdnalysis-devel).
17+
MDAnalysis devs are most easily reached in the [discord #developers channel](https://www.mdanalysis.org/community/#ask-questions--get-help).
1818

.github/workflows/linters.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,13 @@ jobs:
3636

3737
- uses: psf/black@stable
3838
with:
39-
options: "--check --verbose"
39+
options: "--check"
4040
src: "./package"
4141
version: "~= 24.0"
42-
42+
4343
- uses: psf/black@stable
4444
with:
45-
options: "--check --verbose"
45+
options: "--check"
4646
src: "./testsuite"
4747
version: "~= 24.0"
4848

package/CHANGELOG

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,14 @@ The rules for this file:
1717
??/??/?? IAlibay, orbeckst, marinegor, tylerjereddy, ljwoods2, marinegor,
1818
spyke7, talagayev, tanii1125, BradyAJohnston, hejamu, jeremyleung521,
1919
harshitgajjela-droid, kunjsinha, aygarwal, jauy123, Dreamstick9,
20-
ollyfutur, Amarendra22, charity-g, ParthUppal523, apoorva-01
20+
ollyfutur, Amarendra22, charity-g, ParthUppal523, apoorva-01, RMeli,
21+
raulloiscuns
2122

2223
* 2.11.0
2324

2425
Fixes
2526
* Fix FileLock tests for XTC and TRR: lock file is no longer removed (#5382)
27+
* InterRDF now correctly returns bins in parallel (PR #5344)
2628
* `Merge()` no longer raises a TypeError on Universes that have a `cmaps`
2729
attribute; cmaps are now combined like the other connection attributes
2830
(bonds, angles, dihedrals, impropers) (Issue #3672).

package/MDAnalysis/analysis/rdf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ def _get_aggregator(self):
369369
lookup={
370370
"count": ResultsGroup.ndarray_sum,
371371
"volume_cum": ResultsGroup.ndarray_sum,
372-
"bins": ResultsGroup.ndarray_sum,
372+
"bins": ResultsGroup.ndarray_mean,
373373
"edges": ResultsGroup.ndarray_mean,
374374
}
375375
)

testsuite/MDAnalysisTests/analysis/test_rdf.py

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,11 @@
2828

2929
from MDAnalysisTests.datafiles import two_water_gro
3030

31+
import numpy as np
3132
from numpy.testing import assert_allclose
3233

34+
NFRAMES = 5
35+
3336

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

7784

7885
def test_count(sels, client_InterRDF):
7986
# should see two distances with 4 counts each
8087
s1, s2 = sels
8188
rdf = InterRDF(s1, s2).run(**client_InterRDF)
82-
assert len(rdf.results.count[rdf.results.count == 4]) == 2
89+
assert len(rdf.results.count[rdf.results.count == 4 * NFRAMES]) == 2
8390

8491

85-
def test_double_run(sels, client_InterRDF):
92+
def test_double_run(sels):
8693
# running rdf twice should give the same result
94+
# Note: this only make sense for serial backend as results aggregator can not handle
95+
# rdf flag if rdf.results object is not restarted when parallel backend is used
8796
s1, s2 = sels
88-
rdf = InterRDF(s1, s2).run(**client_InterRDF)
89-
rdf.run(**client_InterRDF)
90-
assert len(rdf.results.count[rdf.results.count == 4]) == 2
97+
rdf = InterRDF(s1, s2).run()
98+
rdf.run()
99+
assert len(rdf.results.count[rdf.results.count == 4 * NFRAMES]) == 2
91100

92101

93102
def test_exclusion(sels, client_InterRDF):
94103
# should see two distances with 4 counts each
95104
s1, s2 = sels
96105
rdf = InterRDF(s1, s2, exclusion_block=(1, 2)).run(**client_InterRDF)
97-
assert rdf.results.count.sum() == 4
106+
assert rdf.results.count.sum() == 4 * NFRAMES
98107

99108

100109
@pytest.mark.parametrize(
@@ -105,7 +114,7 @@ def test_ignore_same_residues(sels, attr, count, client_InterRDF):
105114
s1, s2 = sels
106115
rdf = InterRDF(s2, s2, exclude_same=attr).run(**client_InterRDF)
107116
assert rdf.rdf[0] == 0
108-
assert rdf.results.count.sum() == count
117+
assert rdf.results.count.sum() == count * NFRAMES
109118

110119

111120
def test_ignore_same_residues_fails(sels, client_InterRDF):
@@ -158,7 +167,7 @@ def test_unknown_norm(sels):
158167

159168

160169
@pytest.mark.parametrize("backend", distopia_conditional_backend())
161-
def test_norm(sels, backend):
170+
def test_backend(sels, backend):
162171
s1, s2 = sels
163172
rdf = InterRDF(s1, s2, norm="none", backend=backend).run()
164173
assert_allclose(max(rdf.results.rdf), 4)

0 commit comments

Comments
 (0)