Skip to content

Commit

Permalink
Actions Workflow (#154)
Browse files Browse the repository at this point in the history
  • Loading branch information
marvinfriede authored Jun 29, 2024
1 parent bbcaf14 commit 5366bec
Show file tree
Hide file tree
Showing 51 changed files with 781 additions and 244 deletions.
39 changes: 21 additions & 18 deletions .github/workflows/python.yml → .github/workflows/ubuntu.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
name: Tests
name: Tests (Ubuntu)

on:
push:
Expand All @@ -41,33 +41,34 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
os: [ubuntu-latest]
# python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
# torch-version: ["1.11.0", "1.12.1", "1.13.1", "2.0.1", "2.1.2", "2.2.2", "2.3.1"]
python-version: ["3.8", "3.9", "3.10", "3.11"]
torch-version: ["1.11.0", "1.12.1", "1.13.1", "2.0.1", "2.1.2", "2.2.2"]
exclude:
# Check latest versions here: https://download.pytorch.org/whl/torch/
#
# PyTorch now fully supports Python=<3.11
# see: https://github.com/pytorch/pytorch/issues/86566
#
# PyTorch does not support Python 3.12 (all platforms)
# PyTorch does now support Python 3.12 (Linux) for 2.2.0 and newer
# see: https://github.com/pytorch/pytorch/issues/110436
- os: ubuntu-latest
python-version: "3.12"
- os: macos-latest
python-version: "3.12"
- os: windows-latest
python-version: "3.12"
- python-version: "3.12"
torch-version: "1.11.0"
- python-version: "3.12"
torch-version: "1.12.1"
- python-version: "3.12"
torch-version: "1.13.1"
- python-version: "3.12"
torch-version: "2.0.1"
- python-version: "3.12"
torch-version: "2.1.2"
# PyTorch<1.13.0 does only support Python=<3.10
- python-version: "3.11"
torch-version: "1.11.0"
- python-version: "3.11"
torch-version: "1.12.1"
# On macOS and Windows, 1.13.x is also not supported for Python>=3.10
- os: macos-latest
python-version: "3.11"
torch-version: "1.13.1"
- os: windows-latest
python-version: "3.11"
torch-version: "1.13.1"

runs-on: ${{ matrix.os }}

Expand All @@ -80,7 +81,7 @@ jobs:
uses: actions/checkout@v3

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

Expand All @@ -106,3 +107,5 @@ jobs:
matrix.os == 'ubuntu-latest'
with:
files: ./coverage.xml # optional
token: ${{ secrets.CODECOV_TOKEN }} # required
verbose: true # optional (default = false)
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@
<a href="https://results.pre-commit.ci/latest/github/grimme-lab/dxtb/main">
<img src="https://results.pre-commit.ci/badge/github/grimme-lab/dxtb/main.svg" alt="pre-commit.ci Status"/>
</a>
<!-- <a href="https://codecov.io/gh/grimme-lab/dxtb">
<img src="https://codecov.io/gh/grimme-lab/dxtb/branch/main/graph/badge.svg?token=" alt="Coverage"/>
</a> -->
<a href="https://codecov.io/gh/grimme-lab/dxtb">
<img src="https://codecov.io/gh/grimme-lab/dxtb/branch/main/graph/badge.svg?token=O18EZ1CNE3" alt="Coverage"/>
</a>
<!---->
<br>
<!---->
Expand Down
11 changes: 11 additions & 0 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
numpy<2
pydantic>=2.0.0
scipy
tad-dftd3>=0.3.0
tad-dftd4>=0.2.0
tad-libcint>=0.1.0
tad-mctc>=0.2.0
tad-multicharge
tomli
tomli-w
torch>=1.11.0,<=2.2.2
sphinx
sphinx-book-theme
sphinx-copybutton
Expand Down
File renamed without changes.
File renamed without changes.
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,13 @@ plugins = ["covdefaults"]
source = ["./src"]
omit = [
"./src/dxtb/_src/exlibs/xitorch/*",
"./src/dxtb/_src/exlibs/scipy/*",
"./src/dxtb/_src/typing.py",
"./src/dxtb/components/*",
]

[tool.coverage.report]
fail_under = 80
fail_under = 75


[tool.isort]
Expand Down
2 changes: 1 addition & 1 deletion src/dxtb/__version__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@

__all__ = ["__version__", "__tversion__"]

__version__ = "0.0.1"
__version__ = "0.0.0"
"""Version of ``dxtb`` in semantic versioning."""
7 changes: 4 additions & 3 deletions src/dxtb/_src/calculators/types/analytical.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@

from dxtb import OutputHandler
from dxtb import integrals as ints
from dxtb import labels
from dxtb._src import ncoord, scf
from dxtb._src.components.interactions.container import Charges, Potential
from dxtb._src.components.interactions.field import efield as efield
Expand Down Expand Up @@ -326,7 +327,7 @@ def _forces_analytical(
self.integrals.overlap.to_pt(write_overlap)

# dipole integral
if self.opts.ints.level >= ints.levels.INTLEVEL_DIPOLE:
if self.opts.ints.level >= labels.INTLEVEL_DIPOLE:
OutputHandler.write_stdout_nf(" - Dipole ... ", v=3)
timer.start("Dipole Integral", parent_uid="Integrals")
intmats.dipole = self.integrals.build_dipole(positions)
Expand All @@ -339,7 +340,7 @@ def _forces_analytical(
self.integrals.dipole.to_pt(write_dipole)

# quadrupole integral
if self.opts.ints.level >= ints.levels.INTLEVEL_QUADRUPOLE:
if self.opts.ints.level >= labels.INTLEVEL_QUADRUPOLE:
OutputHandler.write_stdout_nf(" - Quadrupole ... ", v=3)
timer.start("Quadrupole Integral", parent_uid="Integrals")
intmats.quadrupole = self.integrals.build_quadrupole(positions)
Expand All @@ -358,7 +359,7 @@ def _forces_analytical(
# To avoid unnecessary data transfer, the core Hamiltonian should
# be last. Internally, the overlap integral is only transfered back
# to GPU when all multipole integrals are calculated.
if self.opts.ints.level >= ints.levels.INTLEVEL_HCORE:
if self.opts.ints.level >= labels.INTLEVEL_HCORE:
OutputHandler.write_stdout_nf(" - Core Hamiltonian ... ", v=3)
timer.start("Core Hamiltonian", parent_uid="Integrals")
intmats.hcore = self.integrals.build_hcore(positions)
Expand Down
23 changes: 10 additions & 13 deletions src/dxtb/_src/calculators/types/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ class and implement the :meth:`calculate` method and the corresponding methods

from dxtb import IndexHelper, OutputHandler
from dxtb import integrals as ints
from dxtb import labels
from dxtb._src.calculators.properties.vibration import IRResult, RamanResult, VibResult
from dxtb._src.components.classicals import (
Classical,
Expand Down Expand Up @@ -565,40 +566,36 @@ def __init__(

# figure out integral level from interactions
if efield.LABEL_EFIELD in self.interactions.labels:
if self.opts.ints.level < ints.levels.INTLEVEL_DIPOLE:
if self.opts.ints.level < labels.INTLEVEL_DIPOLE:
OutputHandler.warn(
"Setting integral level to DIPOLE "
f"({ints.levels.INTLEVEL_DIPOLE}) due to electric field "
f"({labels.INTLEVEL_DIPOLE}) due to electric field "
"interaction."
)
self.opts.ints.level = max(
ints.levels.INTLEVEL_DIPOLE, self.opts.ints.level
)
self.opts.ints.level = max(labels.INTLEVEL_DIPOLE, self.opts.ints.level)
if efield_grad.LABEL_EFIELD_GRAD in self.interactions.labels:
if self.opts.ints.level < ints.levels.INTLEVEL_DIPOLE:
if self.opts.ints.level < labels.INTLEVEL_DIPOLE:
OutputHandler.warn(
"Setting integral level to QUADRUPOLE "
f"{ints.levels.INTLEVEL_DIPOLE} due to electric field "
f"{labels.INTLEVEL_DIPOLE} due to electric field "
"gradient interaction."
)
self.opts.ints.level = max(
ints.levels.INTLEVEL_QUADRUPOLE, self.opts.ints.level
)
self.opts.ints.level = max(labels.INTLEVEL_QUADRUPOLE, self.opts.ints.level)

# setup integral
driver = self.opts.ints.driver
self.integrals = ints.Integrals(
numbers, par, self.ihelp, driver=driver, intlevel=self.opts.ints.level, **dd
)

if self.opts.ints.level >= ints.levels.INTLEVEL_OVERLAP:
if self.opts.ints.level >= labels.INTLEVEL_OVERLAP:
self.integrals.hcore = ints.types.HCore(numbers, par, self.ihelp, **dd)
self.integrals.overlap = ints.types.Overlap(driver=driver, **dd)

if self.opts.ints.level >= ints.levels.INTLEVEL_DIPOLE:
if self.opts.ints.level >= labels.INTLEVEL_DIPOLE:
self.integrals.dipole = ints.types.Dipole(driver=driver, **dd)

if self.opts.ints.level >= ints.levels.INTLEVEL_QUADRUPOLE:
if self.opts.ints.level >= labels.INTLEVEL_QUADRUPOLE:
self.integrals.quadrupole = ints.types.Quadrupole(driver=driver, **dd)

OutputHandler.write_stdout("done\n", v=4)
Expand Down
7 changes: 4 additions & 3 deletions src/dxtb/_src/calculators/types/energy.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@

from dxtb import OutputHandler
from dxtb import integrals as ints
from dxtb import labels
from dxtb._src import scf
from dxtb._src.constants import defaults
from dxtb._src.integral.container import IntegralMatrices
Expand Down Expand Up @@ -171,7 +172,7 @@ def singlepoint(
self.integrals.overlap.to_pt(write_overlap)

# dipole integral
if self.opts.ints.level >= ints.levels.INTLEVEL_DIPOLE:
if self.opts.ints.level >= labels.INTLEVEL_DIPOLE:
OutputHandler.write_stdout_nf(" - Dipole ... ", v=3)
timer.start("Dipole Integral", parent_uid="Integrals")
intmats.dipole = self.integrals.build_dipole(positions)
Expand All @@ -184,7 +185,7 @@ def singlepoint(
self.integrals.dipole.to_pt(write_dipole)

# quadrupole integral
if self.opts.ints.level >= ints.levels.INTLEVEL_QUADRUPOLE:
if self.opts.ints.level >= labels.INTLEVEL_QUADRUPOLE:
OutputHandler.write_stdout_nf(" - Quadrupole ... ", v=3)
timer.start("Quadrupole Integral", parent_uid="Integrals")
intmats.quadrupole = self.integrals.build_quadrupole(positions)
Expand All @@ -203,7 +204,7 @@ def singlepoint(
# To avoid unnecessary data transfer, the core Hamiltonian should
# be last. Internally, the overlap integral is only transfered back
# to GPU when all multipole integrals are calculated.
if self.opts.ints.level >= ints.levels.INTLEVEL_HCORE:
if self.opts.ints.level >= labels.INTLEVEL_HCORE:
OutputHandler.write_stdout_nf(" - Core Hamiltonian ... ", v=3)
timer.start("Core Hamiltonian", parent_uid="Integrals")
intmats.hcore = self.integrals.build_hcore(positions)
Expand Down
28 changes: 25 additions & 3 deletions src/dxtb/_src/constants/labels/integrals.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,26 @@
All labels related to integrals and their computation.
"""

# integral driver
__all__ = [
"INTDRIVER_LIBCINT",
"INTDRIVER_LIBCINT_STRS",
"INTDRIVER_AUTOGRAD",
"INTDRIVER_AUTOGRAD_STRS",
"INTDRIVER_ANALYTICAL",
"INTDRIVER_ANALYTICAL_STRS",
"INTDRIVER_LEGACY",
"INTDRIVER_LEGACY_STRS",
"INTDRIVER_MAP",
#
"INTLEVEL_NONE",
"INTLEVEL_OVERLAP",
"INTLEVEL_HCORE",
"INTLEVEL_DIPOLE",
"INTLEVEL_QUADRUPOLE",
]

# integral drivers

INTDRIVER_LIBCINT = 0
"""Integer code for LIBCINT driver."""

Expand Down Expand Up @@ -57,8 +76,11 @@
INTLEVEL_OVERLAP = 1
"""Overlap integrals."""

INTLEVEL_DIPOLE = 2
INTLEVEL_HCORE = 2
"""Core Hamiltonian integrals."""

INTLEVEL_DIPOLE = 3
"""Dipole integrals."""

INTLEVEL_QUADRUPOLE = 3
INTLEVEL_QUADRUPOLE = 4
"""Quadrupole integrals."""
2 changes: 1 addition & 1 deletion src/dxtb/_src/exlibs/libcint/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

try:
from tad_libcint.basis import AtomCGTOBasis, CGTOBasis
from tad_libcint.interface.intor import int1e, overlap
from tad_libcint.interface.integrals import int1e, overlap
from tad_libcint.interface.wrapper import LibcintWrapper
except ImportError as e:
raise ImportError(
Expand Down
11 changes: 5 additions & 6 deletions src/dxtb/_src/integral/container.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,11 @@

import torch

from dxtb import IndexHelper
from dxtb import IndexHelper, labels
from dxtb._src.constants import defaults, labels
from dxtb._src.param import Param
from dxtb._src.typing import Any, Tensor

from . import levels
from .base import IntDriver, IntegralContainer
from .types import Dipole, HCore, Overlap, Quadrupole

Expand Down Expand Up @@ -216,7 +215,7 @@ def build_overlap(self, positions: Tensor, **kwargs: Any) -> Tensor:
# move integral to the correct device...
if self.force_cpu_for_libcint is True:
# ... but only if no other multipole integrals are required
if self._intlevel <= levels.INTLEVEL_HCORE:
if self._intlevel <= labels.INTLEVEL_HCORE:
self.overlap.integral = self.overlap.integral.to(device=self.device)

# FIXME: The matrix has to be moved explicitly, because when
Expand Down Expand Up @@ -301,7 +300,7 @@ def build_dipole(self, positions: Tensor, shift: bool = True, **kwargs: Any):

# move integral to the correct device, but only if no other multipole
# integrals are required
if self.force_cpu_for_libcint and self._intlevel <= levels.INTLEVEL_DIPOLE:
if self.force_cpu_for_libcint and self._intlevel <= labels.INTLEVEL_DIPOLE:
self.dipole.integral = self.dipole.integral.to(device=self.device)
self.dipole.integral.matrix = self.dipole.integral.matrix.to(
device=self.device
Expand Down Expand Up @@ -389,7 +388,7 @@ def build_quadrupole(

# move integral to the correct device, but only if no other multipole
# integrals are required
if self.force_cpu_for_libcint and self._intlevel <= levels.INTLEVEL_QUADRUPOLE:
if self.force_cpu_for_libcint and self._intlevel <= labels.INTLEVEL_QUADRUPOLE:
self.overlap.integral = self.overlap.integral.to(self.device)
self.overlap.integral.matrix = self.overlap.integral.matrix.to(self.device)

Expand Down Expand Up @@ -448,7 +447,7 @@ def checks(self) -> None:

if name != "hcore":
family_integral = cls.integral.family # type: ignore
family_driver = self.driver.family
family_driver = self.driver.family # type: ignore
if family_integral != family_driver:
raise RuntimeError(
f"The '{cls.integral.label}' integral implementation "
Expand Down
45 changes: 0 additions & 45 deletions src/dxtb/_src/integral/levels.py

This file was deleted.

Loading

0 comments on commit 5366bec

Please sign in to comment.