From 130dec1a73596711a3989ec5580224f2ed0ee693 Mon Sep 17 00:00:00 2001 From: Christoph Plett Date: Fri, 3 Jul 2026 13:08:52 +0200 Subject: [PATCH 1/3] Fix: No search for MLatom in the virtual environment Signed-off-by: Christoph Plett --- requirements/mlatom.txt | 3 +- src/oet/calculator/mace.py | 4 +-- src/oet/calculator/mlatom.py | 33 ++++++++++++++++++++-- tests/aimnet2/test_aiment2_v02_contract.py | 1 - 4 files changed, 35 insertions(+), 6 deletions(-) diff --git a/requirements/mlatom.txt b/requirements/mlatom.txt index 064578e..80a0130 100644 --- a/requirements/mlatom.txt +++ b/requirements/mlatom.txt @@ -1,2 +1,3 @@ -mlatom>=2.0.3 +mlatom>=3.12.0 torchani==2.2.4 +joblib>=1.5.3 diff --git a/src/oet/calculator/mace.py b/src/oet/calculator/mace.py index 2992e37..34f40b5 100755 --- a/src/oet/calculator/mace.py +++ b/src/oet/calculator/mace.py @@ -170,8 +170,8 @@ def extend_parser(cls, parser: ArgumentParser) -> None: "This requires the installation of torch_dftd to the virtual " "environment and that liblzma was installed when setting up " "the environment." - ) - ) + ), + ) parser.add_argument( "--damping", type=str, diff --git a/src/oet/calculator/mlatom.py b/src/oet/calculator/mlatom.py index 918c09a..7523a17 100755 --- a/src/oet/calculator/mlatom.py +++ b/src/oet/calculator/mlatom.py @@ -34,8 +34,10 @@ import os import shutil +import sys import tempfile from argparse import ArgumentParser +from pathlib import Path from typing import Any from oet.core.base_calc import BaseCalc, CalculationData @@ -45,8 +47,35 @@ class MlatomCalc(BaseCalc): @property def PROGRAM_NAMES(self) -> list[str]: - """Program names to search for in PATH""" - return ["mlatom"] + """ + Program names/paths to search for. + + Returns + ------- + list[str] + A list of paths or names to be searched for in PATH. + """ + exe_names = ["mlatom"] + + candidates: list[str] = [] + + # Program names to be searched in the PATH. + candidates.extend(exe_names) + + # Directories in the current python environments to check + # Include "Scripts" to catch Windows installations + bin_dirs = [ + Path(sys.prefix) / "bin", + Path(sys.prefix) / "Scripts", + Path(sys.executable).parent, + ] + + # Add possible full Paths of the program + for bindir in bin_dirs: + for name in exe_names: + candidates.append(str(bindir / name)) + + return candidates @classmethod def extend_parser(cls, parser: ArgumentParser) -> None: diff --git a/tests/aimnet2/test_aiment2_v02_contract.py b/tests/aimnet2/test_aiment2_v02_contract.py index 293cfc6..cfc2e2f 100644 --- a/tests/aimnet2/test_aiment2_v02_contract.py +++ b/tests/aimnet2/test_aiment2_v02_contract.py @@ -435,7 +435,6 @@ class TestBaseCalcReleaseDefault: """ def test_release_default_is_callable_and_no_op(self): - from oet.core.base_calc import BaseCalc class _StubCalc(BaseCalc): From 2aa34a832635bcd90f6e5ec7425b9cd17fff93f2 Mon Sep 17 00:00:00 2001 From: Christoph Plett Date: Tue, 7 Jul 2026 13:19:52 +0200 Subject: [PATCH 2/3] Test: MLatom: reducing the number decimal places to be checked Signed-off-by: Christoph Plett --- requirements/mlatom.txt | 2 ++ tests/mlatom/test_mlatom.py | 12 ++++++------ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/requirements/mlatom.txt b/requirements/mlatom.txt index 80a0130..93fdacd 100644 --- a/requirements/mlatom.txt +++ b/requirements/mlatom.txt @@ -1,3 +1,5 @@ +# Torch currently requires setuptools<82. +setuptools<82.0.0 mlatom>=3.12.0 torchani==2.2.4 joblib>=1.5.3 diff --git a/tests/mlatom/test_mlatom.py b/tests/mlatom/test_mlatom.py index 790d3f0..d7ee7f1 100644 --- a/tests/mlatom/test_mlatom.py +++ b/tests/mlatom/test_mlatom.py @@ -98,9 +98,9 @@ def test_H2O_engrad(self): ) from e self.assertEqual(num_atoms, expected_num_atoms) - self.assertAlmostEqual(energy, expected_energy, places=9) + self.assertAlmostEqual(energy, expected_energy, places=7) for g1, g2 in zip(gradients, expected_gradients): - self.assertAlmostEqual(g1, g2, places=9) + self.assertAlmostEqual(g1, g2, places=7) def test_OH_anion_eng_grad(self): xyz_file, input_file, engrad_out, output_file = get_filenames("OH_anion") @@ -133,9 +133,9 @@ def test_OH_anion_eng_grad(self): ) from e self.assertEqual(num_atoms, expected_num_atoms) - self.assertAlmostEqual(energy, expected_energy, places=9) + self.assertAlmostEqual(energy, expected_energy, places=7) for g1, g2 in zip(gradients, expected_gradients): - self.assertAlmostEqual(g1, g2, places=9) + self.assertAlmostEqual(g1, g2, places=7) def test_OH_rad_eng_grad(self): xyz_file, input_file, engrad_out, output_file = get_filenames("OH_rad") @@ -168,9 +168,9 @@ def test_OH_rad_eng_grad(self): ) from e self.assertEqual(num_atoms, expected_num_atoms) - self.assertAlmostEqual(energy, expected_energy, places=9) + self.assertAlmostEqual(energy, expected_energy, places=7) for g1, g2 in zip(gradients, expected_gradients): - self.assertAlmostEqual(g1, g2, places=9) + self.assertAlmostEqual(g1, g2, places=7) if __name__ == "__main__": From 679cf796d6119be9e7d67f43fef44509beeab242 Mon Sep 17 00:00:00 2001 From: Christoph Plett Date: Tue, 7 Jul 2026 13:37:59 +0200 Subject: [PATCH 3/3] Fix: Wrongly resolved ROOT_DIR when installing dev features Signed-off-by: Christoph Plett --- install.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install.py b/install.py index 4174b8b..f0b7a5e 100755 --- a/install.py +++ b/install.py @@ -149,7 +149,7 @@ def install_dev_tools(venv_dir: Path) -> None: pip_path = get_venv_pip(venv_dir) print("Installing developer tools.") - subprocess.check_call([pip_path, "install", ".[dev]"]) + subprocess.check_call([pip_path, "install", "-e", ".[dev]"]) def copy_oet_scripts(venv_dir: Path, dest_dir: Path, extras: Sequence[str]) -> None: