Skip to content

Commit

Permalink
Update CI workflow (#59)
Browse files Browse the repository at this point in the history
* downgrade MacOS version
* add Python 3.11 and 3.12 for testing
* Fix ASE test for changed SumCalculator API
* Remove Python 3.7 support
  • Loading branch information
awvwgk authored Jun 7, 2024
1 parent 8996d8a commit 8e5fe4a
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 8 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
compiler: gnu
version: 8

- os: macos-latest
- os: macos-12
build: cmake
build-type: debug
compiler: gnu
Expand All @@ -36,7 +36,7 @@ jobs:
compiler: gnu
version: 9

- os: macos-latest
- os: macos-12
build: meson
build-type: debug
compiler: gnu
Expand Down Expand Up @@ -242,7 +242,7 @@ jobs:
matrix:
os: [ubuntu-latest]
gcc_v: [10]
python_v: ['3.7', '3.8', '3.9', '3.10']
python_v: ['3.8', '3.9', '3.10', '3.11', '3.12']

env:
FC: gfortran
Expand Down
12 changes: 10 additions & 2 deletions python/dftd3/test_ase.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
# You should have received a copy of the Lesser GNU General Public License
# along with s-dftd3. If not, see <https://www.gnu.org/licenses/>.

from typing import Iterator

import numpy as np
import pytest
from pytest import approx, raises
Expand All @@ -27,6 +29,12 @@
ase = None


def get_calcs(calc) -> Iterator[ase.calculators.calculator.Calculator]:
if hasattr(calc, "mixer"):
calc = calc.mixer
yield from calc.calcs


@pytest.mark.skipif(ase is None, reason="requires ase")
def test_ase_scand4():
thr = 1.0e-6
Expand Down Expand Up @@ -54,7 +62,7 @@ def test_ase_scand4():

atoms.calc = DFTD3(method="SCAN", damping="d3bj").add_calculator(EMT())
assert atoms.get_potential_energy() == approx(3.6452960962398406, abs=thr)
energies = [calc.get_potential_energy() for calc in atoms.calc.calcs]
energies = [calc.get_potential_energy() for calc in get_calcs(atoms.calc)]
assert energies == approx([-0.03880921894019244, 3.684105315180033], abs=thr)


Expand Down Expand Up @@ -87,5 +95,5 @@ def test_ase_tpssd4():

atoms.calc = DFTD3(method="TPSS", damping="d3zero").add_calculator(EMT())
assert atoms.get_potential_energy() == approx(4.963774668847532, abs=thr)
energies = [calc.get_potential_energy() for calc in atoms.calc.calcs]
energies = [calc.get_potential_energy() for calc in get_calcs(atoms.calc)]
assert energies == approx([-0.14230914516094673, 5.106083814008478], abs=thr)
2 changes: 1 addition & 1 deletion python/mesonpep517.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ classifiers = [
"Intended Audience :: Science/Research",
"Programming Language :: Fortran",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Topic :: Scientific/Engineering :: Chemistry",
"Topic :: Scientific/Engineering :: Physics",
]
Expand Down
4 changes: 2 additions & 2 deletions python/setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ classifiers =
Programming Language :: Fortran
Programming Language :: Python :: 3 :: Only
Programming Language :: Python :: 3
Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10
Programming Language :: Python :: 3.11
Programming Language :: Python :: 3.12
Topic :: Scientific/Engineering :: Chemistry

[options]
Expand All @@ -36,7 +36,7 @@ tests_require =
ase
pyscf
qcelemental
python_requires = >=3.7
python_requires = >=3.8

[options.extras_require]
ase = ase
Expand Down

0 comments on commit 8e5fe4a

Please sign in to comment.