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.5.0.tar.gz (862.0 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

tblite-0.5.0-pp311-pypy311_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (5.1 MB view details)

Uploaded PyPymanylinux: glibc 2.17+ x86-64

tblite-0.5.0-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (5.1 MB view details)

Uploaded PyPymanylinux: glibc 2.17+ x86-64

tblite-0.5.0-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (5.1 MB view details)

Uploaded PyPymanylinux: glibc 2.17+ x86-64

tblite-0.5.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (5.2 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

tblite-0.5.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (5.2 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

tblite-0.5.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (5.2 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

tblite-0.5.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (5.2 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

tblite-0.5.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (5.2 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ x86-64

File details

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

File metadata

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

File hashes

Hashes for tblite-0.5.0.tar.gz
Algorithm Hash digest
SHA256 5dae9e7f559a2602c361acf3817c987501f5b13eaf2072b5f81bb8ae071fc7cb
MD5 248b1ea112ebfa5262c9ad3d7e6c6565
BLAKE2b-256 18b4887888d2aae253196c18ca10a75dd40330fc6b6c3567b70d57b7776d3eac

See more details on using hashes here.

File details

Details for the file tblite-0.5.0-pp311-pypy311_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for tblite-0.5.0-pp311-pypy311_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 062b7f753d074dd31ebd4fea39e097b5ef8f2f20138235c274c50ad87f19b9c2
MD5 272d4f210c1e6abbb54fa8092ebd9241
BLAKE2b-256 42ce9c72b9f18004c380944c98f58db6934cc771c0503b03799052de6271f7fa

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tblite-0.5.0-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 abb43ba14558ffaa8fef31ab5aa695cf7c65e4365636fd0284a9d8c8789ff7b7
MD5 6afc2e3832af3f7d90d879ed28074f89
BLAKE2b-256 10f592bdef4c66c8721d680d3a7428f27ba2b6f757e0d946b0947a0feac379f9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tblite-0.5.0-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 f5d54db4de5815eabdac4380f66e40145f1a84adc9d11ed740d7a8df1477a043
MD5 98c18e09d4f6b47a13da6ab681d8ea84
BLAKE2b-256 d2b13e18320e76c0b9735b65966eb1bb975400f8dbbbd36624d326e8feb6fd65

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tblite-0.5.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 d82af8c10a7f6fbfe52a78b8699539199d09cefd8eb825d527a857ecf1228bdd
MD5 1183d64b04587de547926b15fab0d54c
BLAKE2b-256 65a03421d2aba508945db99c3e3c94b94d87fa79e7e4101430bb19dbf41f3243

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tblite-0.5.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 4754ee0ae39bc061afc6b5e251dd8b4b596f13d7829a3595b12419936cb71a30
MD5 f5fe921af840506bd36d6b84570eaed1
BLAKE2b-256 fa071fcb4a392e5ba9c62bae477f16a7f8ffcd48a71adf2cc076c3d6975628b7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tblite-0.5.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 b72fd481236587feb8afc272d052df9551a135c5599ad968b20aecd42a96b845
MD5 aa93bdddecb8fb6041d72a322ee504e3
BLAKE2b-256 7cb9399c22f650c6582562fddd6889322d1c5b5469f4267e0579c2c6116aebe7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tblite-0.5.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 3d73ae686561f9f5e3cfd7e0a60e5d07caeec6ed5e0708984e1dc4f29e12e261
MD5 d4cf0a360448c07a3e56777bd47827fc
BLAKE2b-256 a59d640b00a14eaa12f4404fbdb142ccaf7f915bd03a30f01c68e3fb8eb958d3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tblite-0.5.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 d42180a013299f0ac90977c71877be5b8141366246b5d18c18a30366097254b7
MD5 1ca691c64168c8e70fab81dc4f65dfc5
BLAKE2b-256 176098ae7afc694f16056e37cfee0db8b46a141ef31b2faa6f3dabf3a8674daf

See more details on using hashes here.

Supported by

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