What xTB is
xTB (extended tight-binding) is a family of semiempirical methods from the Grimme group. It approximates the Hamiltonian with a minimal valence basis and element-specific parameters, so the same molecule usually runs two to three orders of magnitude faster than with DFT. Parameters exist up to Z = 86 (Rn), so transition-metal complexes will at least run, not only organic molecules.
ORCA can call four variants.
| Method | Keyword | Notes |
|---|---|---|
| GFN2-xTB | XTB2, GFN2-xTB | The default choice. Includes multipole electrostatics and D4 dispersion. |
| GFN1-xTB | XTB1, GFN-xTB | The earlier version. Sometimes better than GFN2 for inorganic and metal systems. |
| GFN0-xTB | XTB0, GFN0-xTB | Not self-consistent. Several times faster but less accurate; use it only when XTB1 and XTB2 both fail. |
| GFN-FF | XTBFF, GFN-FF | A force field. Bonds cannot break, so it is for structure searches in large systems, not reactions. |
A bare ! XTB means GFN2-xTB. All examples in this chapter write XTB2 explicitly.
Setting ORCA up for xTB
ORCA 6.0 does not evaluate xTB itself; it calls the Grimme group's xtb program. The xtb
binary therefore has to sit in the directory of the ORCA executables, renamed to otool_xtb.
# xtb 6.7.1 or later (github.com/grimme-lab/xtb/releases or conda-forge)
ORCA_DIR=$(dirname $(which orca))
cp /path/to/xtb-6.7.1/bin/xtb $ORCA_DIR/otool_xtb
xtb older than 6.7.1 is not fully compatible with ORCA 6 and can fail quietly, for example by not
switching on the solvation model. On Linux the interface also needs /bin/sh to be a POSIX shell such as bash or dash.
If you cannot write to the executable directory, as with a shared ORCA module on a cluster, the most reliable fix is a
personal ORCA installation with otool_xtb placed next to it.
Check the module's bin directory first, though. On the NUS HPC Vanda cluster, where the examples in
this chapter were run, the directory loaded by module load ORCA/6.1.0-gompi-2023b-avx2 already
contains otool_xtb (xtb 6.7.1), so nothing had to be done. The module also loads OpenMPI 4.1.6.
module load ORCA/6.1.0-gompi-2023b-avx2
ls $(dirname $(which orca))/otool_xtb # if it is there, you are set
The output shows whether it was actually used: every xTB step prints the command ORCA ran on a
program call line. In the example output, the otool_xtb from the module path was called with
-P 8 --alpb WATER, so %pal nprocs 8 was passed on as the xtb core count.
Basic input
Charge and multiplicity go on the coordinate line exactly as for DFT. There is no basis set to specify.
# geometry optimisation
! XTB2 Opt
%pal nprocs 8 end
* xyzfile 0 1 mol.xyz
Optimisations, constraints and surface scans, NEB, IRC, MD and QM/MM all work with the same syntax as for DFT.
There is no analytic Hessian, so Freq is done numerically from repeated gradients. When one xTB
gradient takes well under a second, the difference is hardly noticeable.
# optimisation + frequencies
! XTB2 Opt Freq
* xyzfile 0 1 mol.xyz
Solvation models
xTB comes with three solvation models of its own, separate from the DFT ones.
| Keyword | Model |
|---|---|
ALPB(water) | Analytical linearized Poisson–Boltzmann. Parametrised together with xTB and the usual choice. |
DDCOSMO(water) | Domain-decomposition COSMO |
CPCMX(water) | Extended CPCM |
! XTB2 Opt ALPB(water)
ALPB is xTB-only. When the same molecule continues at the DFT level, switch to CPCM(water) or
SMD from chapter 9.
Pre-optimising before DFT
The most common practical use of xTB is to produce the starting structure for a DFT optimisation. Structures drawn by hand or taken from another program have arbitrary bond lengths and angles, and feeding them straight into DFT wastes the first few dozen steps on expensive calculations. After an xTB optimisation, DFT starts close to the minimum.
# step1.inp: xTB optimisation + frequencies → step1.xyz, step1.hess
! XTB2 Opt Freq ALPB(water)
* xyzfile 0 1 start.xyz
# step2.inp: r2SCAN-3c optimisation from the xTB geometry and Hessian
! r2SCAN-3c Opt Freq CPCM(water)
%geom
InHess Read
InHessName "step1.hess"
end
* xyzfile 0 1 step1.xyz
With the Hessian read in, the optimiser knows the curvature from the first step. For OptTS in particular,
the xTB Hessian can replace the initial Hessian calculation described in chapter 7,
which saves a lot of time.
Example: alanine dipeptide
Alanine dipeptide (Ace-Ala-NMe, 22 atoms) was optimised in implicit water with two methods, followed by frequencies. The r2SCAN-3c run started from the xTB minimum. Both ran on 8 cores with ORCA 6.1.0 on NUS HPC.
| GFN2-xTB / ALPB | r2SCAN-3c / CPCM | |
|---|---|---|
| Wall time (8 cores) | 9.9 s | 14 min 27 s (866.6 s) |
| Optimisation cycles | 20 | 23 |
| φ / ψ (°) | −82.6 / 72.8 (C7eq) | −85.9 / 73.9 (C7eq) |
| Lowest frequencies (cm⁻¹) | 50.8, 69.1, 85.4 | 44.2, 73.3, 94.7 |
| Imaginary frequencies | 0 | 0 |
| Final energy / G (Eh) | −32.991364 / −32.848402 | −495.775841 / −495.628066 |
Both methods end in the same C7eq minimum, with dihedrals about 3° apart, and neither has an imaginary frequency, so
both are confirmed minima. The time differs by a factor of about 87. The module timings at the end of the r2SCAN-3c
output split it into SCF iterations 45%, response equations and second-derivative integrals for the frequencies 31%
together, and gradients 12%. This example read only the xTB geometry, not its Hessian; adding InHess Read
as in the previous section could cut the optimisation cycles further. As noted below, the final
energies of the two methods have different references and cannot be subtracted.
The inputs and outputs are in examples/07-xtb-md/
(o01 input ·
o01 output ·
o02 input ·
o02 output).
Reaction paths and conformer searches
As with ! XTB NEB-TS in chapter 7, a common approach is to get the
first guess of a reaction path from xTB and refine only the transition state with DFT. It is much cheaper than scanning
the whole path with DFT and usually reaches the same saddle point.
ORCA 6 also has GOAT for conformer and global-minimum searches; ! XTB GOAT builds a conformer ensemble on
the xTB surface. CREST, on the xtb side, has done the same job for longer. The xtb guide runs
CREST on the same molecule.
How far to trust it
- Geometries: bond lengths and angles of organic molecules are generally close to DFT. Hydrogen bonds and torsions scatter more.
- Relative energies: the ordering of conformers is a useful guide, but errors of a few kcal/mol are common. Recompute with DFT before ranking.
- Reaction energies and barriers: not for quantitative use. Take the shape of the path and approximate structures only.
- Transition metals: the calculation runs, but the ordering of spin states is unreliable.
- Absolute energies: xTB total energies are on a different reference from DFT and cannot be subtracted from or compared with them.
The %xtb block
The keyword line is usually enough; use the block only for fine-tuning.
| Keyword | Meaning |
|---|---|
XTBINPUTSTRING | A string appended verbatim to the otool_xtb command line |
NPROCS | Cores used by xtb; defaults to ORCA's %pal setting |
ACCURACY | xtb's --acc value |
ETEMP | Electronic temperature (--etemp). Raise it to help SCF convergence in metallic or small-gap systems. |
DOALPB, ALPBSOLVENT | Same as ALPB(...) on the keyword line |
%xtb
ETEMP 1000
NPROCS 4
end
GFN2-xTB: Bannwarth, Ehlert, Grimme, J. Chem. Theory Comput. 2019, 15, 1652. ALPB: Ehlert, Stahn, Spicher, Grimme, J. Chem. Theory Comput. 2021, 17, 4250. Review: Bannwarth et al., WIREs Comput. Mol. Sci. 2021, 11, e1493.