<h1 align="center"><img src="assets/logo.png" width="300"></h3>
<h3 align="center">Fully Differentiable Extended Tight-Binding</h3>
<p align="center">- Combining semi-empirical quantum chemistry with machine learning in PyTorch -</p>
<p align="center">
<a href="https://github.com/grimme-lab/dxtb/releases/latest">
<img src="https://img.shields.io/github/v/release/grimme-lab/dxtb?color=orange" alt="Release"/>
</a>
<a href="http://www.apache.org/licenses/LICENSE-2.0">
<img src="https://img.shields.io/badge/License-Apache%202.0-orange.svg" alt="Apache-2.0"/>
</a>
<!---->
<br>
<!---->
<a href="https://github.com/grimme-lab/dxtb/actions/workflows/ubuntu.yaml">
<img src="https://github.com/grimme-lab/dxtb/actions/workflows/ubuntu.yaml/badge.svg" alt="Test Status Ubuntu"/>
</a>
<a href="https://github.com/tgrimme-lab/dxtb/actions/workflows/macos-x86.yaml">
<img src="https://github.com/grimme-lab/dxtb/actions/workflows/macos-x86.yaml/badge.svg" alt="Test Status macOS (x86)"/>
</a>
<a href="https://github.com/tgrimme-lab/dxtb/actions/workflows/macos-arm.yaml">
<img src="https://github.com/grimme-lab/dxtb/actions/workflows/macos-arm.yaml/badge.svg" alt="Test Status macOS (ARM)"/>
</a>
<a href="https://github.com/grimme-lab/dxtb/actions/workflows/windows.yaml">
<img src="https://github.com/grimme-lab/dxtb/actions/workflows/windows.yaml/badge.svg" alt="Test Status Windows"/>
</a>
<!---->
<br>
<!---->
<a href="https://github.com/grimme-lab/dxtb/actions/workflows/release.yaml">
<img src="https://github.com/grimme-lab/dxtb/actions/workflows/release.yaml/badge.svg" alt="Build Status"/>
</a>
<a href="https://dxtb.readthedocs.io">
<img src="https://readthedocs.org/projects/dxtb/badge/?version=latest" alt="Documentation Status"/>
</a>
<a href="https://results.pre-commit.ci/latest/github/grimme-lab/dxtb/main">
<img src="https://results.pre-commit.ci/badge/github/grimme-lab/dxtb/main.svg" alt="pre-commit.ci Status"/>
</a>
<a href="https://codecov.io/gh/grimme-lab/dxtb">
<img src="https://codecov.io/gh/grimme-lab/dxtb/branch/main/graph/badge.svg?token=O18EZ1CNE3" alt="Coverage"/>
</a>
<!---->
<br>
<!---->
<a href="https://img.shields.io/badge/Python-3.8%20|%203.9%20|%203.10%20|%203.11%20|%203.12-blue.svg">
<img src="https://img.shields.io/badge/Python-3.8%20|%203.9%20|%203.10%20|%203.11%20|%203.12-blue.svg" alt="Python Versions"/>
</a>
<a href="https://img.shields.io/badge/PyTorch-%3E=1.11.0-blue.svg">
<img src="https://img.shields.io/badge/PyTorch-%3E=1.11.0-blue.svg" alt="PyTorch Versions"/>
</a>
</p>
<br>
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](https://github.com/grimme-lab/dxtb/issues).
## Installation
### pip <a href="https://pypi.org/project/dxtb/"><img src="https://img.shields.io/pypi/v/dxtb" alt="PyPI Version"></a> <a href="https://pypi.org/project/dxtb/"><img src="https://img.shields.io/pypi/dm/dxtb?color=orange" alt="PyPI Downloads"></a>
*dxtb* can easily be installed with ``pip``.
```sh
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.
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>
*dxtb* is also available on [``conda``](https://conda.io/) from the *conda-forge* channel.
```sh
mamba install dxtb
```
Don't forget to install the libcint interface (not on conda) via ``pip install tad-libcint``.
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](https://dxtb.readthedocs.io/en/latest/01_quickstart/installation.html) in the documentation.
## Example
The following example demonstrates how to compute the energy and forces using GFN1-xTB.
```python
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](https://dxtb.readthedocs.io).
## Compatibility
| PyTorch \ Python | 3.8 | 3.9 | 3.10 | 3.11 | 3.12 |
|------------------|--------------------|--------------------|--------------------|--------------------|--------------------|
| 1.11.0 | :white_check_mark: | :white_check_mark: | :x: | :x: | :x: |
| 1.12.1 | :white_check_mark: | :white_check_mark: | :white_check_mark: | :x: | :x: |
| 1.13.1 | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :x: |
| 2.0.1 | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :x: |
| 2.1.2 | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :x: |
| 2.2.2 | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
| 2.3.1 | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
| 2.4.1 | :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](https://github.com/sunqm/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](https://doi.org/10.1063/5.0216715))
The Supporting Information can be found [here](https://github.com/grimme-lab/dxtb-data).
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](https://doi.org/10.1002/wcms.1493))
- C. Bannwarth, S. Ehlert, S. Grimme,
*J. Chem. Theory Comput.*, **2019**, 15, 1652-1671.
([DOI](https://dx.doi.org/10.1021/acs.jctc.8b01176))
- S. Grimme, C. Bannwarth, P. Shushkov,
*J. Chem. Theory Comput.*, **2017**, 13, 1989-2009.
([DOI](https://dx.doi.org/10.1021/acs.jctc.7b00118))
## Contributing
This is a volunteer open source projects and contributions are always welcome.
Please, take a moment to read the [contributing guidelines](CONTRIBUTING.md).
## 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.
Raw data
{
"_id": null,
"home_page": "https://github.com/grimme-lab/dxtb",
"name": "dxtb",
"maintainer": null,
"docs_url": null,
"requires_python": "<3.13,>=3.8",
"maintainer_email": null,
"keywords": "pytorch, autograd, tight-binding, xtb, computational chemistry, quantum chemistry, machine learning",
"author": "\"Sebastian Ehlert, Marvin Friede, Christian H\u00f6lzer\"",
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/a8/b9/4b83a455b73be9d54e8454f85af8c61d313b18a51357b81c04354599697a/dxtb-0.1.1.tar.gz",
"platform": null,
"description": "<h1 align=\"center\"><img src=\"assets/logo.png\" width=\"300\"></h3>\n\n<h3 align=\"center\">Fully Differentiable Extended Tight-Binding</h3>\n<p align=\"center\">- Combining semi-empirical quantum chemistry with machine learning in PyTorch -</p>\n\n<p align=\"center\">\n <a href=\"https://github.com/grimme-lab/dxtb/releases/latest\">\n <img src=\"https://img.shields.io/github/v/release/grimme-lab/dxtb?color=orange\" alt=\"Release\"/>\n </a>\n <a href=\"http://www.apache.org/licenses/LICENSE-2.0\">\n <img src=\"https://img.shields.io/badge/License-Apache%202.0-orange.svg\" alt=\"Apache-2.0\"/>\n </a>\n <!---->\n <br>\n <!---->\n <a href=\"https://github.com/grimme-lab/dxtb/actions/workflows/ubuntu.yaml\">\n <img src=\"https://github.com/grimme-lab/dxtb/actions/workflows/ubuntu.yaml/badge.svg\" alt=\"Test Status Ubuntu\"/>\n </a>\n <a href=\"https://github.com/tgrimme-lab/dxtb/actions/workflows/macos-x86.yaml\">\n <img src=\"https://github.com/grimme-lab/dxtb/actions/workflows/macos-x86.yaml/badge.svg\" alt=\"Test Status macOS (x86)\"/>\n </a>\n <a href=\"https://github.com/tgrimme-lab/dxtb/actions/workflows/macos-arm.yaml\">\n <img src=\"https://github.com/grimme-lab/dxtb/actions/workflows/macos-arm.yaml/badge.svg\" alt=\"Test Status macOS (ARM)\"/>\n </a>\n <a href=\"https://github.com/grimme-lab/dxtb/actions/workflows/windows.yaml\">\n <img src=\"https://github.com/grimme-lab/dxtb/actions/workflows/windows.yaml/badge.svg\" alt=\"Test Status Windows\"/>\n </a>\n <!---->\n <br>\n <!---->\n <a href=\"https://github.com/grimme-lab/dxtb/actions/workflows/release.yaml\">\n <img src=\"https://github.com/grimme-lab/dxtb/actions/workflows/release.yaml/badge.svg\" alt=\"Build Status\"/>\n </a>\n <a href=\"https://dxtb.readthedocs.io\">\n <img src=\"https://readthedocs.org/projects/dxtb/badge/?version=latest\" alt=\"Documentation Status\"/>\n </a>\n <a href=\"https://results.pre-commit.ci/latest/github/grimme-lab/dxtb/main\">\n <img src=\"https://results.pre-commit.ci/badge/github/grimme-lab/dxtb/main.svg\" alt=\"pre-commit.ci Status\"/>\n </a>\n <a href=\"https://codecov.io/gh/grimme-lab/dxtb\">\n <img src=\"https://codecov.io/gh/grimme-lab/dxtb/branch/main/graph/badge.svg?token=O18EZ1CNE3\" alt=\"Coverage\"/>\n </a>\n <!---->\n <br>\n <!---->\n <a href=\"https://img.shields.io/badge/Python-3.8%20|%203.9%20|%203.10%20|%203.11%20|%203.12-blue.svg\">\n <img src=\"https://img.shields.io/badge/Python-3.8%20|%203.9%20|%203.10%20|%203.11%20|%203.12-blue.svg\" alt=\"Python Versions\"/>\n </a>\n <a href=\"https://img.shields.io/badge/PyTorch-%3E=1.11.0-blue.svg\">\n <img src=\"https://img.shields.io/badge/PyTorch-%3E=1.11.0-blue.svg\" alt=\"PyTorch Versions\"/>\n </a>\n</p>\n\n<br>\n\nThe xTB methods (GFNn-xTB) are a series of semi-empirical quantum chemical methods that provide a good balance between accuracy and computational cost.\n\nWith *dxtb*, we provide a re-implementation of the xTB methods in PyTorch, which allows for automatic differentiation and seamless integration into machine learning frameworks.\n\n**NOTE**: If you encounter any bugs or have questions on how to use *dxtb*, feel free to open an [issue](https://github.com/grimme-lab/dxtb/issues).\n\n\n## Installation\n\n### pip <a href=\"https://pypi.org/project/dxtb/\"><img src=\"https://img.shields.io/pypi/v/dxtb\" alt=\"PyPI Version\"></a> <a href=\"https://pypi.org/project/dxtb/\"><img src=\"https://img.shields.io/pypi/dm/dxtb?color=orange\" alt=\"PyPI Downloads\"></a>\n\n*dxtb* can easily be installed with ``pip``.\n\n```sh\npip install dxtb[libcint]\n```\n\nInstalling 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.\nHowever, the interface is currently only available on Linux.\n\n### 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>\n\n\n*dxtb* is also available on [``conda``](https://conda.io/) from the *conda-forge* channel.\n\n```sh\nmamba install dxtb\n```\n\nDon't forget to install the libcint interface (not on conda) via ``pip install tad-libcint``.\n\nFor Windows, *dxtb* is not available via conda, because PyTorch itself is not registered in the conda-forge channel.\n\n### Other\n\nFor more options, see the [installation guide](https://dxtb.readthedocs.io/en/latest/01_quickstart/installation.html) in the documentation.\n\n\n## Example\n\nThe following example demonstrates how to compute the energy and forces using GFN1-xTB.\n\n```python\nimport torch\nimport dxtb\n\ndd = {\"dtype\": torch.double, \"device\": torch.device(\"cpu\")}\n\n# LiH\nnumbers = torch.tensor([3, 1], device=dd[\"device\"])\npositions = torch.tensor([[0.0, 0.0, 0.0], [0.0, 0.0, 1.5]], **dd)\n\n# instantiate a calculator\ncalc = dxtb.calculators.GFN1Calculator(numbers, **dd)\n\n# compute the energy\npos = positions.clone().requires_grad_(True)\nenergy = calc.get_energy(pos)\n\n# obtain gradient (dE/dR) via autograd\n(g,) = torch.autograd.grad(energy, pos)\n\n# Alternatively, forces can directly be requested from the calculator.\n# (Don't forget to manually reset the calculator when the inputs are identical.)\ncalc.reset()\npos = positions.clone().requires_grad_(True)\nforces = calc.get_forces(pos)\n\nassert torch.equal(forces, -g)\n```\n\nAll quantities are in atomic units.\n\nFor more examples and details, check out [the documentation](https://dxtb.readthedocs.io).\n\n## Compatibility\n\n| PyTorch \\ Python | 3.8 | 3.9 | 3.10 | 3.11 | 3.12 |\n|------------------|--------------------|--------------------|--------------------|--------------------|--------------------|\n| 1.11.0 | :white_check_mark: | :white_check_mark: | :x: | :x: | :x: |\n| 1.12.1 | :white_check_mark: | :white_check_mark: | :white_check_mark: | :x: | :x: |\n| 1.13.1 | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :x: |\n| 2.0.1 | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :x: |\n| 2.1.2 | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :x: |\n| 2.2.2 | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |\n| 2.3.1 | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |\n| 2.4.1 | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |\n\nNote that only the latest bug fix version is listed, but all preceding bug fix minor versions are supported.\nFor example, although only version 2.2.2 is listed, version 2.2.0 and 2.2.1 are also supported.\n\n**Restriction for macOS and Windows:**\n\nOn macOS and Windows, PyTorch<2.0.0 does only support Python<3.11.\n\nThe libcint interface is **not** available for macOS and Windows.\nCorrespondingly, the integral evaluation can be considerably slower.\nMoreover, higher-order multipole integrals (dipole, quadrupole, ...) are not implemented.\nWhile macOS support may be considered in the future, native Windows support is not possible, because the underlying [libcint](https://github.com/sunqm/libcint) library does not work under Windows.\n\n\n## Citation\n\nIf you use *dxtb* in your research, please cite the following paper:\n\n- M. Friede, C. H\u00f6lzer, S. Ehlert, S. Grimme, *dxtb -- An Efficient and Fully Differentiable Framework for Extended Tight-Binding*, *J. Chem. Phys.*, **2024**, 161, 062501. ([DOI](https://doi.org/10.1063/5.0216715))\n\nThe Supporting Information can be found [here](https://github.com/grimme-lab/dxtb-data).\n\n\nFor details on the xTB methods, see\n\n- C. Bannwarth, E. Caldeweyher, S. Ehlert, A. Hansen, P. Pracht, J. Seibert, S. Spicher, S. Grimme,\n *WIREs Comput. Mol. Sci.*, **2020**, 11, e01493.\n ([DOI](https://doi.org/10.1002/wcms.1493))\n- C. Bannwarth, S. Ehlert, S. Grimme,\n *J. Chem. Theory Comput.*, **2019**, 15, 1652-1671.\n ([DOI](https://dx.doi.org/10.1021/acs.jctc.8b01176))\n- S. Grimme, C. Bannwarth, P. Shushkov,\n *J. Chem. Theory Comput.*, **2017**, 13, 1989-2009.\n ([DOI](https://dx.doi.org/10.1021/acs.jctc.7b00118))\n\n\n## Contributing\n\nThis is a volunteer open source projects and contributions are always welcome.\nPlease, take a moment to read the [contributing guidelines](CONTRIBUTING.md).\n\n## License\n\nThis 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\n\nhttp://www.apache.org/licenses/LICENSE-2.0\n\nUnless 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.\n",
"bugtrack_url": null,
"license": "Apache-2.0",
"summary": "Fully Differentiable Approach to Extended Tight Binding",
"version": "0.1.1",
"project_urls": {
"Documentation": "https://github.com/grimme-lab/dxtb",
"Homepage": "https://github.com/grimme-lab/dxtb",
"Source Code": "https://github.com/grimme-lab/dxtb",
"Tracker": "https://github.com/grimme-lab/dxtb/issues"
},
"split_keywords": [
"pytorch",
" autograd",
" tight-binding",
" xtb",
" computational chemistry",
" quantum chemistry",
" machine learning"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "fd130f1aac4abc05144e8ede4afd3431f6816d1d00b540d0f12d121a6dea1936",
"md5": "e4f6baf07de9206f6fafd9632549ac57",
"sha256": "1cfbbfc7812903a2cb89849677eb681cf2cad87d4e5351b51e28193ae3c84bab"
},
"downloads": -1,
"filename": "dxtb-0.1.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "e4f6baf07de9206f6fafd9632549ac57",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<3.13,>=3.8",
"size": 508631,
"upload_time": "2024-10-21T18:46:04",
"upload_time_iso_8601": "2024-10-21T18:46:04.993691Z",
"url": "https://files.pythonhosted.org/packages/fd/13/0f1aac4abc05144e8ede4afd3431f6816d1d00b540d0f12d121a6dea1936/dxtb-0.1.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "a8b94b83a455b73be9d54e8454f85af8c61d313b18a51357b81c04354599697a",
"md5": "6074b9d2e443f5d6ecfd8d3a3a2e8773",
"sha256": "f578b2fb9b9ded19c10770ac9c386d5c3afef79f5c3bc403464e99b708d8fff8"
},
"downloads": -1,
"filename": "dxtb-0.1.1.tar.gz",
"has_sig": false,
"md5_digest": "6074b9d2e443f5d6ecfd8d3a3a2e8773",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<3.13,>=3.8",
"size": 317711,
"upload_time": "2024-10-21T18:46:06",
"upload_time_iso_8601": "2024-10-21T18:46:06.478937Z",
"url": "https://files.pythonhosted.org/packages/a8/b9/4b83a455b73be9d54e8454f85af8c61d313b18a51357b81c04354599697a/dxtb-0.1.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-10-21 18:46:06",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "grimme-lab",
"github_project": "dxtb",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"tox": true,
"lcname": "dxtb"
}