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
220 safe_allocate(qsp(1:2))
222 if( .not.
allocated(st%frozen_rho))
then
223 select case (st%d%ispin)
227 ispin = st%d%get_spin_index(ik)
228 qsp(ispin) = qsp(ispin) + st%occ(ist, ik) * st%kweights(ik)
235 do ispin = 1, st%d%nspin
240 safe_allocate(vxc_sic(1:gr%np, 1:2))
241 safe_allocate(vh_sic(1:gr%np))
242 safe_allocate(rho(1:gr%np, 1:2))
244 select case (st%d%ispin)
246 do ispin = 1, st%d%nspin
252 rho(:, ispin) = density(:, ispin) / qsp(ispin)
253 if(
present(ex) .and.
present(ec))
then
257 call xc_get_vxc(gr, xc, st, hm%kpoints, hm%psolver, namespace, space, &
258 rho,
spin_polarized, hm%ions%latt%rcell_volume, vxc_sic, ex = ex_sic, ec = ec_sic)
259 ex = ex - ex_sic * qsp(ispin)
260 ec = ec - ec_sic * qsp(ispin)
263 call xc_get_vxc(gr, xc, st, hm%kpoints, hm%psolver, namespace, space, &
272 call dpoisson_solve(hm%psolver, namespace, vh_sic, rho(:, ispin), all_nodes=.false.)
286 assert(
bitand(xc%family, xc_family_lda) /= 0)
293 dtot = density(ip, 1) + density(ip, 2)
294 dpol =
sqrt((density(ip, 1) - density(ip, 2))**2 + &
295 m_four*(density(ip, 3)**2 + density(ip, 4)**2))
303 if (nup <= 1e-14_real64) cycle
307 if(
present(ex) .and.
present(ec))
then
310 call xc_get_vxc(gr, xc, st, hm%kpoints, hm%psolver, namespace, space, &
311 rho,
spin_polarized, hm%ions%latt%rcell_volume, vxc_sic, ex = ex_sic, ec = ec_sic)
312 ex = ex - ex_sic * nup
313 ec = ec - ec_sic * nup
315 call xc_get_vxc(gr, xc, st, hm%kpoints, hm%psolver, namespace, space, &
327 call dpoisson_solve(hm%psolver, namespace, vh_sic, rho(:, ispin), all_nodes=.false.)
335 dpol =
sqrt((density(ip, 1) - density(ip, 2))**2 + &
336 m_four*(density(ip, 3)**2 + density(ip, 4)**2))
337 vpol = (vxc_sic(ip, 1) - vxc_sic(ip, 2))*(density(ip, 1) - density(ip, 2))/(safe_tol(dpol,
tiny))
339 vxc(ip, 1) = vxc(ip, 1) -
m_half*(vxc_sic(ip, 1) + vxc_sic(ip, 2) + vpol)
340 vxc(ip, 2) = vxc(ip, 2) -
m_half*(vxc_sic(ip, 1) + vxc_sic(ip, 2) - vpol)
341 vxc(ip, 3) = vxc(ip, 3) - (vxc_sic(ip, 1) - vxc_sic(ip, 2))*density(ip, 3)/(safe_tol(dpol,
tiny))
342 vxc(ip, 4) = vxc(ip, 4) - (vxc_sic(ip, 1) - vxc_sic(ip, 2))*density(ip, 4)/(safe_tol(dpol,
tiny))
349 safe_deallocate_a(qsp)
350 safe_deallocate_a(vxc_sic)
351 safe_deallocate_a(vh_sic)
352 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)
logical function, public xc_is_not_size_consistent(xcs, namespace)
Is one of the x or c functional is not size consistent.
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.