xtb
xtb copied to clipboard
Linear dependent basis set for GFN1-xTB under PBC
Describe the bug
I have been having fun playing with xtb
, but I keep running into a problem for crystals. I raise it here as I have checked with the conda version on mac, the precompiled linux binary, and a freshly compiled linux binary with ifort. It is possible that I am doing something silly as others don't seem to have the issue.
To Reproduce
The diamond example runs fine with xtb --gfn 1 diamond
, but for other cases I have checked including the 2-atom rocksalt MgO example, I get a fatal error related to diagnonalisation. For example, using the input file from the documentation:
$coord frac
0.00 0.00 0.00 mg
0.50 0.50 0.50 o
$periodic 3
$cell
5.798338236 5.798338236 5.798338236 60. 60. 60.
$end
I get:
iter E dE RMSdq gap omega full diag
########################################################################
[ERROR] Program stopped due to fatal error
-6- Single point calculation terminated
-5- xtb_calculator_singlepoint: Electronic structure method terminated
-4- scf: Self consistent charge iterator terminated
-3- scc_core: Diagonalization of Hamiltonian failed
-2- mctc_lapack_sygvd: Failed to solve eigenvalue problem
-1- mctc_lapack_potrf: Factorisation of matrix failed
########################################################################
Running with xtb --gfn 1 --define --verbose
confirms that the input geometry is read correctly and sensible.
Additional context Thanks for any help
The system is linear dependent and the overlap cannot be factorized by potrf
anymore, therefore the calculation is stopped. Adding a cutoff for small eigenvalues in the overlap matrix would solve this issue.
It is not really a bug, but the currently expected behaviour with the very diffuse basis functions used for the xTB Hamiltonians. To fix it we need a robust way to project out linear dependencies from the tight binding basis set, which is not yet implemented for GFN1-xTB but already around in a somewhat instable way for GFN0-xTB.
Thanks for the explanation @awvwgk. I thought I may be missing a trick. GFN0-xTB does indeed work for my examples. It could be worth highlighting in the PBC documentation.
The alternative is to finish the PBC implementations and make it finally a real thing, maybe we will get there this year.
Hi, I am also observing this same issue, when using the GFN1-TB single point calculator (in pbc). The code snippet is the following:
from ase.io import read,write
from xtb.ase.calculator import XTB
xtb = XTB(method="GFN1-xTB")
f = read('LiPSdataset.xyz', '40')
f.calc = xtb
f.get_potential_energy()
I get:
XTBException: Single point calculation failed:
-5- xtb_calculator_singlepoint: Electronic structure method terminated
-4- scf: Self consistent charge iterator terminated
-3- scc_core: Diagonalization of Hamiltonian failed
-2- mctc_lapack_sygvd: Failed to solve eigenvalue problem
-1- mctc_lapack_potrf: Factorisation of matrix failed
Setting the pbc flag to False solves the issue.
How can one add a cutoff for small eigenvalues in the overlap matrix when dealing with PBC? I do not see any such option when defining the calculator, as the supported keywords are:
method "GFN2-xTB" Underlying method for energy and forces
accuracy 1.0 Numerical accuracy of the calculation
electronic_temperature 300.0 Electronic temperatur for TB methods
max_iterations 250 Iterations for self-consistent evaluation
solvent "none" GBSA implicit solvent model
cache_api True Reuse generate API objects (recommended)
Thanks for any help on this.