Skip to main content

Light-weight tight-binding framework

Project description

This directory contains the Python API of the tblite project.

This interface provides access to the C-API of tblite via the CFFI module. The low-level CFFI interface is available in the tblite.library module and only required for implementing other interfaces. A more pythonic interface is provided in the tblite.interface module which can be used to build more specific interfaces.

from tblite.interface import Calculator
import numpy as np
numbers = np.array([1, 1, 6, 5, 1, 15, 8, 17, 13, 15, 5, 1, 9, 15, 1, 15])
positions = np.array([  # Coordinates in Bohr
    [+2.79274810283778, +3.82998228828316, -2.79287054959216],
    [-1.43447454186833, +0.43418729987882, +5.53854345129809],
    [-3.26268343665218, -2.50644032426151, -1.56631149351046],
    [+2.14548759959147, -0.88798018953965, -2.24592534506187],
    [-4.30233097423181, -3.93631518670031, -0.48930754109119],
    [+0.06107643564880, -3.82467931731366, -2.22333344469482],
    [+0.41168550401858, +0.58105573172764, +5.56854609916143],
    [+4.41363836635653, +3.92515871809283, +2.57961724984000],
    [+1.33707758998700, +1.40194471661647, +1.97530004949523],
    [+3.08342709834868, +1.72520024666801, -4.42666116106828],
    [-3.02346932078505, +0.04438199934191, -0.27636197425010],
    [+1.11508390868455, -0.97617412809198, +6.25462847718180],
    [+0.61938955433011, +2.17903547389232, -6.21279842416963],
    [-2.67491681346835, +3.00175899761859, +1.05038813614845],
    [-4.13181080289514, -2.34226739863660, -3.44356159392859],
    [+2.85007173009739, -2.64884892757600, +0.71010806424206],
])
calc = Calculator("GFN2-xTB", numbers, positions)
res = calc.singlepoint()
print(res.get("energy"))  # Results in atomic units
# => -31.716159156026254

Building the extension module

The Python bindings can be built against an existing installation of tblite or free-standing. The free-standing implementation will select a matching version of the shared library, when building against an existing tblite library the API version of the two parts must match.

Setuptools build

This project support installation with pip as an easy way to build the Python API.

  • C compiler to build the C-API and compile the extension module (the compiler name should be exported in the CC environment variable)

  • Python 3.6 or newer

  • The following Python packages are required additionally

Ensure that you can find tblite via

pkg-config --modversion tblite

Adjust the PKG_CONFIG_PATH environment variable to include the correct directories to find the installation if necessary. Alternatively, you can set the TBLITE_PREFIX environment variable to point to the installation of the library.

Make sure to have your C compiler set to the CC environment variable

export CC=gcc

Install the project with pip

pip install .

Using meson

This directory contains a separate meson build file to allow the out-of-tree build of the CFFI extension module. The out-of-tree build requires

  • C compiler to build the C-API and compile the extension module

  • meson version 0.57.2 or newer

  • a build-system backend, i.e. ninja version 1.7 or newer

  • Python 3.6 or newer with the CFFI package installed

To make a free-standing build you can provide the main repository as subproject to the Python bindings without having to build the shared library first. This can be done for example by symlinking the main repository to the subprojects directory.

mkdir subprojects
ln -s $(realpath ..) subprojects/tblite

Note that this step is not needed if you built against an existing tblite installation.

Setup a build with

meson setup _build -Dpython_version=$(which python3) --prefix=/path/to/install

The Python version can be used to select a different Python version, it defaults to 'python3'. Python 2 is not supported with this project, the Python version key is meant to select between several local Python 3 versions.

Compile the project with

meson compile -C _build

The extension module is now available in _build/tblite/_libtblite.*.so. You can install as usual with

meson install -C _build

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

tblite-0.4.0.tar.gz (657.0 kB view details)

Uploaded Source

Built Distributions

tblite-0.4.0-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (5.7 MB view details)

Uploaded PyPy manylinux: glibc 2.17+ x86-64

tblite-0.4.0-pp310-pypy310_pp73-macosx_14_0_arm64.whl (10.7 MB view details)

Uploaded PyPy macOS 14.0+ ARM64

tblite-0.4.0-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (5.7 MB view details)

Uploaded PyPy manylinux: glibc 2.17+ x86-64

tblite-0.4.0-pp39-pypy39_pp73-macosx_14_0_arm64.whl (10.7 MB view details)

Uploaded PyPy macOS 14.0+ ARM64

tblite-0.4.0-pp38-pypy38_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (5.7 MB view details)

Uploaded PyPy manylinux: glibc 2.17+ x86-64

tblite-0.4.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (5.7 MB view details)

Uploaded CPython 3.13 manylinux: glibc 2.17+ x86-64

tblite-0.4.0-cp313-cp313-macosx_14_0_arm64.whl (10.7 MB view details)

Uploaded CPython 3.13 macOS 14.0+ ARM64

tblite-0.4.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (5.7 MB view details)

Uploaded CPython 3.12 manylinux: glibc 2.17+ x86-64

tblite-0.4.0-cp312-cp312-macosx_14_0_arm64.whl (10.7 MB view details)

Uploaded CPython 3.12 macOS 14.0+ ARM64

tblite-0.4.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (5.7 MB view details)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64

tblite-0.4.0-cp311-cp311-macosx_14_0_arm64.whl (10.7 MB view details)

Uploaded CPython 3.11 macOS 14.0+ ARM64

tblite-0.4.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (5.7 MB view details)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

tblite-0.4.0-cp310-cp310-macosx_14_0_arm64.whl (10.7 MB view details)

Uploaded CPython 3.10 macOS 14.0+ ARM64

tblite-0.4.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (5.7 MB view details)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64

tblite-0.4.0-cp39-cp39-macosx_14_0_arm64.whl (10.7 MB view details)

Uploaded CPython 3.9 macOS 14.0+ ARM64

tblite-0.4.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (5.7 MB view details)

Uploaded CPython 3.8 manylinux: glibc 2.17+ x86-64

File details

Details for the file tblite-0.4.0.tar.gz.

File metadata

  • Download URL: tblite-0.4.0.tar.gz
  • Upload date:
  • Size: 657.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for tblite-0.4.0.tar.gz
Algorithm Hash digest
SHA256 c2334dced8e61e26cd24e1ddb53d10aa0d685cf4df451fc8547192163cddc113
MD5 37c74ecbb82f9689e141485e23f48a2a
BLAKE2b-256 e2e6b374321b2d480cda450911d4122073ff67ebb5284b31d8fbfcfd3f08f144

See more details on using hashes here.

File details

Details for the file tblite-0.4.0-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for tblite-0.4.0-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 c83892decea27a6d77d471ca8f560df9807e81a42e466b5473a1b1fc72e7a523
MD5 29cc6ed1583513a3715ac53203139d01
BLAKE2b-256 83106111fc3859911334461fca15787d3de52825916e505afc3533cca7832fed

See more details on using hashes here.

File details

Details for the file tblite-0.4.0-pp310-pypy310_pp73-macosx_14_0_arm64.whl.

File metadata

File hashes

Hashes for tblite-0.4.0-pp310-pypy310_pp73-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 7f13ed291e5a7dfd50c5cc131e4ebaf27c9d24210cec17f8ec78cc7c48b8d8ad
MD5 b1c3399babbd9725139eabe10b2ec5de
BLAKE2b-256 428242d5c7c2aa9e4a18600bf0d999bd0b6c52116e81810faa37bded4041bdcf

See more details on using hashes here.

File details

Details for the file tblite-0.4.0-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for tblite-0.4.0-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 0b137293cc17f9b43bbf3760b30fca167e9d406020edb9cb3cd147b9bb570184
MD5 983484f80641dea62ee2df988f625be4
BLAKE2b-256 158e97075d57d93d0c23430c7be2b9cd3d45c11d2756030fe9806881824056d6

See more details on using hashes here.

File details

Details for the file tblite-0.4.0-pp39-pypy39_pp73-macosx_14_0_arm64.whl.

File metadata

File hashes

Hashes for tblite-0.4.0-pp39-pypy39_pp73-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 4c174f9476e09db5a6040837d56c348229061bb992aecbc0aaf24021c9d9810c
MD5 20cc24ba168c41759e54d0a31c8a3740
BLAKE2b-256 b81f8e5ec755b6d1dc62daf878f1cb5f12439b29bc7c5b8250aebf703a2d8180

See more details on using hashes here.

File details

Details for the file tblite-0.4.0-pp38-pypy38_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for tblite-0.4.0-pp38-pypy38_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 07257031681116d2bd76059a99baf9d8d9f9fe393973887f6a3ffe2be55d9448
MD5 d98272cce5796394137da3753f08bde8
BLAKE2b-256 e815a913e69ce1d8878b5811093232bb7d663057f53f2a0657a710e4cbdee227

See more details on using hashes here.

File details

Details for the file tblite-0.4.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for tblite-0.4.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 b81ae74e8cf882f61aba8a446cad55a3975ee5d7105c181a32a1ee98b4aa0cd3
MD5 06b7b137dac4a966d6402362160dbba1
BLAKE2b-256 0bc549c4e33f9158fe5b73a9f7ab2194ba9d31c0a8f8ea6f9af770c06a5583dc

See more details on using hashes here.

File details

Details for the file tblite-0.4.0-cp313-cp313-macosx_14_0_arm64.whl.

File metadata

File hashes

Hashes for tblite-0.4.0-cp313-cp313-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 c98f52f1adf6ca9d03dd71826b559627ec71a10849cc20b16c4ec5dbdb17d362
MD5 58f13ff65af39920f5edfed6b23e9464
BLAKE2b-256 887f540dd0e15402b7418365812355a28e30d461bdbb56a199e17c0011f4cdfa

See more details on using hashes here.

File details

Details for the file tblite-0.4.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for tblite-0.4.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 9ae3c32f66a1bb816bfbc505e120c9a14a683ff3d803c3cc06a9aac96363d7e8
MD5 6da9c212a6852ae3145807cf01092ca4
BLAKE2b-256 71d00232b85a2a6b63ad9c62d3268be2464597550c7826463d2811b6996000b6

See more details on using hashes here.

File details

Details for the file tblite-0.4.0-cp312-cp312-macosx_14_0_arm64.whl.

File metadata

File hashes

Hashes for tblite-0.4.0-cp312-cp312-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 af5354de6197d93f7d8e7d7fe1dc3e0e58c9749756dd662113aec055e1fb1724
MD5 f5db3a02c26d3f3165ee752ece3a2a09
BLAKE2b-256 7446bffd3c7f269673372b5fa94eb6718102f4a4e15c4c61a3b338430f1ad811

See more details on using hashes here.

File details

Details for the file tblite-0.4.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for tblite-0.4.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 24c41c44e304148804dca49cf88b40577d77448468880c6e21c4b2ca2051ac0e
MD5 9e1742f85cb4e2211d420ab5fb09816a
BLAKE2b-256 198d42bf721b38e42125d4fda821af6a4e478c75888594710e9be3ed344c1af2

See more details on using hashes here.

File details

Details for the file tblite-0.4.0-cp311-cp311-macosx_14_0_arm64.whl.

File metadata

File hashes

Hashes for tblite-0.4.0-cp311-cp311-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 905d3eeca54d81ab0fc29c892ec1c205a2539c2418680e399affbd687ff79732
MD5 8b4e528ca3197825c3a7682cab115df4
BLAKE2b-256 4c8fc22ca6bcc5f5951d9e53d6aa6b45ff106ad680ace4065f5533dbcd4ee3d8

See more details on using hashes here.

File details

Details for the file tblite-0.4.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for tblite-0.4.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 b1981a5a148575043cfbf8b76b6bbdda80a514e665ef946ded7b6919c29fa5d6
MD5 e616685297d74193ea41551cb1158f80
BLAKE2b-256 a2ae4b66b19ab68111e4fefb0342726ee9ffa9e8cb2f3c894ce0c6d7c20aaab5

See more details on using hashes here.

File details

Details for the file tblite-0.4.0-cp310-cp310-macosx_14_0_arm64.whl.

File metadata

File hashes

Hashes for tblite-0.4.0-cp310-cp310-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 ec7a3f3071428bdfd2efbe1a1c198e2aa3b9c74d454ed718b1577895945335ef
MD5 edc3c1a4822da4c9674ab76785813851
BLAKE2b-256 92d97631aca41f6c3af330532aea21aab23065a0dbd0c4c7651f062c49a5fe72

See more details on using hashes here.

File details

Details for the file tblite-0.4.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for tblite-0.4.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 1b9b7ceaa654df2b145ceee43408aa6d22dd2cc721da09fd90b6146e3f297bb8
MD5 7008a719fafad369627680b9c66e5e14
BLAKE2b-256 463ae4cb6387521d32502a906ddbaa847d590abf1390e7a06721fb4501074044

See more details on using hashes here.

File details

Details for the file tblite-0.4.0-cp39-cp39-macosx_14_0_arm64.whl.

File metadata

File hashes

Hashes for tblite-0.4.0-cp39-cp39-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 13c337bbd687783ff49ca9c6e53c9672852649dd43ad47a8a6dbf1b13b70a4a7
MD5 16563e3163d5cafbc4f84ccc5fca93ac
BLAKE2b-256 7fcba5b11b6fe0e42b0546affb1421c14f551c17b09cd06551c6b847eb77485e

See more details on using hashes here.

File details

Details for the file tblite-0.4.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for tblite-0.4.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 9fc955478d164fc497cd16896803f22322df69e546f23ce8528b71fc331e8a75
MD5 eb31f7492738e12cc0e470ac3fa71b99
BLAKE2b-256 fa9a8ca99b5c78549bdacb8a310e4ac2804fe69e0464105e76c6e019b8155dbc

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page