Skip to content

Commit

Permalink
Merge pull request #368 from fjclark/feature-improved-mbar-errors
Browse files Browse the repository at this point in the history
Improve error messages if no lambda windows found during analysis
  • Loading branch information
lohedges authored Nov 15, 2024
2 parents b145e30 + 70deecf commit c2876f0
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions python/BioSimSpace/FreeEnergy/_relative.py
Original file line number Diff line number Diff line change
Expand Up @@ -1435,6 +1435,12 @@ def _analyse_amber(work_dir=None, estimator="MBAR", method="alchemlyb", **kwargs
for part in file.parts:
if "lambda" in part:
lambdas.append(float(part.split("_")[-1]))
if len(lambdas) == 0:
raise ValueError(
"No lambda windows were detected from the output directory names! "
"Ensure that the directory being analysed contains sub-directories"
"name e.g `lambda_0`, `lambda_1` containing the output files."
)

# Find the temperature for each lambda window.
temperatures = []
Expand Down Expand Up @@ -1516,6 +1522,12 @@ def _analyse_gromacs(work_dir=None, estimator="MBAR", method="alchemlyb", **kwar
for part in file.parts:
if "lambda" in part:
lambdas.append(float(part.split("_")[-1]))
if len(lambdas) == 0:
raise ValueError(
"No lambda windows were detected from the output directory names! "
"Ensure that the directory being analysed contains sub-directories"
"name e.g `lambda_0`, `lambda_1` containing the output files."
)

# Find the temperature at each lambda window
temperatures = []
Expand Down Expand Up @@ -1685,6 +1697,12 @@ def _analyse_somd(work_dir=None, estimator="MBAR", method="alchemlyb", **kwargs)
for part in file.parts:
if "lambda" in part:
lambdas.append(float(part.split("_")[-1]))
if len(lambdas) == 0:
raise ValueError(
"No lambda windows were detected from the output directory names! "
"Ensure that the directory being analysed contains sub-directories"
"name e.g `lambda_0`, `lambda_1` containing the output files."
)

temperatures = []
for file in files:
Expand Down

0 comments on commit c2876f0

Please sign in to comment.