d3_model Derived Type

type, public :: d3_model

Base D3 dispersion model to evaluate C6 coefficients


Components

Type Visibility Attributes Name Initial
real(kind=wp), public, allocatable :: c6(:,:,:,:)

Reference C6 coefficients

real(kind=wp), public, allocatable :: cn(:,:)

Reference coordination numbers

logical, public, allocatable :: ghost(:)

Masked

type(d3_lowrank_c6), public, allocatable :: lowrank

Separable representation of the reference C6 coefficients, only allocated if the model was set up with a low-rank approximation

real(kind=wp), public, allocatable :: r4r2(:)

Expectation values for C8 extrapolation

real(kind=wp), public, allocatable :: rcov(:)

Covalent radii for coordination number

integer, public, allocatable :: ref(:)

Number of reference systems

real(kind=wp), public, allocatable :: rvdw(:,:)

Van-der-Waals radii for damping function

real(kind=wp), public, allocatable :: wf

Weighting factor for CN interpolation


Type-Bound Procedures

procedure, public :: get_atomic_c6

Evaluate C6 coefficient

  • private subroutine get_atomic_c6(self, mol, gwvec, gwdcn, c6, dc6dcn, gwd2cn, d2c6dcn2, d2c6dcnij, partition)

    Calculate atomic dispersion coefficients and their derivatives w.r.t. the coordination number.

    The second derivatives require a model without a low-rank expansion, which only provides the coefficients and their first derivatives.

    Arguments

    Type IntentOptional Attributes Name
    class(d3_model), intent(in) :: self

    Instance of the dispersion model

    class(structure_type), intent(in) :: mol

    Molecular structure data

    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(out) :: c6(:,:)

    C6 coefficients for all atom pairs.

    real(kind=wp), intent(out), optional :: dc6dcn(:,:)

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

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

    Second derivative of the weighting function w.r.t. the coordination number

    real(kind=wp), intent(out), optional :: d2c6dcn2(:,:)

    Second derivative of the C6 w.r.t. the coordination number of one atom

    real(kind=wp), intent(out), optional :: d2c6dcnij(:,:)

    Mixed second derivative of the C6 w.r.t. both coordination numbers

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

    Only evaluate the pairs of this part, the caller has to know that the missing coefficients are not consumed, see dftd3_partition

procedure, public :: set_lowrank

Set up a separable low-rank representation of the C6 coefficients

  • private subroutine set_lowrank(self, config)

    Set up a separable low-rank representation of the reference C6 coefficients

    Arguments

    Type IntentOptional Attributes Name
    class(d3_model), intent(inout) :: self

    Instance of the dispersion model

    type(d3_lowrank_config), intent(in) :: config

    Setup of the separable representation

procedure, public :: weight_references

Generate weights for all reference systems

  • private subroutine weight_references(self, mol, cn, gwvec, gwdcn, gwd2cn)

    Calculate the weights of the reference system and the derivatives w.r.t. coordination number for later use.

    Arguments

    Type IntentOptional Attributes Name
    class(d3_model), intent(in) :: self

    Instance of the dispersion model

    class(structure_type), intent(in) :: mol

    Molecular structure data

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

    Coordination number of every atom.

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

    weighting for the atomic reference systems

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

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

    real(kind=wp), intent(out), optional :: gwd2cn(:,:)

    second derivative of the weighting function w.r.t. the coordination number

Source Code

   type :: d3_model

      !> Covalent radii for coordination number
      real(wp), allocatable :: rcov(:)

      !> Van-der-Waals radii for damping function
      real(wp), allocatable :: rvdw(:, :)

      !> Expectation values for C8 extrapolation
      real(wp), allocatable :: r4r2(:)

      !> Weighting factor for CN interpolation
      real(wp), allocatable :: wf

      !> Number of reference systems
      integer, allocatable :: ref(:)

      !> Reference coordination numbers
      real(wp), allocatable :: cn(:, :)

      !> Reference C6 coefficients
      real(wp), allocatable :: c6(:, :, :, :)

      !> Masked
      logical, allocatable :: ghost(:)

      !> Separable representation of the reference C6 coefficients, only allocated
      !> if the model was set up with a low-rank approximation
      type(d3_lowrank_c6), allocatable :: lowrank

   contains

      !> Generate weights for all reference systems
      procedure :: weight_references

      !> Set up a separable low-rank representation of the C6 coefficients
      procedure :: set_lowrank

      !> Evaluate C6 coefficient
      procedure :: get_atomic_c6

   end type d3_model