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
8 changes: 6 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ permissions:
contents: read

jobs:
pre-commit:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -34,10 +34,14 @@ jobs:
pre-commit run --all-files
shell: micromamba-shell {0}

- name: Run mypy
run: mypy .
shell: micromamba-shell {0}

test:
runs-on: ubuntu-latest
needs:
- pre-commit
- lint
strategy:
fail-fast: false
matrix:
Expand Down
5 changes: 0 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,3 @@ repos:
# Run the formatter.
- id: ruff-format
args: [--config, pyproject.toml]
# - repo: https://github.com/pre-commit/mirrors-mypy
# rev: v1.20.0
# hooks:
# - id: mypy
# args: [--config-file, pyproject.toml]
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ dependencies = [

optional-dependencies.dev = [
"pre-commit",
"mypy",
"pytest",
"pytest-cov",
"pytest-randomly",
Expand Down
6 changes: 3 additions & 3 deletions src/skala/ase/calculator.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,9 @@ def set(self, **kwargs: Any) -> dict[str, Any]:
self._ks.verbose = verbose
self._ks.base.verbose = verbose

if "ks_config" in changed_parameters and self.parameters.ks_config is not None:
if "ks_config" in changed_parameters and self.parameters.ks_config is not None: # type: ignore
if self._ks is not None:
self._ks.base(**self.parameters.ks_config)
self._ks.base(**self.parameters.ks_config) # type: ignore

if (
"charge" in changed_parameters
Expand Down Expand Up @@ -178,7 +178,7 @@ def calculate(
else:
self._ks.reset(self._mol)

if self.parameters.with_retry:
if self.parameters.with_retry: # type: ignore
self._ks.base, _ = retry_scf(self._ks.base)
energy = self._ks.base.e_tot
else:
Expand Down
10 changes: 2 additions & 8 deletions tests/test_ase.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,14 @@
import numpy as np
import pytest

try:
import ase
except ModuleNotFoundError:
ase = None
pytest.importorskip("ase")

from ase.build import molecule
from ase.calculators import calculator

from skala.ase import Skala


@pytest.mark.skipif(ase is None, reason="ASE is not installed")
@pytest.mark.parametrize("xc", ["pbe", "tpss", "skala-1.0", "skala-1.1"])
def test_calc(xc: str) -> None:
atoms = molecule("H2O") # type: ignore[no-untyped-call]
Expand Down Expand Up @@ -49,7 +45,6 @@ def test_calc(xc: str) -> None:
)


@pytest.mark.skipif(ase is None, reason="ASE is not installed")
def test_missing_basis() -> None:
atoms = molecule("H2O") # type: ignore[no-untyped-call]
atoms.calc = Skala(xc="pbe", with_density_fit=True, auxbasis="def2-svp-jkfit")
Expand All @@ -60,9 +55,8 @@ def test_missing_basis() -> None:
atoms.get_potential_energy()


@pytest.mark.skipif(ase is None, reason="ASE is not installed")
def test_ks_config() -> None:
atoms = molecule("H2O")
atoms = molecule("H2O") # type: ignore[no-untyped-call]
atoms.calc = Skala(
xc="pbe",
basis="def2-svp",
Expand Down
Loading