Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pull] main from grimme-lab:main #15

Merged
merged 1 commit into from
Mar 7, 2025
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 README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ With *dxtb*, we provide a re-implementation of the xTB methods in PyTorch, which
pip install dxtb[libcint]
```

Installing the libcint interface is highly recommended, as it is significantly faster than the pure PyTorch implementation and provides access to higher-order multipole integrals and their derivatives.
Installing the libcint interface is highly recommended, as it is significantly faster than the pure PyTorch implementation and provides access to higher-order multipole integrals and their derivatives (**required for GFN2-xTB**).
However, the interface is currently only available on Linux.

### conda <a href="https://anaconda.org/conda-forge/dxtb"><img src="https://img.shields.io/conda/vn/conda-forge/dxtb.svg" alt="Conda Version"></a> <a href="https://anaconda.org/conda-forge/dxtb"><img src="https://img.shields.io/conda/dn/conda-forge/dxtb?style=flat&color=orange" alt="Conda Downloads"></a>
Expand Down
8 changes: 8 additions & 0 deletions src/dxtb/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,14 @@
# import timer first to get correct total time
from dxtb._src.timing import timer, kill_timer


from os import getenv

if getenv("DXTB_TIMER", "False").lower() not in ("true", "1", "yes", "on"):
timer.disable()
del getenv


timer.start("Import")
timer.start("PyTorch", parent_uid="Import")
import torch
Expand Down
13 changes: 12 additions & 1 deletion src/dxtb/_src/calculators/types/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,18 @@ def __init__(
dtype : torch.dtype | None, optional
Data type of the tensor. If ``None`` (default), the data type is
inferred.
"""
kwargs : Any
Additional keyword arguments.
- ``auto_int_level``: Automatically set the integral level based on
the parametrization. Defaults to ``True``. This should only be
turned off for testing purposes.
- ``timer``: Enable the timer. Defaults to ``False``. The global
timer can also be enabled by setting the environment variable
``DXTB_TIMER`` to ``1``.
"""
if not timer.enabled and kwargs.pop("timer", False):
timer.enable()

timer.start("Calculator", parent_uid="Setup")

# setup verbosity first
Expand Down
8 changes: 8 additions & 0 deletions src/dxtb/_src/cli/argparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,14 @@ def parser(name: str = "dxtb", **kwargs: Any) -> argparse.ArgumentParser:
action="store_true",
help="R|Whether to use strict mode. Throws errors on warnings.",
)
p.add_argument(
"--timer",
action="store_true",
help=(
"R|Whether to enable the timer for the calculator. For the "
"global timer, set the environment variable 'DXTB_TIMER=1'."
),
)
p.add_argument(
"--efield",
type=float,
Expand Down
13 changes: 10 additions & 3 deletions src/dxtb/_src/cli/driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,12 @@ def _set_attr(self, attr: str) -> int | list[int]:
return vals

def singlepoint(self) -> Result | Tensor:
timer.start("Setup")

args = self.args

if timer.enabled is False and args.timer is True:
timer.enable()
timer.start("Setup")

# logging.basicConfig(
# level=args.loglevel.upper(),
# format="%(asctime)s %(levelname)s %(name)s::%(funcName)s -> %(message)s",
Expand Down Expand Up @@ -223,7 +225,12 @@ def singlepoint(self) -> Result | Tensor:

# setup calculator
calc = Calculator(
numbers, par, opts=config, interaction=interactions, **dd
numbers,
par,
opts=config,
interaction=interactions,
**dd,
timer=args.timer,
)
timer.stop("Setup")

Expand Down