XTBMethod
The XTBMethod
object specifies the settings for using Grimme's xTB as the method for a calculation.
xTB is a family of methods based on density functional tight-binding, suitable for the calculation of structures, vibrational frequencies, and non-covalent interactions in large molecular systems. A key feature of these methods is that it almost entirely avoids element-pair-wise parameterisation. The parameterisation consequently covers all spd-block elements and the lanthanides, up to Z = 86, using reference data at the hybrid density functional theory level.
There is one field required for creating an XTBMethod
object:
model
for specifying the xTB model (available models are GFN0 and GFN1)
All other calculation details can be specified in the details
dictionary.
In case of convergence issues, it is recommended to
- use
solver=scc
andguess=eeq
- successively decrease the
broyden_damping
- successively increase
max_iter
This will lead to convergence in almost all cases.
Example
The following examples demonstrate how to create and use XTBMethod
with a SingleInput
to calculate the energy of a molecule.
import sierra
from sierra.inputs import *
# Create a water molecule from pubchem (internet connection required)
water = Molecule(pubchem="water")
# Perform a single-point energy calculation using the GFN0-xTB method
xtb0_basic_input = SingleInput(molecule=water, method=XTBMethod(model="GFN0"))
xtb0_basic_result = sierra.run(xtb0_basic_input)
print(f"GFN0-xTB energy: {xtb0_basic_result.energy:.6f} Hartree")
#> GFN0-xTB energy: -4.367421 Hartree
# Perform a single-point energy calculation using the GFN1-xTB method
xtb1_basic_input = SingleInput(molecule=water, method=XTBMethod(model="GFN1"))
xtb1_basic_result = sierra.run(xtb1_basic_input)
print(f"GFN1-xTB energy: {xtb1_basic_result.energy:.6f} Hartree")
#> GFN1-xTB energy: -5.768441 Hartree
# Use more advanced settings for the GFN1-xTB method
xtb1_advanced_input = SingleInput(
molecule=water,
method=XTBMethod(model="GFN1", details={"broyden_damping": 0.2}),
)
xtb1_advanced_result = sierra.run(xtb1_advanced_input)
print(f"GFN1-xTB energy: {xtb1_advanced_result.energy:.6f} Hartree")
#> GFN1-xTB energy: -5.768441 Hartree
Fields
All of the fields in MethodBase and the following:
model
-
Specify the xTB model, allowed xTB form are GFN0 and GFN1
- Type:
str
- Default:
GFN1
- Type:
details
-
Dict containing additional detail options. See below.
- Type:
Dict[str, Any]
- Type:
Available options for details
max_iter
-
Maximum number of iterations.
- The type is int
- The default is 128
- The value must be nonnegative
energy_threshold
-
Convergence threshold using the absolute value of the energy difference between iterations.
- The type is float
- The default is 1e-6
- The value must be nonnegative
orbital_grad_threshold
-
Convergence threshold using the infinity norm of the orbital gradient.
- The type is float
- The default is 1e-5
- The value must be nonnegative
solver
-
Type of solver to use for determining the density and orbitals. The default is automatically set depending on the xTB model.
- The type is str
- There is no default value.
- The value must be one of:
scf
- Perform a standard self-consistent field calculationscc
- Perform a self-consistent charge calculation with Broyden mixingnon_iterative
- Perform a non-iterative (single diagonalization) calculation
guess
-
Initial guess for the xTB wavefunction.
- The type is str
- The default is SAD
- The value must be one of:
SAD
- Superposition of Atomic Densities (SAD).eeq
- Use EEQ charges as the initial guess.
broyden_damping
-
Factor of new shell-resolved charges to be used in Broyden mixing: \( q_{n+1} = f * q_{n} + ... \) where \( f \) is the factor.
- The type is float
- The default is 0.4