Skip to content

Commit

Permalink
Prevent new xtb module from crashing simulations (i-pi#389)
Browse files Browse the repository at this point in the history
* Update xtb.py

* Smarter import error
  • Loading branch information
frostedoyster authored Nov 2, 2024
1 parent aac88ea commit 4eaef20
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions drivers/py/pes/xtb.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,9 @@

try:
import tblite.interface as tb
except ImportError as e:
raise ModuleNotFoundError(
"Could not find tblite for xtb driver. Please install tblite-python with mamba"
) from e
except ImportError:
tb = None


__DRIVER_NAME__ = "xtb"
__DRIVER_CLASS__ = "TBLiteDriver"
Expand All @@ -31,6 +30,12 @@ def __init__(
verbose=False,
):
"""Initialized dummy drivers"""

if tb is None:
raise ModuleNotFoundError(
"Could not find tblite for xtb driver. Please install tblite-python with mamba"
)

config = json.loads(args)
try:
self.method = config["method"]
Expand Down

0 comments on commit 4eaef20

Please sign in to comment.