dftd4_model Module

Definition of the D4 dispersion model for the evaluation of C6 coefficients.



Variables

Type Visibility Attributes Name Initial
type(enum_ref), public, parameter :: d4_ref = enum_ref()

Actual enumerator for D4 reference charges

real(kind=wp), private, parameter :: ga_default = 3.0_wp

Default maximum charge scaling height for partial charge extrapolation

real(kind=wp), private, parameter :: gc_default = 2.0_wp

Default charge scaling steepness for partial charge extrapolation

real(kind=wp), private, parameter :: wf_default = 6.0_wp

Default weighting factor for coordination number interpolation


Interfaces

public interface new_d4_model

Create new dispersion model from molecular structure input

  • private subroutine new_d4_model_no_checks(d4, mol, ga, gc, wf, ref)

    Create new dispersion model from molecular structure input without checking for supported elements (old/compatibility version)

    Arguments

    Type IntentOptional Attributes Name
    type(d4_model), intent(out) :: d4

    Instance of the dispersion model

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

    Molecular structure data

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

    Charge scaling height

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

    Charge scaling steepness

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

    Weighting factor for coordination number interpolation

    integer, intent(in), optional :: ref

    Reference charge selection

  • private subroutine new_d4_model_with_checks(error, d4, mol, ga, gc, wf, ref)

    Create new dispersion model from molecular structure input

    Arguments

    Type IntentOptional Attributes Name
    type(error_type), intent(out), allocatable :: error

    Error handling

    type(d4_model), intent(out) :: d4

    Instance of the dispersion model

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

    Molecular structure data

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

    Charge scaling height

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

    Charge scaling steepness

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

    Weighting factor for coordination number interpolation

    integer, intent(in), optional :: ref

    Reference charge selection


Derived Types

type, public ::  d4_model

Base D4 dispersion model to evaluate C6 coefficients

Components

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

Reference dynamic polarizibilities

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

Reference C6 coefficients

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

Reference coordination numbers

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

Electronegativity

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

Chemical hardness

real(kind=wp), public :: ga

Charge scaling height

real(kind=wp), public :: gc

Charge scaling steepness

integer, public, allocatable :: ngw(:,:)

Number of Gaussian weights for each reference

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

Reference partial charges

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 :: wf

Weighting factor for CN interpolation

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

Effective nuclear charges

Type-Bound Procedures

procedure, public :: get_atomic_c6 ../../

Evaluate C6 coefficient

procedure, public :: get_polarizibilities ../../

Evaluate atomic polarizibilities

procedure, public :: weight_references ../../

Generate weights for all reference systems

type, private ::  enum_ref

Possible reference charges for D4

Components

Type Visibility Attributes Name Initial
integer, public :: eeq = 1

Electronegativity equilibration charges

integer, public :: gfn2 = 2

GFN2-xTB Mulliken partial charges


Functions

private elemental function dzeta(a, c, qref, qmod)

derivative of charge scaling function w.r.t. charge

Arguments

Type IntentOptional Attributes Name
real(kind=wp), intent(in) :: a
real(kind=wp), intent(in) :: c
real(kind=wp), intent(in) :: qref
real(kind=wp), intent(in) :: qmod

Return Value real(kind=wp)

private elemental function is_exceptional(val)

Check whether we are dealing with an exceptional value, NaN or Inf

Arguments

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

Return Value logical

private pure function trapzd(pol)

numerical Casimir–Polder integration

Arguments

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

Return Value real(kind=wp)

private elemental function weight_cn(wf, cn, cnref) result(cngw)

Arguments

Type IntentOptional Attributes Name
real(kind=wp), intent(in) :: wf
real(kind=wp), intent(in) :: cn
real(kind=wp), intent(in) :: cnref

Return Value real(kind=wp)

private elemental function zeta(a, c, qref, qmod)

charge scaling function

Arguments

Type IntentOptional Attributes Name
real(kind=wp), intent(in) :: a
real(kind=wp), intent(in) :: c
real(kind=wp), intent(in) :: qref
real(kind=wp), intent(in) :: qmod

Return Value real(kind=wp)


Subroutines

private subroutine get_atomic_c6(self, mol, gwvec, gwdcn, gwdq, c6, dc6dcn, dc6dq)

Calculate atomic dispersion coefficients and their derivatives w.r.t. the coordination numbers and atomic partial charges.

Arguments

Type IntentOptional Attributes Name
class(d4_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(in), optional :: gwdq(:,:)

Derivative of the weighting function w.r.t. the partial charge

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

Derivative of the C6 w.r.t. the partial charge

private subroutine get_polarizibilities(self, mol, gwvec, gwdcn, gwdq, alpha, dadcn, dadq)

Calculate atomic polarizibilities and their derivatives w.r.t. the coordination numbers and atomic partial charges.

Arguments

Type IntentOptional Attributes Name
class(d4_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(in), optional :: gwdq(:,:)

Derivative of the weighting function w.r.t. the partial charge

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

Static polarizibilities for all atoms.

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

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

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

Derivative of the polarizibility w.r.t. the partial charge

private subroutine new_d4_model_no_checks(d4, mol, ga, gc, wf, ref)

Create new dispersion model from molecular structure input without checking for supported elements (old/compatibility version)

Arguments

Type IntentOptional Attributes Name
type(d4_model), intent(out) :: d4

Instance of the dispersion model

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

Molecular structure data

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

Charge scaling height

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

Charge scaling steepness

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

Weighting factor for coordination number interpolation

integer, intent(in), optional :: ref

Reference charge selection

private subroutine new_d4_model_with_checks(error, d4, mol, ga, gc, wf, ref)

Create new dispersion model from molecular structure input

Arguments

Type IntentOptional Attributes Name
type(error_type), intent(out), allocatable :: error

Error handling

type(d4_model), intent(out) :: d4

Instance of the dispersion model

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

Molecular structure data

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

Charge scaling height

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

Charge scaling steepness

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

Weighting factor for coordination number interpolation

integer, intent(in), optional :: ref

Reference charge selection

private subroutine weight_references(self, mol, cn, q, gwvec, gwdcn, gwdq)

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

Arguments

Type IntentOptional Attributes Name
class(d4_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(in) :: q(:)

Partial charge 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 :: gwdq(:,:)

derivative of the weighting function w.r.t. the charge scaling