Dispersion energy#
This module provides the dispersion energy evaluation for the pairwise interactions.
Example
>>> import torch
>>> import tad_dftd3 as d3
>>> numbers = torch.tensor([ # define fragments by setting atomic numbers to zero
... [8, 1, 1, 8, 1, 6, 1, 1, 1],
... [0, 0, 0, 8, 1, 6, 1, 1, 1],
... [8, 1, 1, 0, 0, 0, 0, 0, 0],
... ])
>>> positions = torch.tensor([ # define coordinates once
... [-4.224363834, +0.270465696, +0.527578960],
... [-5.011768887, +1.780116228, +1.143194385],
... [-2.468758653, +0.479766200, +0.982905589],
... [+1.146167671, +0.452771215, +1.257722311],
... [+1.841554378, -0.628298322, +2.538065200],
... [+2.024899840, -0.438480095, -1.127412563],
... [+1.210773578, +0.791908575, -2.550591723],
... [+4.077073644, -0.342495506, -1.267841745],
... [+1.404422261, -2.365753991, -1.503620411],
... ]).repeat(numbers.shape[0], 1, 1)
>>> ref = d3.reference.Reference()
>>> param = dict( # r²SCAN-D3(BJ)
... a1=torch.tensor(0.49484001),
... s8=torch.tensor(0.78981345),
... a2=torch.tensor(5.73083694),
... )
>>> cn = d3.ncoord.coordination_number(numbers, positions)
>>> weights = d3.model.weight_references(numbers, cn, ref)
>>> c6 = d3.model.atomic_c6(numbers, weights, ref)
>>> energy = d3.disp.dispersion(numbers, positions, param, c6)
>>> torch.set_printoptions(precision=7)
>>> print(torch.sum(energy[0] - energy[1] - energy[2])) # energy in Hartree
tensor(-0.0003964)
- tad_dftd3.disp.dispersion(numbers, positions, param, c6, rvdw=None, r4r2=None, damping_function=<function rational_damping>, cutoff=None, **kwargs)[source]#
Calculate dispersion energy between pairs of atoms.
- Parameters:
numbers (Tensor) – Atomic numbers of the atoms in the system.
positions (Tensor) – Cartesian coordinates of the atoms in the system.
param (dict[str, Tensor]) – DFT-D3 damping parameters.
c6 (Tensor) – Atomic C6 dispersion coefficients.
rvdw (Tensor) – Van der Waals radii of the atoms in the system.
r4r2 (Tensor) – r⁴ over r² expectation values of the atoms in the system.
damping_function (Callable) – Damping function evaluate distance dependent contributions. Additional arguments are passed through to the function.
- Returns:
Atom-resolved DFT-D3 dispersion energy for each geometry.
- Return type:
Tensor
- tad_dftd3.disp.dispersion2(numbers, positions, param, c6, r4r2, damping_function, cutoff, **kwargs)[source]#
Calculate dispersion energy between pairs of atoms.
- Parameters:
numbers (Tensor) – Atomic numbers of the atoms in the system.
positions (Tensor) – Cartesian coordinates of the atoms in the system.
param (dict[str, Tensor]) – DFT-D3 damping parameters.
c6 (Tensor) – Atomic C6 dispersion coefficients.
r4r2 (Tensor) – r⁴ over r² expectation values of the atoms in the system.
damping_function (Callable) – Damping function evaluate distance dependent contributions. Additional arguments are passed through to the function.
- tad_dftd3.disp.dispersion3(numbers, positions, param, c6, rvdw, cutoff, rs9=tensor(1.3333))[source]#
Three-body dispersion term. Currently this is only a wrapper for the Axilrod-Teller-Muto dispersion term.
- Parameters:
numbers (Tensor) – Atomic numbers of the atoms in the system.
positions (Tensor) – Cartesian coordinates of the atoms in the system.
param (dict[str, Tensor]) – Dictionary of dispersion parameters. Default values are used for missing keys.
c6 (Tensor) – Atomic C6 dispersion coefficients.
rvdw (Tensor) – Van der Waals radii of the atoms in the system.
cutoff (Tensor) – Real-space cutoff.
rs9 (Tensor, optional) – Scaling for van-der-Waals radii in damping function. Defaults to 4.0/3.0.
- Returns:
Atom-resolved three-body dispersion energy.
- Return type:
Tensor