xtb-python
xtb-python copied to clipboard
Getting infinite forces when using the GFN0-xTB calculator for periodic system
I am using the GFN0-xTB calculator for geometry optimization of a periodic system. However, the optimization always terminates at a certain step where some of the forces become infinite (or negative infinite). I am using xtb-python version 20.1, and running on Linux.
I attach below a zip file that contains two very similar structures, test1.traj and test2.traj. The energy is normal for test1.traj, but the forces become infinite. For test2.traj both energy and forces are normal.
structures.zip
Below is the code that should reproduce the behaviour:
from ase.io import read, write
from xtb.ase.calculator import XTB
# Read structure data
atoms = read('test1.traj') # test2.traj works fine
# Create the calculator for GFN0-xTB under periodic boundary conditions
calc = XTB(method='GFN0-xTB')
atoms.calc = calc
# Get the single point energy and forces
e = atoms.get_potential_energy()
f = atoms.get_forces()
print(e)
print(f)
Output:
-4523.6795731769935
[[-inf inf -inf]
[-inf inf -inf]
[-inf -inf -inf]
[ inf -inf -inf]
[ inf inf -inf]
[ inf inf -inf]
[-inf inf -inf]
[-inf inf -inf]
[-inf -inf -inf]
[ inf -inf -inf]
[ inf inf -inf]
[-inf inf -inf]
[ inf inf inf]
[ inf inf inf]
[ inf -inf inf]
[-inf -inf inf]
[-inf inf inf]
[-inf -inf inf]
[ 0. 0. 0.]
[ 0. 0. 0.]
[ 0. 0. 0.]
[ 0. 0. 0.]
[ 0. 0. 0.]
[ 0. 0. 0.]
[ 0. 0. 0.]
[ 0. 0. 0.]
[ 0. 0. 0.]
[ 0. 0. 0.]
[ 0. 0. 0.]
[ 0. 0. 0.]
[ 0. 0. 0.]
[ 0. 0. 0.]
[ 0. 0. 0.]
[ 0. 0. 0.]
[ 0. 0. 0.]
[ 0. 0. 0.]
[-inf -inf -inf]]