Octopus
xc_oct_m Module Reference

Data Types

type  internal_quantities_t
 
type  xc_t
 

Functions/Subroutines

subroutine, public xc_write_info (xcs, iunit, namespace)
 
subroutine, public xc_init (xcs, namespace, ndim, periodic_dim, nel, x_id, c_id, xk_id, ck_id, hartree_fock, ispin)
 
subroutine, public xc_end (xcs)
 
logical pure function, public xc_is_orbital_dependent (xcs)
 Is the xc family orbital dependent. More...
 
pure logical function family_is_gga (family, only_collinear)
 Is the xc function part of the GGA family. More...
 
pure logical function family_is_supported (family)
 Is the xc family internally supported by Octopus. More...
 
pure logical function, public family_is_mgga (family, only_collinear)
 Is the xc function part of the mGGA family. More...
 
logical pure function, public family_is_mgga_with_exc (xcs)
 Is the xc function part of the mGGA family with an energy functional. More...
 
logical pure function, public family_is_hybrid (xcs)
 Returns true if the functional is an hybrid functional. More...
 
pure logical function, public in_family (family, xc_families)
 
subroutine copy_global_to_local (global, local, n_block, nspin, ip)
 make a local copy with the correct memory order for libxc More...
 
subroutine copy_local_to_global (local, global, n_block, spin_channels, ip)
 
subroutine set_hybrid_params (xcs, namespace)
 Sets external parameters for some hybrid functionals. More...
 
logical function, public xc_is_not_size_consistent (xcs, namespace)
 Is one of the x or c functional is not size consistent. More...
 
logical pure function, public xc_is_energy_functional (xcs)
 Is one of the x or c functional is not an energy functional. More...
 
subroutine, public xc_get_vxc (gr, xcs, st, kpoints, psolver, namespace, space, rho, ispin, rcell_volume, vxc, ex, ec, deltaxc, vtau, ex_density, ec_density, stress_xc, force_orbitalfree)
 
subroutine xc_update_internal_quantities (gr, xcs, st, kpoints, namespace, space, rho, quantities, ispin, rcell_volume, force_orbitalfree)
 Given a functional, we are updating/transfering/computing the needed internal quantities that are later needed to perform an actual call to xc_compute_vxc. More...
 
subroutine xc_release_internal_quantities (quantities)
 
subroutine xc_compute_vxc (der, xcs, st, psolver, namespace, space, quantities, ispin, vxc, ex, ec, deltaxc, vtau, ex_density, ec_density, stress_xc)
 
pure logical function functional_needs_laplacian (functl)
 
subroutine xc_density_correction_calc (xcs, der, psolver, namespace, space, nspin, density, refvx, vxc, deltaxc)
 
real(real64) function get_qxc (mesh, nxc, density, ncutoff)
 
subroutine, public xc_get_fxc (xcs, mesh, namespace, rho, ispin, fxc, zfxc)
 
subroutine, public xc_get_kxc (xcs, mesh, namespace, rho, ispin, kxc)
 
subroutine, public xc_get_nc_vxc (gr, xcs, st, kpoints, space, namespace, rho, vxc, ex, ec, vtau, ex_density, ec_density)
 This routines is similar to xc_get_vxc but for noncollinear functionals, which are not implemented in libxc. More...
 
subroutine xc_nc_update_internal_quantities (gr, xcs, st, kpoints, space, namespace, rho, quantities)
 Given a functional, we are updating/transfering/computing the needed internal quantities that are later needed to perform an actual call to xc_compute_vxc. More...
 
subroutine xc_compute_vxc_nc (gr, xcs, st, namespace, quantities, vxc, ex, ec, vtau, ex_density, ec_density)
 This routines is similar to xc_update_internal_quantities but for noncollinear functionals, which are not implemented in libxc. More...
 
pure logical function family_is_nc_mgga (family)
 Returns true is the functional is a noncollinear functional. More...
 
subroutine nc_mgga_exc_vxc (functl, namespace, n_block, l_dens, l_sigma, l_ldens, l_tau, l_dedd, l_vsigma, l_deddldens, l_dedtau, l_zk)
 Interface between the generic call to get the energy and potential and the calls to each specific functionals. More...
 
subroutine nc_br_vxc_exc (l_dens, l_sigma, l_ldens, l_tau, gamma, l_dedd, l_vsigma, l_dedldens, l_dedtau, l_zk)
 Computes the local curvature of the exchange-hole and get the corresponding values of x and b. More...
 
real(real64) function nc_br_get_x (ldens, lcurv)
 Computes the coefficient x from the local density and the local curvature of the exchange hole, see Eq. B7 in PRB 107, 165111 (2023) More...
 
real(real64) function nc_br_rtsafe (rhs, tol)
 This is inspired by the safe Newton-Raphson method from numerical recipies This function returns the value of x that fulfill the equation \(x exp(-2/3*x)/(x-2) = rhs\). More...
 
subroutine nc_cs_vxc_exc (l_dens, l_sigma, l_ldens, l_tau, l_dedd, l_vsigma, l_dedldens, l_dedtau, l_zk)
 Implements the correlation energy functional defined in Tancogne-Dejean et al., PRB 107, 165111 (2023) More...
 

Variables

real(real64), parameter tiny = 1.0e-12_real64
 
integer, parameter lr_none = 0
 
integer, parameter lr_x = 1
 

Function/Subroutine Documentation

◆ xc_write_info()

subroutine, public xc_oct_m::xc_write_info ( type(xc_t), intent(in)  xcs,
integer, intent(in), optional  iunit,
type(namespace_t), intent(in), optional  namespace 
)

Definition at line 217 of file xc.F90.

◆ xc_init()

subroutine, public xc_oct_m::xc_init ( type(xc_t), intent(out)  xcs,
type(namespace_t), intent(in)  namespace,
integer, intent(in)  ndim,
integer, intent(in)  periodic_dim,
real(real64), intent(in)  nel,
integer, intent(in)  x_id,
integer, intent(in)  c_id,
integer, intent(in)  xk_id,
integer, intent(in)  ck_id,
logical, intent(in)  hartree_fock,
integer, intent(in)  ispin 
)

Definition at line 247 of file xc.F90.

◆ xc_end()

subroutine, public xc_oct_m::xc_end ( type(xc_t), intent(inout)  xcs)

Definition at line 516 of file xc.F90.

◆ xc_is_orbital_dependent()

logical pure function, public xc_oct_m::xc_is_orbital_dependent ( type(xc_t), intent(in)  xcs)

Is the xc family orbital dependent.

Note that at the moment this routine consider all mGGAs to be orbital dependent while it should be formally only the one having a dependence in vtau

Definition at line 540 of file xc.F90.

◆ family_is_gga()

pure logical function xc_oct_m::family_is_gga ( integer, intent(in)  family,
logical, intent(in), optional  only_collinear 
)
private

Is the xc function part of the GGA family.

Definition at line 551 of file xc.F90.

◆ family_is_supported()

pure logical function xc_oct_m::family_is_supported ( integer, intent(in)  family)
private

Is the xc family internally supported by Octopus.

This is used internally to check if we need to call libxc or not OEP functionals are treated separately.

Definition at line 569 of file xc.F90.

◆ family_is_mgga()

pure logical function, public xc_oct_m::family_is_mgga ( integer, intent(in), optional  family,
logical, intent(in), optional  only_collinear 
)

Is the xc function part of the mGGA family.

Definition at line 578 of file xc.F90.

◆ family_is_mgga_with_exc()

logical pure function, public xc_oct_m::family_is_mgga_with_exc ( type(xc_t), intent(in)  xcs)

Is the xc function part of the mGGA family with an energy functional.

Definition at line 591 of file xc.F90.

◆ family_is_hybrid()

logical pure function, public xc_oct_m::family_is_hybrid ( type(xc_t), intent(in)  xcs)

Returns true if the functional is an hybrid functional.

Definition at line 606 of file xc.F90.

◆ in_family()

pure logical function, public xc_oct_m::in_family ( integer, intent(in)  family,
integer, dimension(:), intent(in)  xc_families 
)

Definition at line 619 of file xc.F90.

◆ copy_global_to_local()

subroutine xc_oct_m::copy_global_to_local ( real(real64), dimension(:,:), intent(in)  global,
real(real64), dimension(:,:), intent(out)  local,
integer, intent(in)  n_block,
integer, intent(in)  nspin,
integer, intent(in)  ip 
)
private

make a local copy with the correct memory order for libxc

Definition at line 628 of file xc.F90.

◆ copy_local_to_global()

subroutine xc_oct_m::copy_local_to_global ( real(real64), dimension(:,:), intent(in)  local,
real(real64), dimension(:,:), intent(inout)  global,
integer, intent(in)  n_block,
integer, intent(in)  spin_channels,
integer, intent(in)  ip 
)
private

Definition at line 650 of file xc.F90.

◆ set_hybrid_params()

subroutine xc_oct_m::set_hybrid_params ( type(xc_t), intent(inout)  xcs,
type(namespace_t), intent(in)  namespace 
)
private

Sets external parameters for some hybrid functionals.

Definition at line 673 of file xc.F90.

◆ xc_is_not_size_consistent()

logical function, public xc_oct_m::xc_is_not_size_consistent ( type(xc_t), intent(in)  xcs,
type(namespace_t), intent(in)  namespace 
)

Is one of the x or c functional is not size consistent.

Definition at line 717 of file xc.F90.

◆ xc_is_energy_functional()

logical pure function, public xc_oct_m::xc_is_energy_functional ( type(xc_t), intent(in)  xcs)

Is one of the x or c functional is not an energy functional.

Definition at line 727 of file xc.F90.

◆ xc_get_vxc()

subroutine, public xc_oct_m::xc_get_vxc ( type(grid_t), intent(in)  gr,
type(xc_t), intent(inout), target  xcs,
type(states_elec_t), intent(in)  st,
type(kpoints_t), intent(in)  kpoints,
type(poisson_t), intent(in)  psolver,
type(namespace_t), intent(in)  namespace,
class(space_t), intent(in)  space,
real(real64), dimension(:,:), intent(in), target  rho,
integer, intent(in)  ispin,
real(real64), intent(in)  rcell_volume,
real(real64), dimension(:,:), intent(inout), optional, contiguous  vxc,
real(real64), intent(inout), optional  ex,
real(real64), intent(inout), optional  ec,
real(real64), intent(inout), optional  deltaxc,
real(real64), dimension(:,:), intent(inout), optional, contiguous  vtau,
real(real64), dimension(:), intent(out), optional, target  ex_density,
real(real64), dimension(:), intent(out), optional, target  ec_density,
real(real64), dimension(:,:), intent(out), optional  stress_xc,
logical, intent(in), optional  force_orbitalfree 
)
Parameters
[in]grDiscretization and the derivative operators and details
[in,out]xcsDetails about the xc functional used
[in]stState of the system (wavefunction,eigenvalues...)
[in]ispinNumber of spin channels
[in]rcell_volumeLattice unit cell volume.
[in,out]vxcXC potential
[in,out]exExchange energy.
[in,out]ecCorrelation energy.
[in,out]deltaxcThe XC derivative discontinuity
[in,out]vtauDerivative wrt (two times kinetic energy density)
[out]ex_densityThe exchange energy density
[out]ec_densityThe correlation energy density
[out]stress_xcGGA and beyond contribution to the stress tensor
[in]force_orbitalfreeForce doing a calculation without orbitals

Definition at line 752 of file xc.F90.

◆ xc_update_internal_quantities()

subroutine xc_oct_m::xc_update_internal_quantities ( type(grid_t), intent(in)  gr,
type(xc_t), intent(inout), target  xcs,
type(states_elec_t), intent(in)  st,
type(kpoints_t), intent(in)  kpoints,
type(namespace_t), intent(in)  namespace,
class(space_t), intent(in)  space,
real(real64), dimension(:,:), intent(in), target  rho,
type(internal_quantities_t), intent(inout)  quantities,
integer, intent(in)  ispin,
real(real64), intent(in)  rcell_volume,
logical, intent(in), optional  force_orbitalfree 
)
private

Given a functional, we are updating/transfering/computing the needed internal quantities that are later needed to perform an actual call to xc_compute_vxc.

Parameters
[in]grDiscretization and the derivative operators and details
[in,out]xcsDetails about the xc functional used
[in]stState of the system (wavefunction,eigenvalues...)
[in,out]quantitiesInternal quantities
[in]ispinNumber of spin channels
[in]rcell_volumeLattice unit cell volume.
[in]force_orbitalfreeForce doing a calculation without orbitals

Definition at line 791 of file xc.F90.

◆ xc_release_internal_quantities()

subroutine xc_oct_m::xc_release_internal_quantities ( type(internal_quantities_t), intent(inout)  quantities)
private

Definition at line 962 of file xc.F90.

◆ xc_compute_vxc()

subroutine xc_oct_m::xc_compute_vxc ( type(derivatives_t), intent(in)  der,
type(xc_t), intent(inout), target  xcs,
type(states_elec_t), intent(in)  st,
type(poisson_t), intent(in)  psolver,
type(namespace_t), intent(in)  namespace,
class(space_t), intent(in)  space,
type(internal_quantities_t), intent(inout)  quantities,
integer, intent(in)  ispin,
real(real64), dimension(:,:), intent(inout), optional, contiguous  vxc,
real(real64), intent(inout), optional  ex,
real(real64), intent(inout), optional  ec,
real(real64), intent(inout), optional  deltaxc,
real(real64), dimension(:,:), intent(inout), optional, contiguous  vtau,
real(real64), dimension(:), intent(out), optional, target  ex_density,
real(real64), dimension(:), intent(out), optional, target  ec_density,
real(real64), dimension(:,:), intent(out), optional  stress_xc 
)
private
Parameters
[in]derDiscretization and the derivative operators and details
[in,out]xcsDetails about the xc functional used
[in]stState of the system (wavefunction,eigenvalues...)
[in,out]quantitiesInternal quantities
[in]ispinNumber of spin channels
[in,out]vxcXC potential
[in,out]exExchange energy.
[in,out]ecCorrelation energy.
[in,out]deltaxcThe XC derivative discontinuity
[in,out]vtauDerivative wrt (two times kinetic energy density)
[out]ex_densityThe exchange energy density
[out]ec_densityThe correlation energy density
[out]stress_xcGGA and beyond contribution to the stress tensor

Definition at line 977 of file xc.F90.

◆ functional_needs_laplacian()

pure logical function xc_oct_m::functional_needs_laplacian ( type(xc_functional_t), dimension(:), intent(in)  functl)
private

Definition at line 1688 of file xc.F90.

◆ xc_density_correction_calc()

subroutine xc_oct_m::xc_density_correction_calc ( type(xc_t), intent(in)  xcs,
type(derivatives_t), intent(in)  der,
type(poisson_t), intent(in)  psolver,
type(namespace_t), intent(in)  namespace,
class(space_t), intent(in)  space,
integer, intent(in)  nspin,
real(real64), dimension(:, :), intent(in)  density,
real(real64), dimension(:), intent(inout)  refvx,
real(real64), dimension(:, :), intent(inout)  vxc,
real(real64), intent(out), optional  deltaxc 
)
private

Definition at line 1703 of file xc.F90.

◆ get_qxc()

real(real64) function xc_oct_m::get_qxc ( type(mesh_t), intent(in)  mesh,
real(real64), dimension(:), intent(in)  nxc,
real(real64), dimension(:), intent(in)  density,
real(real64), intent(in)  ncutoff 
)
private

Definition at line 1920 of file xc.F90.

◆ xc_get_fxc()

subroutine, public xc_oct_m::xc_get_fxc ( type(xc_t), intent(in), target  xcs,
class(mesh_t), intent(in)  mesh,
type(namespace_t), intent(in)  namespace,
real(real64), dimension(:, :), intent(in)  rho,
integer, intent(in)  ispin,
real(real64), dimension(:,:,:), intent(inout)  fxc,
complex(real64), dimension(:, :, :, :, :), intent(inout), optional  zfxc 
)

Definition at line 1973 of file xc.F90.

◆ xc_get_kxc()

subroutine, public xc_oct_m::xc_get_kxc ( type(xc_t), intent(in), target  xcs,
class(mesh_t), intent(in)  mesh,
type(namespace_t), intent(in)  namespace,
real(real64), dimension(:, :), intent(in)  rho,
integer, intent(in)  ispin,
real(real64), dimension(:,:,:,:), intent(inout)  kxc 
)

Definition at line 2226 of file xc.F90.

◆ xc_get_nc_vxc()

subroutine, public xc_oct_m::xc_get_nc_vxc ( type(grid_t), intent(in)  gr,
type(xc_t), intent(inout), target  xcs,
type(states_elec_t), intent(in)  st,
type(kpoints_t), intent(in)  kpoints,
type(space_t), intent(in)  space,
type(namespace_t), intent(in)  namespace,
real(real64), dimension(:, :), intent(in)  rho,
real(real64), dimension(:,:), intent(inout), contiguous  vxc,
real(real64), intent(inout), optional  ex,
real(real64), intent(inout), optional  ec,
real(real64), dimension(:,:), intent(inout), optional  vtau,
real(real64), dimension(:), intent(out), optional, target  ex_density,
real(real64), dimension(:), intent(out), optional, target  ec_density 
)

This routines is similar to xc_get_vxc but for noncollinear functionals, which are not implemented in libxc.

Parameters
[in,out]xcsDetails about the xc functional used
[in]stState of the system (wavefunction,eigenvalues...)
[in]rhoElectronic density
[in,out]vxcXC potential
[in,out]exExchange energy.
[in,out]ecCorrelation energy.
[in,out]vtauDerivative wrt (two times kinetic energy density)
[out]ex_densityThe exchange energy density
[out]ec_densityThe correlation energy density

Definition at line 2412 of file xc.F90.

◆ xc_nc_update_internal_quantities()

subroutine xc_oct_m::xc_nc_update_internal_quantities ( type(grid_t), intent(in)  gr,
type(xc_t), intent(inout), target  xcs,
type(states_elec_t), intent(in)  st,
type(kpoints_t), intent(in)  kpoints,
type(space_t), intent(in)  space,
type(namespace_t), intent(in)  namespace,
real(real64), dimension(:,:), intent(in), target  rho,
type(internal_quantities_t), intent(inout)  quantities 
)
private

Given a functional, we are updating/transfering/computing the needed internal quantities that are later needed to perform an actual call to xc_compute_vxc.

Parameters
[in]grDiscretization and the derivative operators and details
[in,out]xcsDetails about the xc functional used
[in]stState of the system (wavefunction,eigenvalues...)
[in,out]quantitiesInternal quantities

Definition at line 2444 of file xc.F90.

◆ xc_compute_vxc_nc()

subroutine xc_oct_m::xc_compute_vxc_nc ( type(grid_t), intent(in)  gr,
type(xc_t), intent(inout), target  xcs,
type(states_elec_t), intent(in)  st,
type(namespace_t), intent(in)  namespace,
type(internal_quantities_t), intent(inout)  quantities,
real(real64), dimension(:,:), intent(inout), contiguous  vxc,
real(real64), intent(inout), optional  ex,
real(real64), intent(inout), optional  ec,
real(real64), dimension(:,:), intent(inout), optional  vtau,
real(real64), dimension(:), intent(out), optional, target  ex_density,
real(real64), dimension(:), intent(out), optional, target  ec_density 
)
private

This routines is similar to xc_update_internal_quantities but for noncollinear functionals, which are not implemented in libxc.

Parameters
[in,out]xcsDetails about the xc functional used
[in]stState of the system (wavefunction,eigenvalues...)
[in,out]quantitiesInternal quantities
[in,out]vxcXC potential
[in,out]exExchange energy.
[in,out]ecCorrelation energy.
[in,out]vtauDerivative wrt (two times kinetic energy density)
[out]ex_densityThe exchange energy density
[out]ec_densityThe correlation energy density

Definition at line 2514 of file xc.F90.

◆ family_is_nc_mgga()

pure logical function xc_oct_m::family_is_nc_mgga ( integer, intent(in)  family)
private

Returns true is the functional is a noncollinear functional.

Definition at line 2985 of file xc.F90.

◆ nc_mgga_exc_vxc()

subroutine xc_oct_m::nc_mgga_exc_vxc ( type(xc_functional_t), intent(in)  functl,
type(namespace_t), intent(in)  namespace,
integer, intent(in)  n_block,
real(real64), dimension(:,:), intent(in)  l_dens,
real(real64), dimension(:,:), intent(in)  l_sigma,
real(real64), dimension(:,:), intent(in)  l_ldens,
real(real64), dimension(:,:), intent(in)  l_tau,
real(real64), dimension(:,:), intent(out)  l_dedd,
real(real64), dimension(:,:), intent(out)  l_vsigma,
real(real64), dimension(:,:), intent(out)  l_deddldens,
real(real64), dimension(:,:), intent(out)  l_dedtau,
real(real64), dimension(:), intent(out), optional  l_zk 
)
private

Interface between the generic call to get the energy and potential and the calls to each specific functionals.

Definition at line 2993 of file xc.F90.

◆ nc_br_vxc_exc()

subroutine xc_oct_m::nc_br_vxc_exc ( real(real64), dimension(:), intent(in)  l_dens,
real(real64), dimension(:), intent(in)  l_sigma,
real(real64), dimension(:), intent(in)  l_ldens,
real(real64), dimension(:), intent(in)  l_tau,
real(real64), intent(in)  gamma,
real(real64), dimension(:), intent(out)  l_dedd,
real(real64), dimension(:), intent(out)  l_vsigma,
real(real64), dimension(:), intent(out)  l_dedldens,
real(real64), dimension(:), intent(out)  l_dedtau,
real(real64), intent(out), optional  l_zk 
)
private

Computes the local curvature of the exchange-hole and get the corresponding values of x and b.

This allows to compute the local Coulomb potential and the energy The exchange potential is finally constructed from the potential

Definition at line 3087 of file xc.F90.

◆ nc_br_get_x()

real(real64) function xc_oct_m::nc_br_get_x ( real(real64), intent(in)  ldens,
real(real64), intent(in)  lcurv 
)
private

Computes the coefficient x from the local density and the local curvature of the exchange hole, see Eq. B7 in PRB 107, 165111 (2023)

Definition at line 3223 of file xc.F90.

◆ nc_br_rtsafe()

real(real64) function xc_oct_m::nc_br_rtsafe ( real(real64), intent(in)  rhs,
real(real64), intent(in)  tol 
)
private

This is inspired by the safe Newton-Raphson method from numerical recipies This function returns the value of x that fulfill the equation \(x exp(-2/3*x)/(x-2) = rhs\).

Definition at line 3242 of file xc.F90.

◆ nc_cs_vxc_exc()

subroutine xc_oct_m::nc_cs_vxc_exc ( real(real64), dimension(:), intent(in)  l_dens,
real(real64), dimension(:), intent(in)  l_sigma,
real(real64), dimension(:), intent(in)  l_ldens,
real(real64), dimension(:), intent(in)  l_tau,
real(real64), dimension(:), intent(out)  l_dedd,
real(real64), dimension(:), intent(out)  l_vsigma,
real(real64), dimension(:), intent(out)  l_dedldens,
real(real64), dimension(:), intent(out)  l_dedtau,
real(real64), intent(out), optional  l_zk 
)
private

Implements the correlation energy functional defined in Tancogne-Dejean et al., PRB 107, 165111 (2023)

Definition at line 3308 of file xc.F90.

Variable Documentation

◆ tiny

real(real64), parameter xc_oct_m::tiny = 1.0e-12_real64
private

Definition at line 208 of file xc.F90.

◆ lr_none

integer, parameter xc_oct_m::lr_none = 0
private

Definition at line 210 of file xc.F90.

◆ lr_x

integer, parameter xc_oct_m::lr_x = 1
private

Definition at line 210 of file xc.F90.