From c158f98b67518bd9f390421b5629686d0aa34954 Mon Sep 17 00:00:00 2001 From: Lester Hedges Date: Tue, 5 Dec 2023 10:44:54 +0000 Subject: [PATCH] Fixed parsing of external callback functions. --- emle/emle.py | 2 +- tests/input/external.py | 2 +- tests/test_external.py | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/emle/emle.py b/emle/emle.py index 6f58365..b7dc821 100644 --- a/emle/emle.py +++ b/emle/emle.py @@ -568,7 +568,7 @@ def __init__( # Split the module and function names. try: function = external_backend.split(".")[-1] - module = external_backend.strip("." + function) + module = external_backend.replace("." + function, "") except: raise ValueError( f"Unable to parse 'external_backend' callback string: {external_backend}" diff --git a/tests/input/external.py b/tests/input/external.py index 8f86f9d..d2244fa 100644 --- a/tests/input/external.py +++ b/tests/input/external.py @@ -4,7 +4,7 @@ EV_TO_HARTREE = 1.0 / ase.units.Hartree -def run_xtb(atoms): +def run_external(atoms): """ Internal function to compute in vacuo energies and gradients using the xtb-python interface. Currently only uses the "GFN2-xTB" method. diff --git a/tests/test_external.py b/tests/test_external.py index 8d20106..773cfc7 100644 --- a/tests/test_external.py +++ b/tests/test_external.py @@ -37,7 +37,7 @@ def test_external_local_directory(): # Set environment variables. os.environ["EMLE_PORT"] = "12345" - os.environ["EMLE_EXTERNAL_BACKEND"] = "external.run_xtb" + os.environ["EMLE_EXTERNAL_BACKEND"] = "external.run_external" # Create the sander command. command = "sander -O -i emle_sp.in -p adp.parm7 -c adp.rst7 -o emle.out" @@ -70,7 +70,7 @@ def test_external_plugin_directory(): # Set environment variables. os.environ["EMLE_PORT"] = "12345" - os.environ["EMLE_EXTERNAL_BACKEND"] = "external.run_xtb" + os.environ["EMLE_EXTERNAL_BACKEND"] = "external.run_external" os.environ["EMLE_PLUGIN_PATH"] = os.getcwd() + "/tests/input" # Create the sander command.