55  integer, 
parameter, 
public :: &
 
   56    SIC_NONE   = 1,     &  !< no self-interaction correction
 
   64    integer,        
public :: level = sic_none  
 
   65    real(real64),   
public :: amaldi_factor
 
   66    type(xc_oep_t), 
public :: oep
 
   74  subroutine xc_sic_init(sic, namespace, gr, st, mc, space)
 
   75    type(xc_sic_t),      
intent(out)   :: sic
 
   76    type(namespace_t),   
intent(in)    :: namespace
 
   77    type(grid_t),        
intent(inout) :: gr
 
   78    type(states_elec_t), 
intent(in)    :: st
 
   79    type(multicomm_t),   
intent(in)    :: mc
 
   80    class(space_t),      
intent(in)    :: space
 
  106    call parse_variable(namespace, 
'SICCorrection', sic_none, sic%level)
 
  110    sic%amaldi_factor = 
m_one 
  112      sic%amaldi_factor = (st%qtot - 
m_one)/st%qtot
 
  121      if(st%nik > st%d%spin_channels) 
then 
  126    if (
allocated(st%rho_core)) 
then 
  134    if (space%is_periodic() .and. sic%level /= sic_none) 
then 
  144    type(xc_sic_t),  
intent(inout) :: sic
 
  146    if (sic%level == sic_none) 
return 
  159    integer,           
optional, 
intent(in) :: iunit
 
  160    type(
namespace_t), 
optional, 
intent(in) :: namespace
 
  162    if (sic%level == sic_none) 
return 
  188  subroutine xc_sic_calc_adsic(sic, namespace, space, gr, st, hm, xc, density, vxc, ex, ec)
 
  191    class(
space_t),              
intent(in) :: space
 
  192    type(
grid_t),                
intent(in) :: gr
 
  195    type(
xc_t),               
intent(inout) :: xc
 
  196    real(real64), 
contiguous,           
intent(in) :: density(:,:)
 
  197    real(real64), 
contiguous,        
intent(inout) :: vxc(:,:)
 
  198    real(real64), 
optional,          
intent(inout) :: ex, ec
 
  200    integer            :: ispin, ist, ik, ip
 
  201    real(real64), 
allocatable :: vxc_sic(:,:),  vh_sic(:), rho(:, :), qsp(:)
 
  202    real(real64) :: ex_sic, ec_sic
 
  203    real(real64) :: dtot, dpol, vpol
 
  204    real(real64), 
parameter :: 
tiny = 1e-12_real64 
 
  211    if (st%d%ispin == 
spinors .and. 
bitand(xc%family, xc_family_lda) == 0) 
then 
  216    safe_allocate(qsp(1:2))
 
  218    if( .not. 
allocated(st%frozen_rho)) 
then 
  219      select case (st%d%ispin)
 
  223            ispin = st%d%get_spin_index(ik)
 
  224            qsp(ispin) = qsp(ispin) + st%occ(ist, ik) * st%kweights(ik)
 
  231      do ispin = 1, st%d%nspin
 
  236    safe_allocate(vxc_sic(1:gr%np, 1:2))
 
  237    safe_allocate(vh_sic(1:gr%np))
 
  238    safe_allocate(rho(1:gr%np, 1:2))
 
  240    select case (st%d%ispin)
 
  242      do ispin = 1, st%d%nspin
 
  248        rho(:, ispin) = density(:, ispin) / qsp(ispin)
 
  249        if(
present(ex) .and. 
present(ec)) 
then 
  253          call xc_get_vxc(gr, xc, st, hm%kpoints, hm%psolver, namespace, space, &
 
  254            rho, 
spin_polarized, hm%ions%latt%rcell_volume, vxc_sic, ex = ex_sic, ec = ec_sic)
 
  255          ex = ex - ex_sic * qsp(ispin)
 
  256          ec = ec - ec_sic * qsp(ispin)
 
  259          call xc_get_vxc(gr, xc, st, hm%kpoints, hm%psolver, namespace, space, &
 
  268        call dpoisson_solve(hm%psolver, namespace, vh_sic, rho(:, ispin), all_nodes=.false.)
 
  282      assert(
bitand(xc%family, xc_family_lda) /= 0)
 
  289          dtot = density(ip, 1) + density(ip, 2)
 
  290          dpol = 
sqrt((density(ip, 1) - density(ip, 2))**2 + &
 
  291            m_four*(density(ip, 3)**2 + density(ip, 4)**2))
 
  299        if (nup <= 1e-14_real64) cycle
 
  303        if(
present(ex) .and. 
present(ec)) 
then 
  306          call xc_get_vxc(gr, xc, st, hm%kpoints, hm%psolver, namespace, space, &
 
  307            rho, 
spin_polarized, hm%ions%latt%rcell_volume, vxc_sic, ex = ex_sic, ec = ec_sic)
 
  308          ex = ex - ex_sic * nup
 
  309          ec = ec - ec_sic * nup
 
  311          call xc_get_vxc(gr, xc, st, hm%kpoints, hm%psolver, namespace, space, &
 
  323        call dpoisson_solve(hm%psolver, namespace, vh_sic, rho(:, ispin), all_nodes=.false.)
 
  331          dpol = 
sqrt((density(ip, 1) - density(ip, 2))**2 + &
 
  332            m_four*(density(ip, 3)**2 + density(ip, 4)**2))
 
  333          vpol = (vxc_sic(ip, 1) - vxc_sic(ip, 2))*(density(ip, 1) - density(ip, 2))/(safe_tol(dpol, 
tiny))
 
  335          vxc(ip, 1) = vxc(ip, 1) - 
m_half*(vxc_sic(ip, 1) + vxc_sic(ip, 2) + vpol)
 
  336          vxc(ip, 2) = vxc(ip, 2) - 
m_half*(vxc_sic(ip, 1) + vxc_sic(ip, 2) - vpol)
 
  337          vxc(ip, 3) = vxc(ip, 3) - (vxc_sic(ip, 1) - vxc_sic(ip, 2))*density(ip, 3)/(safe_tol(dpol, 
tiny))
 
  338          vxc(ip, 4) = vxc(ip, 4) - (vxc_sic(ip, 1) - vxc_sic(ip, 2))*density(ip, 4)/(safe_tol(dpol, 
tiny))
 
  345    safe_deallocate_a(qsp)
 
  346    safe_deallocate_a(vxc_sic)
 
  347    safe_deallocate_a(vh_sic)
 
  348    safe_deallocate_a(rho)
 
constant times a vector plus a vector
 
scales a vector by a constant
 
double sqrt(double __x) __attribute__((__nothrow__
 
integer, parameter, public unpolarized
Parameters...
 
integer, parameter, public spinors
 
integer, parameter, public spin_polarized
 
real(real64), parameter, public m_zero
 
real(real64), parameter, public m_four
 
real(real64), parameter, public m_half
 
real(real64), parameter, public m_one
 
real(real64), parameter, public m_min_occ
Minimal occupation that is considered to be non-zero.
 
This module implements the underlying real-space grid.
 
This module defines various routines, operating on mesh functions.
 
real(real64) function, public dmf_integrate(mesh, ff, mask, reduce)
Integrate a function on the mesh.
 
subroutine, public messages_not_implemented(feature, namespace)
 
subroutine, public messages_input_error(namespace, var, details, row, column)
 
This module handles the communicators for the various parallelization strategies.
 
subroutine, public dpoisson_solve(this, namespace, pot, rho, all_nodes, kernel)
Calculates the Poisson equation. Given the density returns the corresponding potential.
 
This module handles spin dimensions of the states and the k-point distribution.
 
real(real64), parameter tiny
 
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, public xc_oep_end(oep)
 
subroutine, public xc_oep_init(oep, namespace, gr, st, mc, space, oep_type)
 
integer, parameter, public oep_type_sic
 
subroutine, public xc_sic_write_info(sic, iunit, namespace)
 
integer, parameter, public sic_adsic
Averaged density SIC.
 
subroutine, public xc_sic_init(sic, namespace, gr, st, mc, space)
initialize the SIC object
 
subroutine, public xc_sic_end(sic)
finalize the SIC and, if needed, the included OEP
 
integer, parameter, public sic_pz_oep
Perdew-Zunger SIC (OEP way)
 
integer, parameter, public sic_amaldi
Amaldi correction term.
 
subroutine, public xc_sic_calc_adsic(sic, namespace, space, gr, st, hm, xc, density, vxc, ex, ec)
Computes the ADSIC potential and energy.
 
Description of the grid, containing information on derivatives, stencil, and symmetries.
 
The states_elec_t class contains all electronic wave functions.
 
This class contains information about the self-interaction correction.