Fully Differentiable Approach to Extended Tight Binding
Project description
Fully Differentiable Extended Tight-Binding
- Combining semi-empirical quantum chemistry with machine learning in PyTorch -
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.
Installation
pip
dxtb can easily be installed with pip
.
pip install dxtb
conda
dxtb is also available on conda.
conda install dxtb
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 reset the calculator manually when the inputs are identical.)
calc.reset()
pos = positions.clone().requires_grad_(True)
forces = calc.get_forces(pos)
assert torch.equal(forces, -g)
For more examples and details, check out the documentation.
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
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.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file dxtb-0.0.0.tar.gz
.
File metadata
- Download URL: dxtb-0.0.0.tar.gz
- Upload date:
- Size: 314.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.15
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0f2dc9cfdfa441178da0865a97cea5bbbcdbdca820a69538b7aa0222fa0cfdb8 |
|
MD5 | 6fe4a0fdcdb192aadb8641fd17908d43 |
|
BLAKE2b-256 | 1c52ab34cfcb3ace261de37f520af8d39ead83e95d32fa0670d32cd1a709bd33 |
File details
Details for the file dxtb-0.0.0-py3-none-any.whl
.
File metadata
- Download URL: dxtb-0.0.0-py3-none-any.whl
- Upload date:
- Size: 504.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.15
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5869d985c9aa1bad5853cc551500facaba376eb08e501fbda29dec03772556f9 |
|
MD5 | d3b7b2fe08b4afd70561f1af3da4012a |
|
BLAKE2b-256 | 475e1b4e50e598cf26c64bf9ea76cfe84dbe92961a32048ed96a36bf35d8ac33 |