dxtb.config.Config#

class dxtb.config.Config(*, file=None, strict=False, exclude=[], method=1, grad=False, batch_mode=0, int_cutoff=50.0, int_driver=0, int_level=2, int_uplo='l', anomaly=False, device=device(type='cpu'), dtype=torch.float32, maxiter=100, mixer=2, mix_guess=True, damp=0.5, damp_init=0.1, damp_dynamic=False, damp_dynamic_factor=0.99, damp_soft_start=True, damp_generations=5, damp_diagonal_offset=0.01, guess=0, scf_mode=0, scp_mode=2, x_atol=0.0001, x_atol_max=1e-05, f_atol=0.0001, force_convergence=False, fermi_etemp=300.0, fermi_maxiter=200, fermi_thresh=None, fermi_partition=0, cache_enabled=False, cache_hcore=False, cache_overlap=False, cache_dipole=False, cache_quadrupole=False, cache_charges=True, cache_coefficients=False, cache_density=False, cache_fock=False, cache_iterations=True, cache_mo_energies=False, cache_occupation=False, cache_potential=False, max_element=86, skip_compat_checks=False)[source]#

Bases: object

Configuration of the calculation.

Methods

from_args

Create a configuration from command-line arguments.

from_dict

Create a configuration from a dictionary.

from_json

Create a configuration from a JSON file.

info

Return a dictionary with the configuration information.

to_json

Serialize the configuration to a JSON-formatted string.

Attributes

batch_mode

Whether multiple systems or a single one are handled.

strict

Strict mode for SCF configuration.

file

The input file or directory.

exclude

The tight-binding components to exclude from the calculation.

method

The xTB method to use.

grad

Whether to compute the gradient.

max_element

The maximum element number in the system.

anomaly

Whether to run PyTorch in anomaly detection mode.

device

The device to use for the calculation.

dtype

The data type to use for the calculation.

cache

The cache configuration.

ints

The integral configuration.

scf

The SCF configuration.

Parameters:
classmethod from_args(args)[source]#

Create a configuration from command-line arguments.

Return type:

Self

Parameters:

args (Namespace) – The parsed command-line arguments.

Returns:

The configuration object.

Return type:

Self

Parameters:

args (Namespace)

classmethod from_dict(cfg)[source]#

Create a configuration from a dictionary.

Return type:

Self

Parameters:

cfg (dict[str, Any]) – The configuration dictionary.

Returns:

The configuration object.

Return type:

Self

Parameters:

cfg (dict[str, Any])

classmethod from_json(path)[source]#

Create a configuration from a JSON file.

Return type:

Self

Parameters:

path (PathLike) – The path to the JSON file.

Returns:

The configuration object.

Return type:

Self

Raises:

FileNotFoundError – If the file does not exist.

Parameters:

path (str | Path)

info()[source]#

Return a dictionary with the configuration information.

Return type:

dict[str, dict[str, Any]]

Returns:

The configuration information.

Return type:

dict[str, dict[str, Any]]

to_json(path=None)[source]#

Serialize the configuration to a JSON-formatted string.

Return type:

str

Parameters:

path (str | Path | None)

Returns:

str: A JSON-formatted string representing the configuration.

anomaly: bool#

Whether to run PyTorch in anomaly detection mode.

property batch_mode: int#

Whether multiple systems or a single one are handled.

The following batch modes are available:

  • 0: Single system

  • 1: Multiple systems with padding

  • 2: Multiple systems with no padding (conformer ensemble)

Returns:

The batch mode.

Return type:

int

cache: ConfigCache#

The cache configuration.

device: device#

The device to use for the calculation.

dtype: dtype#

The data type to use for the calculation.

exclude: str | list[str]#

The tight-binding components to exclude from the calculation.

file: str | Path | None#

The input file or directory.

grad: bool#

Whether to compute the gradient.

ints: ConfigIntegrals#

The integral configuration.

max_element: int#

The maximum element number in the system.

method: int#

The xTB method to use.

scf: ConfigSCF#

The SCF configuration.

strict: bool = False#

Strict mode for SCF configuration. Always throws errors if True.