xnn.common.models.d3.edisp#

xnn.common.models.d3.edisp(Z, r, idx_i, idx_j, cutoff=None, s6=1.0, s8=0.9171, a1=0.3385, a2=2.883, c6ab=None, rcov=None, r2r4=None)[source]#

Per-atom D3(BJ) dispersion energy, PhysNet’s force-shifted variant.

Evaluates -1/2 sum_j [s6 C6 / (r^6 + R0^6) + s8 C8 / (r^8 + R0^8)] for every atom, with the BJ damping radius R0 = a1 sqrt(C8/C6) + a2. This is the form PhysNet (Unke & Meuwly 2019) uses; the general D3 model with its damping variants, three-body term and the reference code’s cutoffs is DFTD3.

Parameters:
  • Z (Tensor) – Atomic numbers, shape (N,).

  • r (Tensor) – Pair distances in bohr, shape (E,) (both edge directions present; the factor 1/2 below accounts for the double counting).

  • idx_i (Tensor) – Central/neighbor atom index of each pair, shape (E,).

  • idx_j (Tensor) – Central/neighbor atom index of each pair, shape (E,).

  • cutoff (float or None, optional) – Long-range cutoff in bohr; None (default) applies no cutoff. When set, the pair energies are force-shifted so both the energy and its derivative go to zero smoothly at cutoff, and the coordination numbers are tapered accordingly.

  • s6 (float or Tensor, optional) – D3(BJ) parameters, by default the Hartree-Fock values (may be scalar tensors, e.g. learnable parameters).

  • s8 (float or Tensor, optional) – D3(BJ) parameters, by default the Hartree-Fock values (may be scalar tensors, e.g. learnable parameters).

  • a1 (float or Tensor, optional) – D3(BJ) parameters, by default the Hartree-Fock values (may be scalar tensors, e.g. learnable parameters).

  • a2 (float or Tensor, optional) – D3(BJ) parameters, by default the Hartree-Fock values (may be scalar tensors, e.g. learnable parameters).

  • c6ab (Tensor or None, optional) – Reference tables; None (default) uses the module-level CPU copies. Pass device-resident copies (e.g. registered buffers) when running on an accelerator.

  • rcov (Tensor or None, optional) – Reference tables; None (default) uses the module-level CPU copies. Pass device-resident copies (e.g. registered buffers) when running on an accelerator.

  • r2r4 (Tensor or None, optional) – Reference tables; None (default) uses the module-level CPU copies. Pass device-resident copies (e.g. registered buffers) when running on an accelerator.

Returns:

Dispersion energy per atom in hartree, shape (N,).

Return type:

Tensor