Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion install.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]"])

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not ideal if the tests only work for an editable install. We probably need a different strategy to find the binaries than using ROOT_DIR. Please open an issue or add it to the requirements for the restructuring of the test suite.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed. Added the point to #41.



def copy_oet_scripts(venv_dir: Path, dest_dir: Path, extras: Sequence[str]) -> None:
Expand Down
5 changes: 4 additions & 1 deletion requirements/mlatom.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
mlatom>=2.0.3
# Torch currently requires setuptools<82.
setuptools<82.0.0
mlatom>=3.12.0
torchani==2.2.4
joblib>=1.5.3
Comment thread
stgeo marked this conversation as resolved.
4 changes: 2 additions & 2 deletions src/oet/calculator/mace.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
33 changes: 31 additions & 2 deletions src/oet/calculator/mlatom.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand Down
1 change: 0 additions & 1 deletion tests/aimnet2/test_aiment2_v02_contract.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
12 changes: 6 additions & 6 deletions tests/mlatom/test_mlatom.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -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__":
Expand Down
Loading