28 use,
intrinsic :: iso_fortran_env
47 logical :: with_current_term = .
true.
52 type(namespace_t),
intent(in) :: namespace
74 subroutine elf_calc(space, st, gr, kpoints, elf, de, rho_paw, tau_paw)
75 class(space_t),
intent(in) :: space
76 type(states_elec_t),
intent(inout) :: st
77 type(grid_t),
intent(in) :: gr
78 type(kpoints_t),
intent(in) :: kpoints
83 real(real64),
contiguous,
intent(inout) :: elf(:,:)
84 real(real64),
contiguous,
optional,
intent(inout):: de(:,:)
88 real(real64),
contiguous,
optional,
intent(in) :: rho_paw(:,:)
89 real(real64),
contiguous,
optional,
intent(in) :: tau_paw(:,:)
91 real(real64) :: factor, D0, dens
92 integer :: ip, is, nelfs
93 real(real64),
allocatable :: rho(:,:), grho(:,:,:), jj(:,:,:), rho_ae(:)
94 real(real64),
allocatable :: kappa(:,:)
95 real(real64),
parameter :: dmin = 1e-10_real64
99 assert(space%dim == 2 .or. space%dim == 3)
105 safe_allocate( rho(1:gr%np, 1:st%d%nspin))
106 safe_allocate(kappa(1:gr%np, 1:st%d%nspin))
109 if (st%requires_generalized_overlap)
then
111 rho(1:gr%np, 1:st%d%nspin) = st%rho(1:gr%np, 1:st%d%nspin)
116 safe_allocate(grho(1:gr%np, 1:space%dim, 1:st%d%nspin))
117 safe_allocate( jj(1:gr%np, 1:space%dim, 1:st%d%nspin))
120 paramagnetic_current = jj, density_gradient = grho)
124 if (
present(tau_paw))
call lalg_axpy(gr%np, st%d%nspin,
m_one, tau_paw, kappa)
125 if (
present(rho_paw))
then
127 assert(st%requires_generalized_overlap)
134 safe_allocate(rho_ae(1:gr%np_part))
135 do is = 1, st%d%nspin
136 rho_ae(1:gr%np) = rho(1:gr%np, is)
139 safe_deallocate_a(rho_ae)
150 if (.not. with_current_term) jj =
m_zero
153 do_is:
do is = 1, st%d%nspin
155 kappa(ip, is) = kappa(ip, is)*rho(ip, is) &
156 -
m_fourth*sum(grho(ip, 1:space%dim, is)**2) &
157 - sum(jj(ip, 1:space%dim, is)**2)
161 if (
present(de)) de(1:gr%np,is) = kappa(1:gr%np,is)
165 safe_deallocate_a(grho)
166 safe_deallocate_a(jj)
168 select case (space%dim)
175 select case (st%d%ispin)
178 if (rho(ip, 1) >= dmin)
then
179 select case (space%dim)
181 d0 = factor * rho(ip, 1)**(8.0_real64 /
m_three)
183 d0 = factor * rho(ip, 1)**3
185 elf(ip, 1) = d0 * d0 / (d0 * d0 + kappa(ip, 1)**2)
194 dens = rho(ip, 1) + rho(ip, 2)
195 if (dens >= dmin)
then
196 select case (space%dim)
198 d0 = factor * dens ** (
m_five/
m_three) * rho(ip, 1) * rho(ip, 2)
200 d0 = factor * dens ** 2 * rho(ip, 1) * rho(ip, 2)
202 elf(ip, 3) = d0 * d0 / (d0 * d0 + (kappa(ip, 1) * rho(ip, 2) + kappa(ip,2) * rho(ip, 1))**2)
209 do is = 1, st%d%spin_channels
210 if (rho(ip, is) >= dmin)
then
211 select case (space%dim)
213 d0 = factor * rho(ip, is)**(8.0_real64/
m_three)
215 d0 = factor * rho(ip, is)**3
217 elf(ip, is) = d0 * d0 / (d0 * d0 + kappa(ip,is)**2)
225 safe_deallocate_a(rho)
226 safe_deallocate_a(kappa)
constant times a vector plus a vector
This module implements a calculator for the density and defines related functions.
subroutine, public density_calc(st, gr, density, istin, ep, vnl, phase)
Computes the density from the orbitals in st.
This module calculates the derivatives (gradients, Laplacians, etc.) of a function.
subroutine, public dderivatives_grad(der, ff, op_ff, ghost_update, set_bc, to_cartesian)
apply the gradient to a mesh function
integer, parameter, public unpolarized
Parameters...
integer, parameter, public spinors
integer, parameter, public spin_polarized
subroutine, public elf_calc(space, st, gr, kpoints, elf, de, rho_paw, tau_paw)
(time-dependent) electron localization function, (TD)ELF.
subroutine, public elf_init(namespace)
real(real64), parameter, public m_two
real(real64), parameter, public m_zero
real(real64), parameter, public m_pi
some mathematical constants
real(real64), parameter, public m_fourth
real(real64), parameter, public m_twothird
real(real64), parameter, public m_one
real(real64), parameter, public m_three
real(real64), parameter, public m_five
This module implements the underlying real-space grid.
This module defines the meshes, which are used in Octopus.
/* To use the profiling module, call profiling_in and profiling_out with the label of the region as a...
This module handles spin dimensions of the states and the k-point distribution.
subroutine, public states_elec_calc_quantities(gr, st, kpoints, nlcc, kinetic_energy_density, paramagnetic_current, density_gradient, density_laplacian, gi_kinetic_energy_density, st_end)
calculated selected quantities