This is a Python version for GFN0-xTB based on F2PY.
There is an ase.Calculator subclass termed GFN0 for non-PBC system. And a more low function called gfn0 can be found in the code.
from ase import Atoms
from ase.build import molecule
from ase.optimize import BFGS
from scipy.spatial.distance import pdist
from pygfn0 import GFN0
atoms = Atoms(molecule("CO"), calculator=GFN0())
opt = BFGS(atoms, logfile="-", trajectory=None)
opt.run(fmax=0.03, steps=50)
print(f"Energy: {atoms.get_potential_energy():.3f}eV")
print(f"C=O Length: {pdist(atoms.positions).item():.3f}\u212b")
# Output:
# Step Time Energy fmax
# BFGS: 0 21:48:56 -145.434618 3.546420
# BFGS: 1 21:48:56 -145.184501 9.984024
# BFGS: 2 21:48:56 -145.493902 0.833465
# BFGS: 3 21:48:56 -145.496822 0.175982
# BFGS: 4 21:48:56 -145.496955 0.004404
# Energy: -145.497eV
# C=O Length: 1.116Å- P. Pracht, S. Grimme, et.al. A Robust Non-Self-Consistent Tight-Binding Quantum Chemistry Method for large Molecules (2019), DOI: https://doi.org/10.26434/chemrxiv.8326202.v1
- A standalone library of the GFN0-xTB method. https://github.com/pprcht/gfn0/