dftd3_fourier_spme Module

Smooth particle mesh evaluation of the two-body dispersion energy.

The structure factors of the reciprocal space sum are interpolated from an equispaced mesh using cardinal B-splines, which replaces the explicit sum over atoms at every wave vector by a fast Fourier transform. The remaining sum runs over the mesh instead of a sphere of wave vectors, so the cost grows as O(N log N) with the number of atoms rather than O(N^2).

Because the damping radius depends on the pair of species, the kernel cannot be folded into a single mesh: the structure factors are resolved by species and the transforms are repeated for every term of the low-rank expansion.



Variables

Type Visibility Attributes Name Initial
integer, public, parameter :: spline_order = 6

Order of the cardinal B-spline interpolation.

Six gives an interpolation error well below the mesh discretisation error for the meshes of interest, while keeping the spreading cost at 216 points per atom.


Functions

public pure function get_spme_mesh(lattice, kcut) result(mesh)

Number of mesh points resolving the requested reciprocal space cutoff

Arguments

Type IntentOptional Attributes Name
real(kind=wp), intent(in) :: lattice(:,:)

Direct lattice vectors

real(kind=wp), intent(in) :: kcut

Reciprocal space cutoff

Return Value integer, (3)

Number of mesh points along each direction


Subroutines

public subroutine get_dispersion_spme(mol, lowrank, ghost, terms, nterm, mesh, gwvec, gwdcn, energies, dEdcn, gradient, sigma, partition)

Evaluate the two-body dispersion energy on a particle mesh

Arguments

Type IntentOptional Attributes Name
class(structure_type), intent(in) :: mol

Molecular structure data

class(d3_lowrank_c6), intent(in) :: lowrank

Separable representation of the C6 coefficients

logical, intent(in) :: ghost(:)

Atoms excluded from the dispersion calculation

type(fourier_term), intent(in) :: terms(:,:,:)

Terms of the damped pair potential for each pair of species

integer, intent(in) :: nterm(:,:)

Number of terms for each pair of species

integer, intent(in) :: mesh(3)

Number of mesh points along each direction

real(kind=wp), intent(in) :: gwvec(:,:)

Weighting function for the atomic reference systems

real(kind=wp), intent(in), optional :: gwdcn(:,:)

Derivative of the weighting function w.r.t. the coordination number

real(kind=wp), intent(inout) :: energies(:)

Dispersion energy

real(kind=wp), intent(inout), optional :: dEdcn(:)

Derivative of the energy w.r.t. the coordination number

real(kind=wp), intent(inout), optional :: gradient(:,:)

Dispersion gradient

real(kind=wp), intent(inout), optional :: sigma(:,:)

Dispersion virial

type(work_partition), intent(in), optional :: partition

Work partition over the terms of the low-rank expansion