How should I rattle an ASE Atoms object to improve convergence in DFTB+?

Python script (snippet):
from ase import io
atoms = io.read(“structure.xyz”)

Tried several stdev values [0.0001 to 0.1]

atoms.rattle(stdev=0.0001, seed=None)
io.write(“structure2.xyz”, atoms)

DFTB+ input file (snippet):
Driver = GeometryOptimization {
LatticeOpt = Yes
FixAngles = Yes
Optimizer = Rational {}
MaxSteps = 1000
Convergence {
Energy = .02
GradElem = 0.000388
}
}

Hamiltonian = xTB {
Method = “GFN1-xTB”
MaxSccIterations = 1000
}

No matter what stdev I use between 0.0001–0.1, the geometry doesn’t converge. Is rattle() even the right tool here, or is there a better way to slightly rattle structures for DFTB+ convergence? I don’t want to use rng=numpy.random due to replicability.

DFTB+ convergence errors:
“SCC is NOT converged, maximal SCC iterations exceeded”
“Failure in diagonalisation routine ZHEEVR, unable to complete Cholesky factorization”
“Fermi level search did not converge”

Rattling doesn’t fix every possible convergence problem! This looks like more of a DFTB+ problem then an ASE issue.

I have run into stability problems with GFN1-xTB sometimes.
You could try using one of the other electronic solvers in the Hamiltonian section, such as DivideAndConquer, and/or a different “Filling” method.