Tblite

0.5.0 · active · verified Fri Apr 17

Tblite is a lightweight Python interface to the tblite C++ library, providing fast and efficient tight-binding calculations for quantum chemistry and materials science. It allows users to perform energy, force, and other property calculations for molecular systems. The current version is 0.5.0, and it maintains a regular release cadence, with API changes detailed in release notes.

Common errors

Warnings

Install

Imports

Quickstart

Initializes a `Calculator` for a specified tight-binding method, defines a simple H2 molecule, and performs an energy and force calculation, accessing results from the returned dictionary. Also shows an example with an explicit charge.

import numpy as np
from tblite.interface import Calculator

# Define the molecule
species = ["H", "H"]
positions = np.array([[0.0, 0.0, 0.0], [0.0, 0.0, 0.7]])

# Initialize the calculator with a specific method
# Available methods include GFN1-xTB, GFN2-xTB, GFN-FF, etc.
# Check official docs for a complete list.
calc = Calculator(method="GFN2-xTB")

# Perform the calculation
result = calc.calculate(species, positions)

# Access results from the dictionary
print(f"Total energy: {result['energy']} Hartree")
print(f"Forces (Hartree/Bohr):\n{result['forces']}")

# Example with optional charge (default is 0)
calc_charged = Calculator(method="GFN2-xTB")
charged_result = calc_charged.calculate(species, positions, charge=1)
print(f"Charged system energy: {charged_result['energy']} Hartree")

view raw JSON →