Skip to content

Commit

Permalink
deprecation of waterdynamics.HydrogenBondLifetimes
Browse files Browse the repository at this point in the history
- see #2547 and PR #2791
- will be replaced by MDAnalysis.analysis.hydrogenbonds.HydrogenBondAnalysis.lifetime (in 2.0.0)
- add test for deprecation warning
- update CHANGELOG
  • Loading branch information
orbeckst committed Jul 12, 2020
1 parent de8813e commit 721c800
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 1 deletion.
4 changes: 4 additions & 0 deletions package/CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ Fixes
Enhancements
* Improved performances when parsing TPR files (PR #2804)

Deprecations
* waterdynamics.HydrogenBondLifetimes will be removed in 2.0.0 and
replaced with hydrogenbonds.HydrogenBondAnalysis.lifetime() (#2547)


06/09/20 richardjgowers, kain88-de, lilyminium, p-j-smith, bdice, joaomcteixeira,
PicoCentauri, davidercruz, jbarnoud, RMeli, IAlibay, mtiberti, CCook96,
Expand Down
12 changes: 11 additions & 1 deletion package/MDAnalysis/analysis/waterdynamics.py
Original file line number Diff line number Diff line change
Expand Up @@ -510,11 +510,21 @@ class HydrogenBondLifetimes(object):
.. versionchanged:: 1.0.0
The ``nproc`` keyword was removed as it linked to a portion of code that
may have failed in some cases.
.. deprecated:: 1.0.1
``waterdynamics.HydrogenBondLifetimes`` is deprecated and will be
removed in 2.0.0. Instead, please use (available in 2.0.0)
:meth:`MDAnalysis.analysis.hydrogenbonds.HydrogenBondAnalysis.lifetime`
"""


def __init__(self, universe, selection1, selection2, t0, tf, dtmax,
nproc=1):
warnings.warn(
"The waterdynamics.HydrogenBondLifetimes class is deprecated in 1.0.1. "
"This class will be removed in 2.0.0; please prepare to use "
"MDAnalysis.analysis.hydrogenbonds.HydrogenBondAnalysis.lifetime (in 2.0.0)",
category=DeprecationWarning
)
self.universe = universe
self.selection1 = selection1
self.selection2 = selection2
Expand Down Expand Up @@ -1192,7 +1202,7 @@ class SurvivalProbability(object):
Using the MDAnalysis.lib.correlations.py to carry out the intermittency
and autocorrelation calculations.
Changed `selection` keyword to `select`.
Removed support for the deprecated `t0`, `tf`, and `dtmax` keywords.
Removed support for the deprecated `t0`, `tf`, and `dtmax` keywords.
These should instead be passed to :meth:`SurvivalProbability.run` as
the `start`, `stop`, and `tau_max` keywords respectively.
The `stop` keyword as passed to :meth:`SurvivalProbability.run` has now
Expand Down
6 changes: 6 additions & 0 deletions testsuite/MDAnalysisTests/analysis/test_waterdynamics.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@ def test_HydrogenBondLifetimes(universe):
assert_almost_equal(hbl.timeseries[2][1], 0.75, 5)


def test_HydrogenBondLifetimes_deprecation(universe):
with pytest.deprecated_call():
hbl = waterdynamics.HydrogenBondLifetimes(
universe, SELECTION1, SELECTION1, 0, 5, 3)


def test_WaterOrientationalRelaxation(universe):
wor = waterdynamics.WaterOrientationalRelaxation(
universe, SELECTION1, 0, 5, 2)
Expand Down

0 comments on commit 721c800

Please sign in to comment.