Skip to main content

Fully Differentiable Extended Tight-Binding

- Combining semi-empirical quantum chemistry with machine learning in PyTorch -

Release Apache-2.0
Test Status Ubuntu Test Status macOS (ARM) Test Status Windows
Build Status Documentation Status pre-commit.ci Status Coverage
Python Versions PyTorch Versions


The xTB methods (GFNn-xTB) are a series of semi-empirical quantum chemical methods that provide a good balance between accuracy and computational cost.

With dxtb, we provide a re-implementation of the xTB methods in PyTorch, which allows for automatic differentiation and seamless integration into machine learning frameworks.

NOTE: If you encounter any bugs or have questions on how to use dxtb, feel free to open an issue.

Installation

pip PyPI Version PyPI Downloads

dxtb can easily be installed with pip.

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 (required for GFN2-xTB). However, the interface is currently only available on Linux.

conda Conda Version Conda Downloads

dxtb is also available on conda from the conda-forge channel.

mamba install dxtb

Don't forget to install the libcint interface (not on conda) via pip install tad-libcint. The libcint interface is required for GFN2-xTB.

For Windows, dxtb is not available via conda, because PyTorch itself is not registered in the conda-forge channel.

Other

For more options, see the installation guide in the documentation.

Example

The following example demonstrates how to compute the energy and forces using GFN1-xTB.

import torch
import dxtb

dd = {"dtype": torch.double, "device": torch.device("cpu")}

# LiH
numbers = torch.tensor([3, 1], device=dd["device"])
positions = torch.tensor([[0.0, 0.0, 0.0], [0.0, 0.0, 1.5]], **dd)

# instantiate a calculator
calc = dxtb.calculators.GFN1Calculator(numbers, **dd)

# compute the energy
pos = positions.clone().requires_grad_(True)
energy = calc.get_energy(pos)

# obtain gradient (dE/dR) via autograd
(g,) = torch.autograd.grad(energy, pos)

# Alternatively, forces can directly be requested from the calculator.
# (Don't forget to manually reset the calculator when the inputs are identical.)
calc.reset()
pos = positions.clone().requires_grad_(True)
forces = calc.get_forces(pos)

assert torch.equal(forces, -g)

All quantities are in atomic units.

For more examples and details, check out the documentation.

Compatibility

PyTorch \ Python 3.8 3.9 3.10 3.11 3.12 3.13 3.14
1.11.0 :white_check_mark: :white_check_mark: :x: :x: :x: :x: :x:
1.12.1 :white_check_mark: :white_check_mark: :white_check_mark: :x: :x: :x: :x:
1.13.1 :white_check_mark: :white_check_mark: :white_check_mark: :white_check_mark: :x: :x: :x:
2.0.1 :white_check_mark: :white_check_mark: :white_check_mark: :white_check_mark: :x: :x: :x:
2.1.2 :white_check_mark: :white_check_mark: :white_check_mark: :white_check_mark: :x: :x: :x:
2.2.2 :white_check_mark: :white_check_mark: :white_check_mark: :white_check_mark: :white_check_mark: :x: :x:
2.3.1 :white_check_mark: :white_check_mark: :white_check_mark: :white_check_mark: :white_check_mark: :x: :x:
2.4.1 :white_check_mark: :white_check_mark: :white_check_mark: :white_check_mark: :white_check_mark: :x: :x:
2.5.1 :x: :white_check_mark: :white_check_mark: :white_check_mark: :white_check_mark: :x: :x:
2.6.0 :x: :white_check_mark: :white_check_mark: :white_check_mark: :white_check_mark: :white_check_mark: :x:
2.7.1 :x: :white_check_mark: :white_check_mark: :white_check_mark: :white_check_mark: :white_check_mark: :x:
2.8.0 :x: :white_check_mark: :white_check_mark: :white_check_mark: :white_check_mark: :white_check_mark: :x:
2.9.1 :x: :x: :white_check_mark: :white_check_mark: :white_check_mark: :white_check_mark: :white_check_mark:
2.10.0 :x: :x: :white_check_mark: :white_check_mark: :white_check_mark: :white_check_mark: :white_check_mark:

Note that only the latest bug fix version is listed, but all preceding bug fix minor versions are supported. For example, although only version 2.2.2 is listed, version 2.2.0 and 2.2.1 are also supported.

Restriction for macOS and Windows:

On macOS and Windows, PyTorch<2.0.0 does only support Python<3.11.

The libcint interface is not available for macOS and Windows. Correspondingly, the integral evaluation can be considerably slower. Moreover, higher-order multipole integrals (dipole, quadrupole, ...) are not implemented. While macOS support may be considered in the future, native Windows support is not possible, because the underlying libcint library does not work under Windows.

Citation

If you use dxtb in your research, please cite the following paper:

  • M. Friede, C. Hölzer, S. Ehlert, S. Grimme, dxtb -- An Efficient and Fully Differentiable Framework for Extended Tight-Binding, J. Chem. Phys., 2024, 161, 062501. (DOI)

The Supporting Information can be found here.

For details on the xTB methods, see

  • C. Bannwarth, E. Caldeweyher, S. Ehlert, A. Hansen, P. Pracht, J. Seibert, S. Spicher, S. Grimme, WIREs Comput. Mol. Sci., 2020, 11, e01493. (DOI)
  • C. Bannwarth, S. Ehlert, S. Grimme, J. Chem. Theory Comput., 2019, 15, 1652-1671. (DOI)
  • S. Grimme, C. Bannwarth, P. Shushkov, J. Chem. Theory Comput., 2017, 13, 1989-2009. (DOI)

Contributing

This is a volunteer open source projects and contributions are always welcome. Please, take a moment to read the contributing guidelines.

License

This project is licensed under the Apache License, Version 2.0 (the "License"); you may not use this project's files except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, 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.

Metadata

Release files for dxtb 0.4.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for dxtb 0.4.0
File Size Uploaded
dxtb-0.4.0.tar.gz 342.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for dxtb 0.4.0
File Interpreter ABI Platform
dxtb-0.4.0-py3-none-any.whl Python 3 none any Details

Total release size: 887.0 kB

Release files / dxtb-0.4.0.tar.gz

Download URL dxtb-0.4.0.tar.gz
Size 342.6 kB
Tags Source
SHA-256 checksum
How to use checksums
80bba3b3c5c779297d8be3390afde962a1a0ac3971028eaeb5bb5a9b05f6e227
BLAKE2b-256 checksum
How to use checksums
07a86e593da5e2501ca6d4b94bdcf280f62993d433476c73c5772867b87452a2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 26, 2026.

Transparency log

Release files / dxtb-0.4.0-py3-none-any.whl

Download URL dxtb-0.4.0-py3-none-any.whl
Size 544.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5c5099c7fffc30715da7441f9141cd7e560c1fd8a951805b1550aac08d7564a5
BLAKE2b-256 checksum
How to use checksums
13c35a31911e65e86f1033b8d3cfd195b6b2f9a349da71f2d6b6f506343db61e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 26, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.4.0 This release

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.1

2 release files

0.1.0

2 release files

0.0.1

2 release files

0.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page