functional_t Derived Type

type, public :: functional_t


Inherits

type~~functional_t~~InheritsGraph type~functional_t functional_t xc_f03_func_info_t xc_f03_func_info_t type~functional_t->xc_f03_func_info_t functionals_info xc_f03_func_t xc_f03_func_t type~functional_t->xc_f03_func_t functionals_list

Inherited by

type~~functional_t~~InheritedByGraph type~functional_t functional_t type~information information type~information->type~functional_t functional type~xc_options_t xc_options_t type~xc_options_t->type~functional_t functional

Components

Type Visibility Attributes Name Initial
logical, public :: needgrd = .false.
logical, public :: needtau = .false.
logical, public :: needlapl = .false.

Type-Bound Procedures

procedure, public :: destroy

  • private subroutine destroy(this)

    @brief Destroy internal variables @author Igor S. Gerasimov @date Dec, 2020 --Initial release-- @date Mar, 2021 Add destruction of functionals_list pointers

    Arguments

    Type IntentOptional Attributes Name
    class(functional_t), intent(inout) :: this

procedure, public :: can_calculate

  • private function can_calculate(this) result(OK)

    @brief Checking that at least one functional is selected @author Igor S. Gerasimov @date Sep, 2019 --Initial release--

    Arguments

    Type IntentOptional Attributes Name
    class(functional_t), intent(inout) :: this

    Return Value logical

procedure, public :: add_functional

  • private subroutine add_functional(this, func_id, coeff, external_parameters, hfex, alpha, beta, omega)

    @brief Add functional into internal array of functionals @author Igor S. Gerasimov @date July, 2019 --Initial release-- @date March, 2021 Add optional hfex, alpha, beta, omega parameters @date July, 2021 Using messages module @params func_id - (in) internal key of functional in libxc @params coeff - (in) coefficient before functional for parametric schemes like B3LYP of PBE0 @params external_parameters - (in, optional) setting external parameters for some LibXC functionals @params hfex - (out, optional) returns % of HF of added functional (should be used only for hybrid functionals) @params alpha - (out, optional) returns short-range % of HF of added range-saparated functional (should be used only for range-saparated hybrid functionals) @params beta - (out, optional) returns long-range % of HF of added range-saparated functional (should be used only for range-saparated hybrid functionals) @params omega - (out, optional) returns error function parameter of added range-saparated functional (should be used only for range-saparated hybrid functionals)

    Arguments

    Type IntentOptional Attributes Name
    class(functional_t), intent(inout) :: this
    integer(kind=C_INT), intent(in) :: func_id
    real(kind=fp), intent(in) :: coeff
    real(kind=fp), intent(in), optional, dimension(:) :: external_parameters
    real(kind=fp), intent(out), optional :: hfex
    real(kind=fp), intent(out), optional :: alpha
    real(kind=fp), intent(out), optional :: beta
    real(kind=fp), intent(out), optional :: omega

procedure, public :: calc_xc

  • private subroutine calc_xc(this, NPoints, rho, sigma, tau, lapl, energy, dedrho, dedsigma, dedlapl, dedtau, v2rho2, v2rhosigma, v2rholapl, v2rhotau, v2sigma2, v2sigmalapl, v2sigmatau, v2lapl2, v2lapltau, v2tau2, v3rho3, v3rho2sigma, v3rho2lapl, v3rho2tau, v3rhosigma2, v3rhosigmalapl, v3rhosigmatau, v3rholapl2, v3rholapltau, v3rhotau2, v3sigma3, v3sigma2lapl, v3sigma2tau, v3sigmalapl2, v3sigmalapltau, v3sigmatau2, v3lapl3, v3lapl2tau, v3lapltau2, v3tau3)

    @brief Perform DFT energy and its first, second and third derivatives calculation @author Igor S. Gerasimov @date Sep, 2019 @params npoints - (in) number of points @params rho - (in) density at point @params sigma - (in) gradient of density at point @params tau - (in) local kinetic energy at point @params lapl - (in) laplacian of density at point @params energy - (out) energy at point @params dedrho - (out) first derivatives energy by density @params dedsigma - (out) first derivatives energy by normed gradient @params dedlapl - (out) first derivatives energy by laplacian @params dedtau - (out) first derivatives energy by kinetic energy @params v2rho2 - (out) second derivatives by density and density @params v2rhosigma - (out) second derivatives by density and normed gradient @params v2rholapl - (out) second derivatives by density and laplacian @params v2rhotau - (out) second derivatives by density and kinetic energy @params v2sigma2 - (out) second derivatives by normed gradient and normed gradient @params v2sigmalapl - (out) second derivatives by normed gradient and laplacian @params v2sigmatau - (out) second derivatives by normed gradient and kinetic energy @params v2lapl2 - (out) second derivatives by laplacian and laplacian @params v2lapltau - (out) second derivatives by laplacian and kinetic energy @params v2tau2 - (out) second derivatives by kinetic energy and kinetic energy @params v3rho3 - (out) third derivatives by density and density and density @params v3rho2sigma - (out) third derivatives by density and density and normed gradient @params v3rho2lapl - (out) third derivatives by density and density and laplacian @params v3rho2tau - (out) third derivatives by density and density and kinetic energy @params v3rhosigma2 - (out) third derivatives by density and normed gradient and normed gradient @params v3rhosigmalapl - (out) third derivatives by density and normed gradient and laplacian @params v3rhosigmatau - (out) third derivatives by density and normed gradient and density @params v3rholapl2 - (out) third derivatives by density and laplacian and laplacian @params v3rholapltau - (out) third derivatives by density and laplacian and density @params v3rhotau2 - (out) third derivatives by density and kinetic energy and kinetic energy @params v3sigma3 - (out) third derivatives by normed gradient and normed gradient and normed gradient @params v3sigma2lapl - (out) third derivatives by normed gradient and normed gradient and laplacian @params v3sigma2tau - (out) third derivatives by normed gradient and normed gradient and kinetic energy @params v3sigmalapl2 - (out) third derivatives by normed gradient and laplacian and laplacian @params v3sigmalapltau - (out) third derivatives by normed gradient and laplacian and kinetic energy @params v3sigmatau2 - (out) third derivatives by normed gradient and kinetic energy and kinetic energy @params v3lapl3 - (out) third derivatives by laplacian and laplacian and laplacian @params v3lapl2tau - (out) third derivatives by laplacian and laplacian and kinetic energy @params v3lapltau2 - (out) third derivatives by laplacian and kinetic energy and kinetic energy @params v3tau3 - (out) third derivatives by kinetic energy and kinetic energy and kinetic energy

    Arguments

    Type IntentOptional Attributes Name
    class(functional_t), intent(inout) :: this
    integer, intent(in) :: NPoints
    real(kind=fp), intent(in), dimension(*) :: rho
    real(kind=fp), intent(in), dimension(*) :: sigma
    real(kind=fp), intent(in), dimension(*) :: tau
    real(kind=fp), intent(in), dimension(*) :: lapl
    real(kind=fp), intent(out), dimension(*) :: energy
    real(kind=fp), intent(out), dimension(*) :: dedrho
    real(kind=fp), intent(out), dimension(*) :: dedsigma
    real(kind=fp), intent(out), dimension(*) :: dedlapl
    real(kind=fp), intent(out), dimension(*) :: dedtau
    real(kind=fp), intent(out), dimension(*) :: v2rho2
    real(kind=fp), intent(out), dimension(*) :: v2rhosigma
    real(kind=fp), intent(out), dimension(*) :: v2rholapl
    real(kind=fp), intent(out), dimension(*) :: v2rhotau
    real(kind=fp), intent(out), dimension(*) :: v2sigma2
    real(kind=fp), intent(out), dimension(*) :: v2sigmalapl
    real(kind=fp), intent(out), dimension(*) :: v2sigmatau
    real(kind=fp), intent(out), dimension(*) :: v2lapl2
    real(kind=fp), intent(out), dimension(*) :: v2lapltau
    real(kind=fp), intent(out), dimension(*) :: v2tau2
    real(kind=fp), intent(out), dimension(*) :: v3rho3
    real(kind=fp), intent(out), dimension(*) :: v3rho2sigma
    real(kind=fp), intent(out), dimension(*) :: v3rho2lapl
    real(kind=fp), intent(out), dimension(*) :: v3rho2tau
    real(kind=fp), intent(out), dimension(*) :: v3rhosigma2
    real(kind=fp), intent(out), dimension(*) :: v3rhosigmalapl
    real(kind=fp), intent(out), dimension(*) :: v3rhosigmatau
    real(kind=fp), intent(out), dimension(*) :: v3rholapl2
    real(kind=fp), intent(out), dimension(*) :: v3rholapltau
    real(kind=fp), intent(out), dimension(*) :: v3rhotau2
    real(kind=fp), intent(out), dimension(*) :: v3sigma3
    real(kind=fp), intent(out), dimension(*) :: v3sigma2lapl
    real(kind=fp), intent(out), dimension(*) :: v3sigma2tau
    real(kind=fp), intent(out), dimension(*) :: v3sigmalapl2
    real(kind=fp), intent(out), dimension(*) :: v3sigmalapltau
    real(kind=fp), intent(out), dimension(*) :: v3sigmatau2
    real(kind=fp), intent(out), dimension(*) :: v3lapl3
    real(kind=fp), intent(out), dimension(*) :: v3lapl2tau
    real(kind=fp), intent(out), dimension(*) :: v3lapltau2
    real(kind=fp), intent(out), dimension(*) :: v3tau3

procedure, public :: calc_evfxc

  • private subroutine calc_evfxc(this, NPoints, rho, sigma, tau, lapl, energy, dedrho, dedsigma, dedtau, dedlapl, v2rho2, v2sigma2, v2tau2, v2lapl2, v2rhosigma, v2rhotau, v2rholapl, v2sigmatau, v2sigmalapl, v2lapltau)

    @brief Perform DFT energy and its first and second derivatives calculation @author Igor S. Gerasimov @date Sep, 2019 @params NPoints - (in) number of points @params rho - (in) density at point @params sigma - (in) gradient of density at point @params tau - (in) local kinetic energy at point @params lapl - (in) laplacian of density at point @params energy - (out) energy at point @params dedrho - (out) first derivatives energy by density @params dedsigma - (out) first derivatives energy by normed gradient @params dedtau - (out) first derivatives energy by kinetic energy @params dedlapl - (out) first derivatives energy by laplacian @params v2rho2 - (out) second derivatives by density and density @params v2sigma2 - (out) second derivatives by normed gradient and normed gradient @params v2tau2 - (out) second derivatives by kinetic energy and kinetic energy @params v2lapl2 - (out) second derivatives by laplacian and laplacian @params v2rhosigma - (out) second derivatives by density and normed gradient @params v2rhotau - (out) second derivatives by density and kinetic energy @params v2rholapl - (out) second derivatives by density and laplacian @params v2sigmatau - (out) second derivatives by normed gradient and kinetic energy @params v2sigmalapl - (out) second derivatives by normed gradient and laplacian @params v2lapltau - (out) second derivatives by laplacian and kinetic energy

    Arguments

    Type IntentOptional Attributes Name
    class(functional_t), intent(inout) :: this
    integer, intent(in) :: NPoints
    real(kind=fp), intent(in), dimension(*) :: rho
    real(kind=fp), intent(in), dimension(*) :: sigma
    real(kind=fp), intent(in), dimension(*) :: tau
    real(kind=fp), intent(in), dimension(*) :: lapl
    real(kind=fp), intent(out), dimension(*) :: energy
    real(kind=fp), intent(out), dimension(*) :: dedrho
    real(kind=fp), intent(out), dimension(*) :: dedsigma
    real(kind=fp), intent(out), dimension(*) :: dedtau
    real(kind=fp), intent(out), dimension(*) :: dedlapl
    real(kind=fp), intent(out), dimension(*) :: v2rho2
    real(kind=fp), intent(out), dimension(*) :: v2sigma2
    real(kind=fp), intent(out), dimension(*) :: v2tau2
    real(kind=fp), intent(out), dimension(*) :: v2lapl2
    real(kind=fp), intent(out), dimension(*) :: v2rhosigma
    real(kind=fp), intent(out), dimension(*) :: v2rhotau
    real(kind=fp), intent(out), dimension(*) :: v2rholapl
    real(kind=fp), intent(out), dimension(*) :: v2sigmatau
    real(kind=fp), intent(out), dimension(*) :: v2sigmalapl
    real(kind=fp), intent(out), dimension(*) :: v2lapltau

procedure, public :: calc_evxc

  • private subroutine calc_evxc(this, NPoints, rho, sigma, tau, lapl, energy, dedrho, dedsigma, dedtau, dedlapl)

    @brief Perform DFT energy and its first derivatives calculation @author Igor S. Gerasimov @date July, 2019 @params NPoints - (in) number of points @params rho - (in) density at points @params sigma - (in) gradient of density at points @params tau - (in) local kinetic energy at points @params lapl - (in) laplacian of density at points @params energy - (out) energy at points @params dedrho - (out) first derivative energy by density @params dedsigma - (out) first derivative energy by normed gradient @params dedtau - (out) first derivative energy by kinetic energy @params dedlapl - (out) first derivative energy by laplacian

    Arguments

    Type IntentOptional Attributes Name
    class(functional_t), intent(inout) :: this
    integer, intent(in) :: NPoints
    real(kind=fp), intent(in), dimension(*) :: rho
    real(kind=fp), intent(in), dimension(*) :: sigma
    real(kind=fp), intent(in), dimension(*) :: tau
    real(kind=fp), intent(in), dimension(*) :: lapl
    real(kind=fp), intent(out), dimension(*) :: energy
    real(kind=fp), intent(out), dimension(*) :: dedrho
    real(kind=fp), intent(out), dimension(*) :: dedsigma
    real(kind=fp), intent(out), dimension(*) :: dedtau
    real(kind=fp), intent(out), dimension(*) :: dedlapl

Source Code

  type functional_t
    type(xc_f03_func_t),      dimension(:), allocatable, private :: functionals_list
    type(xc_f03_func_info_t), dimension(:), allocatable, private :: functionals_info
    real(kind=fp),            dimension(:), allocatable, private :: coefficients

    logical :: needgrd  = .false. !< toggles calculation of density gradient
    logical :: needtau  = .false. !< toggles calculation of tau (\sum dot_product(\nabla \phi, \nabla \phi))
    logical :: needlapl = .false. !< toggles calculation of lapl (\nabla^2 \rho)
  contains
    procedure :: add_functional, can_calculate, destroy
    procedure :: calc_evxc, calc_evfxc, calc_xc
  end type functional_t