From 135742da3577138db23767ae4a7993f35cb33e0c Mon Sep 17 00:00:00 2001 From: Shujie Fan Date: Thu, 29 Jun 2023 02:58:28 +0800 Subject: [PATCH 1/3] replace pymbar SI functions with SI function in alchemlyb --- mdpow/fep.py | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/mdpow/fep.py b/mdpow/fep.py index ddd841d7..b5b7e406 100644 --- a/mdpow/fep.py +++ b/mdpow/fep.py @@ -157,11 +157,10 @@ from numkit.observables import QuantityWithError from alchemlyb.parsing.gmx import extract_dHdl, extract_u_nk -from alchemlyb.estimators import TI, BAR -from alchemlyb.estimators import AutoMBAR as MBAR +from alchemlyb.estimators import TI, BAR, MBAR from alchemlyb.parsing.gmx import _extract_dataframe -from pymbar.timeseries import (statisticalInefficiency, - subsampleCorrelatedData, ) +from alchemlyb.preprocessing.subsampling import statistical_inefficiency + import gromacs import gromacs.utilities try: @@ -1054,19 +1053,16 @@ def collect_alchemlyb(self, SI=True, start=0, stop=None, stride=None, autosave=T for l in lambdas: xvg_file = self.dgdl_xvg(self.wdir(component, l)) xvg_df = extract(xvg_file, T=self.Temperature).iloc[start:stop:stride] + full_len = len(xvg_df) if SI: logger.info("Performing statistical inefficiency analysis for window %s %04d" % (component, 1000 * l)) ts = _extract_dataframe(xvg_file).iloc[start:stop:stride] ts = pd.DataFrame({'time': ts.iloc[:,0], 'dhdl': ts.iloc[:,1]}) ts = ts.set_index('time') - # calculate statistical inefficiency of series - statinef = statisticalInefficiency(ts, fast=False) - logger.info("The statistical inefficiency value is {:.4f}.".format(statinef)) - logger.info("The data are subsampled every {:d} frames.".format(int(np.ceil(statinef)))) - # use the subsampleCorrelatedData function to get the subsample index - indices = subsampleCorrelatedData(ts, g=statinef, - conservative=True) - xvg_df = xvg_df.iloc[indices] + # use the statistical_inefficiency function to subsample the data + xvg_df = statistical_inefficiency(xvg_df, ts, conservative=True) + logger.info("The statistical inefficiency value is {:.4f}.".format(full_len/len(xvg_df)/2)) + logger.info("The data are subsampled every {:d} frames.".format(int(np.ceil(full_len/len(xvg_df)/2)))) val.append(xvg_df) self.results.xvg[component] = (np.array(lambdas), pd.concat(val)) From 68113ac44a7cbab99f7a773c9bcbbc426b8abc70 Mon Sep 17 00:00:00 2001 From: Oliver Beckstein Date: Wed, 28 Jun 2023 15:32:15 -0700 Subject: [PATCH 2/3] increased required versions for alchemlyb and pymbar - pymbar >= 4 - alchemlyb >= 2 - update CHANGES (and some other fixes) --- CHANGES | 7 ++++--- devtools/conda-envs/test_env.yaml | 3 ++- doc/requirements.txt | 3 ++- setup.py | 4 ++-- 4 files changed, 10 insertions(+), 7 deletions(-) diff --git a/CHANGES b/CHANGES index 200881a1..e2e84edc 100644 --- a/CHANGES +++ b/CHANGES @@ -18,9 +18,10 @@ Changes and use _single_frame OR _single_universe (#216) * _prepare_universe and _conclude_universe removed from EnsembleAnalysis.run() method, no longer needed (per comments, #199) -* added support for Python 3.10 -* dropped testing on Python 3.6 -* internal log_banner() now uses logger as argument +* added support for Python 3.10 (#202) +* dropped testing on Python 3.6 (PR #220, #202) +* use pymbar >= 4 and alchemlyb >= 2 (#246) +* internal log_banner() now uses logger as argument (PR #247) Enhancements diff --git a/devtools/conda-envs/test_env.yaml b/devtools/conda-envs/test_env.yaml index 02eeef0a..96b0e921 100644 --- a/devtools/conda-envs/test_env.yaml +++ b/devtools/conda-envs/test_env.yaml @@ -14,7 +14,8 @@ dependencies: - mdanalysis >=2 - numkit - gromacswrapper -- alchemlyb <2 +- alchemlyb >=2 +- pymbar >=4 - rdkit - seaborn diff --git a/doc/requirements.txt b/doc/requirements.txt index 37f3c3f6..717b60c4 100644 --- a/doc/requirements.txt +++ b/doc/requirements.txt @@ -4,7 +4,8 @@ scipy pandas pyyaml GromacsWrapper>=0.5.1 -alchemlyb +alchemlyb>=2 +pymbar>=4 mdanalysis rdkit seaborn diff --git a/setup.py b/setup.py index 43a900ce..8f20d9ca 100644 --- a/setup.py +++ b/setup.py @@ -57,9 +57,9 @@ 'numkit', 'six', 'mdanalysis>=2', - 'alchemlyb<2', + 'alchemlyb>=2', 'pandas', - 'pymbar', + 'pymbar>=4', 'matplotlib', 'seaborn', 'rdkit', From 83e69bcfe1ba08d28073d111ff53a40ec677bd59 Mon Sep 17 00:00:00 2001 From: Oliver Beckstein Date: Wed, 28 Jun 2023 18:10:29 -0700 Subject: [PATCH 3/3] explicitly install mdanalysis during GROMACS installation - close #252 --- .github/workflows/ci.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 25186c11..1a241b40 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -77,8 +77,10 @@ jobs: run: | python -m pip install pybol - name: Install GROMACS (${{ matrix.gromacs-version }}) + # include mdanalysis here AGAIN to work around micromamba removing mdanalysis + # while downgrading libxml2 (see issue #252) run: | - micromamba install 'gromacs==${{ matrix.gromacs-version }}' pocl + micromamba install 'gromacs==${{ matrix.gromacs-version }}' pocl mdanalysis - name: Install package (with no dependencies) run: |