DFTD3
DFTD3 computes the Grimme DFT-D3 dispersion correction as a standalone
ASE-shaped calculator. It returns only the dispersion contribution. It does
not compute an electronic total energy.
Semilocal density functionals underestimate long-range dispersion. Add
DFTD3 on top of a matching QC calculation to
correct this. Do not add it to a method that already contains a dispersion
model, such as GFN2-xTB.
Methane dimer binding
Section titled “Methane dimer binding”Two methane molecules at increasing separation, calculated with PBE/def2-TZVPP and PBE+D3.
| C-C separation | PBE alone | D3 term | PBE + D3 |
|---|---|---|---|
| 3.2 Å | 117.8 | -40.7 | 77.1 |
| 3.6 Å | 16.8 | -30.0 | -13.3 |
| 4.0 Å | -5.7 | -20.5 | -26.3 |
| 4.4 Å | -7.7 | -13.2 | -20.9 |
| 4.8 Å | -5.3 | -8.3 | -13.6 |
| 5.2 Å | -3.0 | -5.2 | -8.2 |
| 5.6 Å | -1.6 | -3.3 | -4.8 |
| 6.0 Å | -0.8 | -2.1 | -2.9 |
| 6.4 Å | -0.4 | -1.4 | -1.8 |
| 6.8 Å | -0.2 | -1.0 | -1.2 |
Interaction energies in meV, relative to two separated monomers. PBE alone bottoms out at -7.9 meV at 4.2 Å. Adding D3 deepens that to -26.3 meV and pulls the minimum in to 4.0 Å. So the dispersion term supplies roughly 70% of the binding in this pair, and it does not merely scale the well, it moves it.
That dimer is two database methanes translated along one axis, not the optimally oriented pair, so treat the depth as the size of the correction rather than as a benchmark against a coupled-cluster reference.
Basis-set superposition error
Section titled “Basis-set superposition error”PBE has no long-range correlation, so a reader is entitled to ask why the uncorrected curve binds at all. Most of it is basis-set superposition error: each monomer borrows basis functions from the other and lowers its own energy for reasons that have nothing to do with interaction. Shrink the basis and the spurious well grows.
| Calculation | Well depth | Position |
|---|---|---|
| PBE/def2-SVP | -12.3 meV | 4.2 Å |
| PBE/def2-TZVPP | -7.9 meV | 4.2 Å |
| PBE/def2-TZVPP + D3 | -26.3 meV | 4.0 Å |
Going from def2-SVP to def2-TZVPP removes 4.4 meV of that artificial binding, which is a third of what the SVP curve appeared to have. The D3 term, by contrast, does not shrink when the basis improves, because it is not a basis effect at all. This is why the curve above is run at def2-TZVPP: at def2-SVP the page would be crediting dispersion with binding that is really a basis artefact.
Long-range dispersion
Section titled “Long-range dispersion”Dispersion between neutral closed-shell fragments decays as C₆/r⁶. That is checkable, and worth checking, because a damping function applied at the wrong range is one of the easier things to get wrong in a dispersion model. Fitting log|E| against log r for the D3 term alone:
| Range | Fitted exponent |
|---|---|
| 9 to 20 Å | -6.14 |
| beyond 15 Å | -6.10 |
Slightly steeper than 6, approaching 6 as the fragments separate. That is exactly right: D3 carries a C₈/r⁸ term as well as C₆/r⁶, and the higher-order term dies faster, so the effective exponent relaxes toward 6 with distance. An exponent near 6 at long range and no minimum anywhere is what a pure dispersion model should look like on its own.
Standalone dispersion energy
Section titled “Standalone dispersion energy”from atomli.build import moleculefrom atomli.calculators import DFTD3
atoms = molecule("CH4")atoms.calc = DFTD3(method="PBE")
energy = atoms.get_potential_energy()forces = atoms.get_forces()The result is the dispersion energy alone, in eV, and it is negative because dispersion is attractive. It is also essentially free: 0.70 ms for the ten-atom dimer, against 9.8 s for the 19 PBE/def2-TZVPP points on the same geometries. There is no cost argument against adding the correction.
QC integration
Section titled “QC integration”Use ASE’s SumCalculator to add the correction to an electronic method:
from ase.calculators.mixing import SumCalculatorfrom atomli.build import moleculefrom atomli.calculators import DFTD3from atomli.calculators.qc import QC
atoms = molecule("CH4")atoms.calc = SumCalculator([ QC(xc="PBE", basis="def2-TZVPP"), DFTD3(method="PBE"),])
energy = atoms.get_potential_energy()forces = atoms.get_forces()Match method to the functional of the electronic calculation. The sum works
on Atomli Atoms and on ase.Atoms.
Parameters
Section titled “Parameters”| Argument | Default | Meaning |
|---|---|---|
method |
"PBE" |
Functional whose recommended D3 parameters are loaded |
version |
None |
Damping variant; None selects Becke-Johnson damping |
method selects a registered parameter set. The current registry covers
"PBE" and "r2SCAN". Names are case-insensitive. An unregistered method
raises ValueError at the first calculation, not at construction.
version selects the damping variant: "bj" (the default), "zero",
"op", "mbj", or "mzero". A "d3" prefix, such as "d3bj", is also
accepted. Variant availability depends on the method. PBE registers all five
variants; r2SCAN registers "bj" only. An unavailable variant raises
ValueError at the first calculation.
Limits
Section titled “Limits”- Properties:
energy,free_energy, andforces. - A stress request raises
PropertyNotImplementedError. - Molecular and periodic structures are accepted; periodic cells return dispersion energy and forces.
- No per-parameter overrides: the calculator loads recommended parameters
only, with no custom
s6ors8values.