DFTD3 and DFTD4
DFTD3 and DFTD4 compute Grimme dispersion corrections as standalone calculators and compose directly with QC via ASE’s SumCalculator. They return the dispersion contribution alone, not an electronic total energy.
Quick usage
Section titled “Quick usage”from ase.calculators.mixing import SumCalculatorfrom atomli.calculators import QC, DFTD4
atoms.calc = SumCalculator([ QC(xc="PBE", basis="def2-TZVPP"), DFTD4(method="PBE", device="cpu"),])energy = atoms.get_potential_energy() # eVforces = atoms.get_forces() # eV/ÅwB97X-V, wB97M-V, r2SCAN-3c, g-xTB, GFN2-xTB, and SKALA-1.1 already include dispersion terms.
Method matrix (DFTD3 vs DFTD4)
Section titled “Method matrix (DFTD3 vs DFTD4)”| Property | DFTD3 | DFTD4 |
|---|---|---|
| Package extra | atomli core | atomli[tb] |
| Model | Coordination-number pairwise D3 (pair only, s9=0) | Charge-dependent EEQ-D4(BJ)-ATM (2019 EEQ charges + optional ATM 3-body) |
| Parameterized functionals | "PBE", "r2SCAN" (case-insensitive) | "PBE", "r2SCAN" |
| Damping variants | "bj" (default), "zero", "op", "mbj", "mzero" (PBE); "bj" only (r2SCAN) | "bj" (Axilrod–Teller–Muto controlled by atm=True|False) |
| Periodicity | Molecular (0D) & periodic (3D); get_stress() raises PropertyNotImplementedError | Molecular (0D) & 3D PBC (energy, forces, 3D stress); 1D/2D PBC raises |
| Devices | CPU (default); explicit device="gpu" (D3(BJ)) | CPU (default); explicit device="gpu" |
| Extra methods | Standard energy, free_energy, forces | energy, free_energy, forces, stress, get_charges(atoms) (EEQ2019 charges in ) |
Neither calculator inherits atomli.gpu.set_default_device("gpu"); GPU evaluation requires explicit device="gpu" ("wgpu") and fails without silent CPU fallback if no hardware GPU is available.
DFTD3 parameters
Section titled “DFTD3 parameters”| Parameter | Type | Default | Description |
|---|---|---|---|
method | str | "PBE" | Functional parameter set ("PBE" or "r2SCAN") |
version | str | None | None | Damping scheme: None selects "bj"; also accepts "zero", "op", "mbj", "mzero" (optional "d3" prefix such as "d3bj") |
device | str | "cpu" | "cpu" or explicit "gpu" (D3(BJ)) |
adapter | Adapter | int | str | None | None | Physical GPU selector when device="gpu" |
Unregistered functional names or unavailable damping variants raise ValueError at calculation time. Custom s6/s8 overrides are not exposed.
DFTD4 parameters
Section titled “DFTD4 parameters”| Parameter | Type | Default | Unit | Description |
|---|---|---|---|---|
method | str | "PBE" | — | Functional parameter set ("PBE" or "r2SCAN") |
atm | bool | True | — | Include Axilrod–Teller–Muto three-body dispersion (False drops ATM while keeping ATM-fit pair parameters) |
cutoffs | (float, float, float) | None | None (equiv. 50, 25, 30 Bohr) | Å | (pair, atm, d4_cn) interaction and D4 coordination radii (EEQ coordination radius remains fixed at 25 Bohr) |
cutoff_widths | (float, float) | [0.0, 0.0] | Å | Smooth quintic switching widths [pair_width, atm_width]; 0.0 keeps hard cutoffs |
device | str | "cpu" | — | "cpu" or explicit "gpu" |
adapter | Adapter | int | str | None | None | — | Physical GPU selector when device="gpu" |