(git:6a2e663)
xc Module Reference

Exchange and Correlation functional calculations. More...

Functions/Subroutines

logical function, public xc_uses_kinetic_energy_density (xc_fun_section, lsd)
 ... More...
 
logical function, public xc_uses_norm_drho (xc_fun_section, lsd)
 ... More...
 
subroutine, public xc_vxc_pw_create1 (vxc_rho, vxc_tau, rho_r, rho_g, tau, exc, xc_section, pw_pool, compute_virial, virial_xc, exc_r)
 Exchange and Correlation functional calculations. depending on the selected functional_routine calls the correct routine. More...
 
subroutine, public smooth_cutoff (pot, rho, rhoa, rhob, rho_cutoff, rho_smooth_cutoff_range, e_0, e_0_scale_factor)
 smooths the cutoff on rho with a function smoothderiv_rho that is 0 for rho<rho_cutoff and 1 for rho>rho_cutoff*rho_smooth_cutoff_range: E= integral e_0*smoothderiv_rho => dE/d...= de/d... * smooth, dE/drho = de/drho * smooth + e_0 * dsmooth/drho More...
 
subroutine, public calc_xc_density (pot, rho, rho_cutoff)
 
subroutine, public xc_vxc_pw_create (vxc_rho, vxc_tau, exc, rho_r, rho_g, tau, xc_section, pw_pool, compute_virial, virial_xc, exc_r)
 Exchange and Correlation functional calculations. More...
 
real(kind=dp) function, public xc_exc_calc (rho_r, rho_g, tau, xc_section, pw_pool)
 calculates just the exchange and correlation energy (no vxc) More...
 
subroutine, public xc_calc_2nd_deriv (v_xc, v_xc_tau, deriv_set, rho_set, rho1_r, rho1_g, tau1_r, pw_pool, xc_section, gapw, vxg, lsd_singlets, do_excitations, do_triplet, do_tddft, compute_virial, virial_xc)
 Caller routine to calculate the second order potential in the direction of rho1_r. More...
 
subroutine, public xc_calc_2nd_deriv_numerical (v_xc, v_tau, rho_set, rho1_r, rho1_g, tau1_r, pw_pool, xc_section, do_triplet, calc_virial, virial_xc, deriv_set)
 calculates 2nd derivative numerically More...
 
subroutine, public xc_calc_2nd_deriv_analytical (v_xc, v_xc_tau, deriv_set, rho_set, rho1_set, pw_pool, xc_section, gapw, vxg, tddfpt_fac, compute_virial, virial_xc)
 Calculates the second derivative of E_xc at rho in the direction rho1 (if you see the second derivative as bilinear form) partial_rho|_(rho=rho) partial_rho|_(rho=rho) E_xc drho(rho1)drho The other direction is still undetermined, thus it returns a potential (partial integration is performed to reduce it to function of rho, removing the dependence from its partial derivs) Has to be called after the setup by xc_prep_2nd_deriv. More...
 
subroutine, public xc_prep_2nd_deriv (deriv_set, rho_set, rho_r, pw_pool, xc_section, tau_r)
 Prepare objects for the calculation of the 2nd derivatives of the density functional. The calculation must then be performed with xc_calc_2nd_deriv. More...
 
subroutine, public divide_by_norm_drho (deriv_set, rho_set, lsd)
 divides derivatives from deriv_set by norm_drho More...
 

Detailed Description

Exchange and Correlation functional calculations.

History
(13-Feb-2001) JGH, based on earlier version of apsi 02.2003 Many many changes [fawzi] 03.2004 new xc interface [fawzi] 04.2004 kinetic functionals [fawzi]
Author
fawzi

Function/Subroutine Documentation

◆ xc_uses_kinetic_energy_density()

logical function, public xc::xc_uses_kinetic_energy_density ( type(section_vals_type), intent(in), pointer  xc_fun_section,
logical, intent(in)  lsd 
)

...

Parameters
xc_fun_section...
lsd...
Returns
...

Definition at line 90 of file xc.F.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ xc_uses_norm_drho()

logical function, public xc::xc_uses_norm_drho ( type(section_vals_type), intent(in), pointer  xc_fun_section,
logical, intent(in)  lsd 
)

...

Parameters
xc_fun_section...
lsd...
Returns
...

Definition at line 110 of file xc.F.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ xc_vxc_pw_create1()

subroutine, public xc::xc_vxc_pw_create1 ( type(pw_r3d_rs_type), dimension(:), pointer  vxc_rho,
type(pw_r3d_rs_type), dimension(:), pointer  vxc_tau,
type(pw_r3d_rs_type), dimension(:), pointer  rho_r,
type(pw_c1d_gs_type), dimension(:), pointer  rho_g,
type(pw_r3d_rs_type), dimension(:), pointer  tau,
real(kind=dp), intent(out)  exc,
type(section_vals_type), pointer  xc_section,
type(pw_pool_type), pointer  pw_pool,
logical, intent(in)  compute_virial,
real(kind=dp), dimension(3, 3), intent(out)  virial_xc,
type(pw_r3d_rs_type), intent(inout), optional  exc_r 
)

Exchange and Correlation functional calculations. depending on the selected functional_routine calls the correct routine.

Parameters
vxc_rhowill contain the v_xc part that depend on rho (if one of the chosen xc functionals has it it is allocated and you are responsible for it)
vxc_tauwill contain the kinetic tau part of v_xcthe functional (if one of the chosen xc functionals has it it is allocated and you are responsible for it)
rho_rthe value of the density in the real space
rho_gvalue of the density in the g space (needs to be associated only for gradient corrections)
tauvalue of the kinetic density tau on the grid (can be null, used only with meta functionals)
excthe xc energy
xc_sectionparameters selecting the xc and the method used to calculate it
pw_poolthe pool for the grids
compute_virialshould the virial be computed... if so virial_xc must be present
virial_xcfor calculating the GGA part of the stress
exc_r...
Author
fawzi

Definition at line 148 of file xc.F.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ smooth_cutoff()

subroutine, public xc::smooth_cutoff ( real(kind=dp), dimension(:, :, :), intent(in), pointer  pot,
real(kind=dp), dimension(:, :, :), intent(in), pointer  rho,
real(kind=dp), dimension(:, :, :), intent(in), pointer  rhoa,
real(kind=dp), dimension(:, :, :), intent(in), pointer  rhob,
real(kind=dp), intent(in)  rho_cutoff,
real(kind=dp), intent(in)  rho_smooth_cutoff_range,
real(kind=dp), dimension(:, :, :), optional, pointer  e_0,
real(kind=dp), intent(in), optional  e_0_scale_factor 
)

smooths the cutoff on rho with a function smoothderiv_rho that is 0 for rho<rho_cutoff and 1 for rho>rho_cutoff*rho_smooth_cutoff_range: E= integral e_0*smoothderiv_rho => dE/d...= de/d... * smooth, dE/drho = de/drho * smooth + e_0 * dsmooth/drho

Parameters
potthe potential to smooth
rho,rhoa,rhobthe value of the density (used to apply the cutoff)
rhoa...
rhob...
rho_cutoffthe value at whch the cutoff function must go to 0
rho_smooth_cutoff_rangerange of the smoothing
e_0value of e_0, if given it is assumed that pot is the derivative wrt. to rho, and needs the dsmooth*e_0 contribution
e_0_scale_factor...
Author
Fawzi Mohamed

Definition at line 908 of file xc.F.

Here is the caller graph for this function:

◆ calc_xc_density()

subroutine, public xc::calc_xc_density ( type(pw_r3d_rs_type), intent(inout)  pot,
type(pw_r3d_rs_type), dimension(:), intent(inout)  rho,
real(kind=dp), intent(in)  rho_cutoff 
)

Definition at line 1061 of file xc.F.

◆ xc_vxc_pw_create()

subroutine, public xc::xc_vxc_pw_create ( type(pw_r3d_rs_type), dimension(:), pointer  vxc_rho,
type(pw_r3d_rs_type), dimension(:), pointer  vxc_tau,
real(kind=dp), intent(out)  exc,
type(pw_r3d_rs_type), dimension(:), pointer  rho_r,
type(pw_c1d_gs_type), dimension(:), pointer  rho_g,
type(pw_r3d_rs_type), dimension(:), pointer  tau,
type(section_vals_type), pointer  xc_section,
type(pw_pool_type), pointer  pw_pool,
logical  compute_virial,
real(kind=dp), dimension(3, 3), intent(out)  virial_xc,
type(pw_r3d_rs_type), intent(inout), optional  exc_r 
)

Exchange and Correlation functional calculations.

Parameters
vxc_rhowill contain the v_xc part that depend on rho (if one of the chosen xc functionals has it it is allocated and you are responsible for it)
vxc_tauwill contain the kinetic tau part of v_xc (if one of the chosen xc functionals has it it is allocated and you are responsible for it)
excthe xc energy
rho_rthe value of the density in the real space
rho_gvalue of the density in the g space (needs to be associated only for gradient corrections)
tauvalue of the kinetic density tau on the grid (can be null, used only with meta functionals)
xc_sectionwhich functional to calculate, and how to do it
pw_poolthe pool for the grids
compute_virial...
virial_xc...
exc_rthe value of the xc functional in the real space
History
JGH (13-Jun-2002): adaptation to new functionals Fawzi (11.2002): drho_g(1:3)->drho_g Fawzi (1.2003). lsd version Fawzi (11.2003): version using the new xc interface Fawzi (03.2004): fft free for smoothed density and derivs, gga lsd Fawzi (04.2004): metafunctionals mguidon (12.2008) : laplace functionals
Author
fawzi; based LDA version of JGH, based on earlier version of apsi
Note
Beware: some really dirty pointer handling! energy should be kept consistent with xc_exc_calc

Definition at line 1131 of file xc.F.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ xc_exc_calc()

real(kind=dp) function, public xc::xc_exc_calc ( type(pw_r3d_rs_type), dimension(:), pointer  rho_r,
type(pw_c1d_gs_type), dimension(:), pointer  rho_g,
type(pw_r3d_rs_type), dimension(:), pointer  tau,
type(section_vals_type), pointer  xc_section,
type(pw_pool_type), pointer  pw_pool 
)

calculates just the exchange and correlation energy (no vxc)

Parameters
rho_rrealspace density on the grid
rho_gg-space density on the grid
taukinetic energy density on the grid
xc_sectionXC parameters
pw_poolpool of plain-wave grids
Returns
the XC energy
History
11.2003 created [fawzi]
Author
fawzi
Note
has to be kept consistent with xc_vxc_pw_create

Definition at line 1447 of file xc.F.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ xc_calc_2nd_deriv()

subroutine, public xc::xc_calc_2nd_deriv ( type(pw_r3d_rs_type), dimension(:), pointer  v_xc,
type(pw_r3d_rs_type), dimension(:), pointer  v_xc_tau,
type(xc_derivative_set_type)  deriv_set,
type(xc_rho_set_type)  rho_set,
type(pw_r3d_rs_type), dimension(:), pointer  rho1_r,
type(pw_c1d_gs_type), dimension(:), pointer  rho1_g,
type(pw_r3d_rs_type), dimension(:), pointer  tau1_r,
type(pw_pool_type), intent(in), pointer  pw_pool,
type(section_vals_type), intent(in), pointer  xc_section,
logical, intent(in)  gapw,
real(kind=dp), dimension(:, :, :, :), optional, pointer  vxg,
logical, intent(in), optional  lsd_singlets,
logical, intent(in), optional  do_excitations,
logical, intent(in), optional  do_triplet,
logical, intent(in), optional  do_tddft,
logical, intent(in), optional  compute_virial,
real(kind=dp), dimension(3, 3), intent(inout), optional  virial_xc 
)

Caller routine to calculate the second order potential in the direction of rho1_r.

Parameters
v_xcXC potential, will be allocated, to be integrated with the KS density
v_xc_tau...
deriv_setXC derivatives from xc_prep_2nd_deriv
rho_setXC rho set from KS rho from xc_prep_2nd_deriv
rho1_rfirst-order density in r space
rho1_gfirst-order density in g space
tau1_r...
pw_poolpw pool to create new grids
xc_sectionXC section to calculate the derivatives from
gapwwhether to carry out GAPW (not possible with numerical derivatives)
vxgGAPW potential
lsd_singlets...
do_excitations...
do_triplet...
do_tddft...
compute_virial...
virial_xcvirial terms will be collected here

Definition at line 1519 of file xc.F.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ xc_calc_2nd_deriv_numerical()

subroutine, public xc::xc_calc_2nd_deriv_numerical ( type(pw_r3d_rs_type), dimension(:), intent(in), pointer  v_xc,
type(pw_r3d_rs_type), dimension(:), intent(in), pointer  v_tau,
type(xc_rho_set_type), intent(in)  rho_set,
type(pw_r3d_rs_type), dimension(:), intent(in), pointer  rho1_r,
type(pw_c1d_gs_type), dimension(:), intent(in), pointer  rho1_g,
type(pw_r3d_rs_type), dimension(:), intent(in), pointer  tau1_r,
type(pw_pool_type), intent(in), pointer  pw_pool,
type(section_vals_type), intent(in), pointer  xc_section,
logical, intent(in)  do_triplet,
logical, intent(in), optional  calc_virial,
real(kind=dp), dimension(3, 3), intent(inout), optional  virial_xc,
type(xc_derivative_set_type), optional  deriv_set 
)

calculates 2nd derivative numerically

Parameters
v_xcpotential to be calculated (has to be allocated already)
v_tautau-part of the potential to be calculated (has to be allocated already)
rho_setKS density from xc_prep_2nd_deriv
rho1_rfirst-order density in r-space
rho1_gfirst-order density in g-space
tau1_rfirst-order kinetic-energy density in r-space
pw_poolpw pool for new grids
xc_sectionXC section to calculate the derivatives from
do_triplet...
calc_virialwhether to calculate virial terms
virial_xccollects stress tensor components (no metaGGAs!)
deriv_setderiv set from xc_prep_2nd_deriv (only for virials)

Definition at line 1652 of file xc.F.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ xc_calc_2nd_deriv_analytical()

subroutine, public xc::xc_calc_2nd_deriv_analytical ( type(pw_r3d_rs_type), dimension(:), pointer  v_xc,
type(pw_r3d_rs_type), dimension(:), pointer  v_xc_tau,
type(xc_derivative_set_type)  deriv_set,
type(xc_rho_set_type), intent(in)  rho_set,
type(xc_rho_set_type), intent(in)  rho1_set,
type(pw_pool_type), pointer  pw_pool,
type(section_vals_type), pointer  xc_section,
logical, intent(in), optional  gapw,
real(kind=dp), dimension(:, :, :, :), optional, pointer  vxg,
real(kind=dp), intent(in), optional  tddfpt_fac,
logical, intent(in), optional  compute_virial,
real(kind=dp), dimension(3, 3), intent(inout), optional  virial_xc 
)

Calculates the second derivative of E_xc at rho in the direction rho1 (if you see the second derivative as bilinear form) partial_rho|_(rho=rho) partial_rho|_(rho=rho) E_xc drho(rho1)drho The other direction is still undetermined, thus it returns a potential (partial integration is performed to reduce it to function of rho, removing the dependence from its partial derivs) Has to be called after the setup by xc_prep_2nd_deriv.

Parameters
v_xcexchange-correlation potential
v_xc_tau...
deriv_setderivatives of the exchange-correlation potential
rho_setobject containing the density at which the derivatives were calculated
rho1_setobject containing the density with which to fold
pw_poolthe pool for the grids
xc_sectionXC parameters
gapwGaussian and augmented plane waves calculation
vxg...
tddfpt_facfactor that multiplies the crossterms (tddfpt triplets on a closed shell system it should be -1, defaults to 1)
compute_virial...
virial_xc...
Note
The old version of this routine was smarter: it handled split_desc(1) and split_desc(2) separately, thus the code automatically handled all possible cross terms (you only had to check if it was diagonal to avoid double counting). I think that is the way to go if you want to add more terms (tau,rho in LSD,...). The problem with the old code was that it because of the old functional structure it sometime guessed wrongly which derivative was where. There were probably still bugs with gradient corrected functionals (never tested), and it didn't contain first derivatives with respect to drho (that contribute also to the second derivative wrt. rho). The code was a little complex because it really tried to handle any functional derivative in the most efficient way with the given contents of rho_set. Anyway I strongly encourage whoever wants to modify this code to give a look to the old version. [fawzi]

Definition at line 2632 of file xc.F.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ xc_prep_2nd_deriv()

subroutine, public xc::xc_prep_2nd_deriv ( type(xc_derivative_set_type)  deriv_set,
type(xc_rho_set_type)  rho_set,
type(pw_r3d_rs_type), dimension(:), pointer  rho_r,
type(pw_pool_type), pointer  pw_pool,
type(section_vals_type), pointer  xc_section,
type(pw_r3d_rs_type), dimension(:), optional, pointer  tau_r 
)

Prepare objects for the calculation of the 2nd derivatives of the density functional. The calculation must then be performed with xc_calc_2nd_deriv.

Parameters
deriv_setobject containing the XC derivatives (out)
rho_setobject that will contain the density at which the derivatives were calculated
rho_rthe place where you evaluate the derivative
pw_poolthe pool for the grids
xc_sectionwhich functional should be used and how to calculate it
tau_rkinetic energy density in real space

Definition at line 5362 of file xc.F.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ divide_by_norm_drho()

subroutine, public xc::divide_by_norm_drho ( type(xc_derivative_set_type), intent(inout)  deriv_set,
type(xc_rho_set_type), intent(in)  rho_set,
logical, intent(in)  lsd 
)

divides derivatives from deriv_set by norm_drho

Parameters
deriv_set...
rho_set...
lsd...

Definition at line 5411 of file xc.F.

Here is the call graph for this function:
Here is the caller graph for this function: