Skip to content

Commit

Permalink
Use labels as defaults, not strings
Browse files Browse the repository at this point in the history
  • Loading branch information
marvinfriede committed Sep 17, 2024
1 parent cb8fa6e commit ec2e50b
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
1 change: 1 addition & 0 deletions src/dxtb/_src/calculators/config/integral.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ def __init__(
labels.INTDRIVER_LIBCINT,
labels.INTDRIVER_ANALYTICAL,
labels.INTDRIVER_AUTOGRAD,
labels.INTDRIVER_LEGACY,
):
raise ValueError(f"Unknown integral driver '{driver}'.")

Expand Down
2 changes: 1 addition & 1 deletion src/dxtb/_src/calculators/config/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def __init__(
dtype: torch.dtype = get_default_dtype(),
# SCF
maxiter: int = defaults.MAXITER,
mixer: str = defaults.MIXER,
mixer: str | int = defaults.MIXER,
damp: float = defaults.DAMP,
guess: str | int = defaults.GUESS,
scf_mode: str | int = defaults.SCF_MODE,
Expand Down
2 changes: 1 addition & 1 deletion src/dxtb/_src/calculators/config/scf.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ def __init__(
strict: bool = False,
guess: str | int = defaults.GUESS,
maxiter: int = defaults.MAXITER,
mixer: str = defaults.MIXER,
mixer: str | int = defaults.MIXER,
damp: float = defaults.DAMP,
scf_mode: str | int = defaults.SCF_MODE,
scp_mode: str | int = defaults.SCP_MODE,
Expand Down
12 changes: 6 additions & 6 deletions src/dxtb/_src/constants/defaults.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
EINSUM_OPTIMIZE = "greedy"
"""Optimization algorithm for `einsum`."""

METHOD = "gfn1"
METHOD = labels.GFN1_XTB
"""General method for calculation from the xtb family."""

METHOD_CHOICES = ["gfn1", "gfn1-xtb", "gfn2", "gfn2-xtb"]
Expand Down Expand Up @@ -118,7 +118,7 @@

# SCF settings

GUESS = "eeq"
GUESS = labels.GUESS_EEQ
"""Initial guess for orbital charges."""

GUESS_CHOICES = ["eeq", "sad"]
Expand All @@ -130,13 +130,13 @@
MAXITER = 100
"""Maximum number of SCF iterations."""

MIXER = "broyden"
MIXER = labels.MIXER_BROYDEN
"""SCF mixing scheme for convergence acceleration."""

MIXER_CHOICES = ["anderson", "broyden", "simple"]
"""List of possible choices for ``MIXER``."""

SCF_MODE = "nonpure"
SCF_MODE = labels.SCF_MODE_IMPLICIT_NON_PURE
"""
Whether to use full gradient tracking in SCF, make use of the implicit
function theorem as provided by ``xitorch.optimize.equilibrium``, or use the
Expand All @@ -156,7 +156,7 @@
]
"""List of possible choices for ``SCF_MODE``."""

SCP_MODE = "potential"
SCP_MODE = labels.SCP_MODE_POTENTIAL
"""
Type of self-consistent parameter, i.e., which quantity is converged in the SCF
iterations.
Expand Down Expand Up @@ -207,7 +207,7 @@
}
"""Convergence thresholds for different float data types."""

FERMI_PARTITION = "equal"
FERMI_PARTITION = labels.FERMI_PARTITION_EQUAL
"""Partitioning scheme for electronic free energy."""

FERMI_PARTITION_CHOICES = ["equal", "atomic"]
Expand Down
1 change: 0 additions & 1 deletion test/test_config/test_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import pytest

from dxtb._src.constants import defaults, labels
from dxtb._src.exlibs.available import has_libcint
from dxtb._src.typing import get_default_device, get_default_dtype
from dxtb.config import Config as Cfg

Expand Down

0 comments on commit ec2e50b

Please sign in to comment.