Skip to content

Commit

Permalink
Update ASE (#389)
Browse files Browse the repository at this point in the history
* Update ASE

* Remove import checks for Bussi
  • Loading branch information
ElliottKasoar authored Jan 22, 2025
1 parent 8117404 commit 9cc0723
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 29 deletions.
8 changes: 1 addition & 7 deletions janus_core/calculations/md.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
from ase import Atoms
from ase.geometry.analysis import Analysis
from ase.io import read
from ase.md.bussi import Bussi
from ase.md.langevin import Langevin
from ase.md.npt import NPT as ASE_NPT
from ase.md.velocitydistribution import (
Expand Down Expand Up @@ -1581,13 +1582,6 @@ def __init__(
**kwargs
Additional keyword arguments.
"""
try:
from ase.md.bussi import Bussi
except ImportError as e:
raise NotImplementedError(
"Please download the latest ASE commits to use this module."
) from e

super().__init__(*args, ensemble=ensemble, **kwargs)

(ensemble_kwargs,) = none_to_dict(ensemble_kwargs)
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ classifiers = [
readme = "README.md"

dependencies = [
"ase<4.0,>=3.23",
"ase<4.0,>=3.24",
"codecarbon<3.0.0,>=2.5.0",
"mace-torch==0.3.8",
"numpy<2.0.0,>=1.26.4",
Expand Down
12 changes: 1 addition & 11 deletions tests/test_md.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,12 @@
import numpy as np
import pytest

from janus_core.calculations.md import NPH, NPT, NVE, NVT, NVT_NH
from janus_core.calculations.md import NPH, NPT, NVE, NVT, NVT_CSVR, NVT_NH
from janus_core.calculations.single_point import SinglePoint
from janus_core.helpers.mlip_calculators import choose_calculator
from janus_core.helpers.stats import Stats
from tests.utils import assert_log_contains

try:
from ase.md.bussi import Bussi # noqa: F401

from janus_core.calculations.md import NVT_CSVR

ASE_IMPORT_ERROR = False
except ImportError:
ASE_IMPORT_ERROR = True

DATA_PATH = Path(__file__).parent / "data"
MODEL_PATH = Path(__file__).parent / "models" / "mace_mp_small.model"

Expand Down Expand Up @@ -235,7 +226,6 @@ def test_nph():
stats_path.unlink(missing_ok=True)


@pytest.mark.skipif(ASE_IMPORT_ERROR, reason="Requires updated version of ASE")
def test_nvt_csvr():
"""Test NVT CSVR molecular dynamics."""
restart_path_1 = Path("NaCl-nvt-csvr-T300.0-res-2.extxyz")
Expand Down
10 changes: 0 additions & 10 deletions tests/test_md_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,6 @@
from janus_core.cli.janus import app
from tests.utils import assert_log_contains, clear_log_handlers, strip_ansi_codes

try:
from ase.md.bussi import Bussi # noqa: F401

ASE_IMPORT_ERROR = False
except ImportError:
ASE_IMPORT_ERROR = True

DATA_PATH = Path(__file__).parent / "data"

runner = CliRunner()
Expand Down Expand Up @@ -56,9 +49,6 @@ def test_md(ensemble):
"nvt-csvr": "NaCl-nvt-csvr-T300.0-",
}

if ensemble == "nvt-csvr" and ASE_IMPORT_ERROR:
return

final_path = Path(f"{file_prefix[ensemble]}final.extxyz").absolute()
restart_path = Path(f"{file_prefix[ensemble]}res-2.extxyz").absolute()
stats_path = Path(f"{file_prefix[ensemble]}stats.dat").absolute()
Expand Down

0 comments on commit 9cc0723

Please sign in to comment.