diff --git a/python/BioSimSpace/FreeEnergy/_relative.py b/python/BioSimSpace/FreeEnergy/_relative.py index aafddf3e..361b2b40 100644 --- a/python/BioSimSpace/FreeEnergy/_relative.py +++ b/python/BioSimSpace/FreeEnergy/_relative.py @@ -1435,6 +1435,7 @@ 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! " @@ -1903,6 +1904,13 @@ def _analyse_somd2(work_dir=None, estimator="MBAR", method="alchemlyb", **kwargs temperatures = [x for _, x in sorted(zip(lambdas, temperatures))] lambdas = sorted(lambdas) + 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." + ) + # Check that the temperatures at the end states match. if temperatures[0] != temperatures[-1]: raise ValueError("The temperatures at the endstates don't match!")