Skip to content

Commit 71af90b

Browse files
committed
Fix redundant alchemlyb imports.
1 parent 0d29837 commit 71af90b

2 files changed

Lines changed: 9 additions & 40 deletions

File tree

src/BioSimSpace/FreeEnergy/_relative.py

Lines changed: 5 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -42,29 +42,6 @@
4242
_logger = _logging.getLogger("pymbar")
4343
_logger.setLevel(_logging.ERROR)
4444

45-
# Handle alchemlyb MBAR API changes.
46-
try:
47-
from alchemlyb.estimators import AutoMBAR as _AutoMBAR
48-
except ImportError:
49-
from alchemlyb.estimators import MBAR as _AutoMBAR
50-
from alchemlyb.estimators import TI as _TI
51-
from alchemlyb.postprocessors.units import to_kcalmol as _to_kcalmol
52-
from alchemlyb.parsing.amber import extract_dHdl as _amber_extract_dHdl
53-
from alchemlyb.parsing.amber import extract_u_nk as _amber_extract_u_nk
54-
from alchemlyb.parsing.gmx import extract_dHdl as _gmx_extract_dHdl
55-
from alchemlyb.parsing.gmx import extract_u_nk as _gmx_extract_u_nk
56-
from alchemlyb.preprocessing.subsampling import (
57-
equilibrium_detection as _equilibrium_detection,
58-
)
59-
from alchemlyb.preprocessing.subsampling import (
60-
statistical_inefficiency as _statistical_inefficiency,
61-
)
62-
from alchemlyb.preprocessing.subsampling import slicing as _slicing
63-
from alchemlyb.preprocessing.subsampling import decorrelate_u_nk, decorrelate_dhdl
64-
from alchemlyb.postprocessors.units import to_kcalmol as _to_kcalmol
65-
from alchemlyb.postprocessors.units import kJ2kcal as _kJ2kcal
66-
from alchemlyb.postprocessors.units import R_kJmol as _R_kJmol
67-
6845
from sire.legacy.Base import getBinDir as _getBinDir
6946
from sire.legacy.Base import getShareDir as _getShareDir
7047

@@ -1305,7 +1282,11 @@ def _analyse_internal(files, temperatures, lambdas, engine, estimator, **kwargs)
13051282
import warnings as _warnings
13061283

13071284
import numpy as _np
1308-
from alchemlyb.estimators import MBAR as _AutoMBAR
1285+
1286+
try:
1287+
from alchemlyb.estimators import AutoMBAR as _AutoMBAR
1288+
except ImportError:
1289+
from alchemlyb.estimators import MBAR as _AutoMBAR
13091290
from alchemlyb.estimators import TI as _TI
13101291
from alchemlyb.postprocessors.units import to_kcalmol as _to_kcalmol
13111292

src/BioSimSpace/Sandpit/Exscientia/FreeEnergy/_alchemical_free_energy.py

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -36,21 +36,6 @@
3636
# need to try_import it.
3737
_alchemlyb = _try_import("alchemlyb")
3838

39-
if _have_imported(_alchemlyb):
40-
from alchemlyb.postprocessors.units import R_kJmol as _R_kJmol
41-
from alchemlyb.postprocessors.units import kJ2kcal as _kJ2kcal
42-
from alchemlyb.preprocessing.subsampling import (
43-
statistical_inefficiency as _statistical_inefficiency,
44-
)
45-
from alchemlyb.workflows import ABFE
46-
47-
try:
48-
from alchemlyb.estimators import AutoMBAR as _AutoMBAR
49-
except ImportError:
50-
from alchemlyb.estimators import MBAR as _AutoMBAR
51-
from alchemlyb.estimators import TI as _TI
52-
from alchemlyb.postprocessors.units import to_kcalmol as _to_kcalmol
53-
5439
from sire.legacy.Base import getBinDir as _getBinDir
5540
from sire.legacy.Base import getShareDir as _getShareDir
5641

@@ -767,7 +752,10 @@ def _analyse_somd(work_dir=None, estimator=None):
767752
"""
768753
from glob import glob as _glob
769754

770-
from alchemlyb.estimators import MBAR as _AutoMBAR
755+
try:
756+
from alchemlyb.estimators import AutoMBAR as _AutoMBAR
757+
except ImportError:
758+
from alchemlyb.estimators import MBAR as _AutoMBAR
771759
from alchemlyb.estimators import TI as _TI
772760
from alchemlyb.postprocessors.units import to_kcalmol as _to_kcalmol
773761
from alchemlyb.preprocessing.subsampling import (

0 commit comments

Comments
 (0)