Skip to content

Commit

Permalink
mark analysis.rdf.InterRDF and analysis.rdf.InterRDF_s as not paralli…
Browse files Browse the repository at this point in the history
…zable
  • Loading branch information
tanishy7777 committed Jan 7, 2025
1 parent 1eca9f2 commit 6f186f3
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 0 deletions.
1 change: 1 addition & 0 deletions package/CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ Enhancements
* Enable parallelization for analysis.nucleicacids.NucPairDist (Issue #4670)
* Add check and warning for empty (all zero) coordinates in RDKit converter (PR #4824)
* Added `precision` for XYZWriter (Issue #4775, PR #4771)
* explicitly mark `analysis.rdf.InterRDF` and `analysis.rdf.InterRDF` as not parallelizable (Issue #4675)


Changes
Expand Down
12 changes: 12 additions & 0 deletions package/MDAnalysis/analysis/rdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,12 @@ class InterRDF(AnalysisBase):
:class:`~MDAnalysis.analysis.AnalysisBase`.
"""

@classmethod
def get_supported_backends(cls):
return ('serial',)

_analysis_algorithm_is_parallelizable = False

def __init__(
self,
g1,
Expand Down Expand Up @@ -563,6 +569,12 @@ class InterRDF_s(AnalysisBase):
The `universe` parameter is superflous.
"""

@classmethod
def get_supported_backends(cls):
return ('serial',)

_analysis_algorithm_is_parallelizable = False

def __init__(
self,
u,
Expand Down
18 changes: 18 additions & 0 deletions testsuite/MDAnalysisTests/analysis/test_rdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,3 +152,21 @@ def test_unknown_norm(sels):
s1, s2 = sels
with pytest.raises(ValueError, match="invalid norm"):
InterRDF(s1, s2, sels, norm="foo")

@pytest.mark.parametrize(
"classname,is_parallelizable",
[
(mda.analysis.rdf, False),
]
)
def test_class_is_parallelizable(classname, is_parallelizable):
assert classname.InterRDF._analysis_algorithm_is_parallelizable == is_parallelizable

@pytest.mark.parametrize(
"classname,backends",
[
(mda.analysis.rdf, ('serial',)),
]
)
def test_supported_backends(classname, backends):
assert classname.InterRDF.get_supported_backends() == backends
18 changes: 18 additions & 0 deletions testsuite/MDAnalysisTests/analysis/test_rdf_s.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,3 +171,21 @@ def test_rdf_attr_warning(rdf, attr):
wmsg = f"The `{attr}` attribute was deprecated in MDAnalysis 2.0.0"
with pytest.warns(DeprecationWarning, match=wmsg):
getattr(rdf, attr) is rdf.results[attr]

@pytest.mark.parametrize(
"classname,is_parallelizable",
[
(mda.analysis.rdf, False),
]
)
def test_class_is_parallelizable(classname, is_parallelizable):
assert classname.InterRDF_s._analysis_algorithm_is_parallelizable == is_parallelizable

@pytest.mark.parametrize(
"classname,backends",
[
(mda.analysis.rdf, ('serial',)),
]
)
def test_supported_backends(classname, backends):
assert classname.InterRDF_s.get_supported_backends() == backends

0 comments on commit 6f186f3

Please sign in to comment.