28  use, 
intrinsic :: iso_fortran_env
 
   46  logical :: with_current_term = .
true.
 
   51    type(namespace_t),    
intent(in)    :: namespace
 
   73  subroutine elf_calc(space, st, gr, kpoints, elf, de)
 
   74    class(space_t),        
intent(in)    :: space
 
   75    type(states_elec_t),   
intent(inout) :: st
 
   76    type(grid_t),          
intent(in)    :: gr
 
   77    type(kpoints_t),       
intent(in)    :: kpoints
 
   82    real(real64),     
intent(inout) :: elf(:,:)
 
   83    real(real64),  
optional, 
intent(inout):: de(:,:)
 
   85    real(real64) :: factor, D0, dens
 
   86    integer :: ip, is, nelfs
 
   87    real(real64), 
allocatable :: rho(:,:), grho(:,:,:), jj(:,:,:)
 
   88    real(real64), 
allocatable :: kappa(:,:)
 
   89    real(real64), 
parameter :: dmin = 1e-10_real64
 
   93    assert(space%dim == 2 .or. space%dim == 3)
 
   99    safe_allocate(  rho(1:gr%np, 1:st%d%nspin))
 
  100    safe_allocate(kappa(1:gr%np, 1:st%d%nspin))
 
  105    safe_allocate(grho(1:gr%np, 1:space%dim, 1:st%d%nspin))
 
  106    safe_allocate(  jj(1:gr%np, 1:space%dim, 1:st%d%nspin))
 
  109      paramagnetic_current = jj, density_gradient = grho)
 
  119    if (.not. with_current_term) jj = 
m_zero 
  122    do_is: 
do is = 1, st%d%nspin
 
  124        kappa(ip, is) = kappa(ip, is)*rho(ip, is)        &    
 
  125          - 
m_fourth*sum(grho(ip, 1:space%dim, is)**2)      &    
 
  126          - sum(jj(ip, 1:space%dim, is)**2)                      
 
  130      if (
present(de)) de(1:gr%np,is) = kappa(1:gr%np,is)
 
  134    safe_deallocate_a(grho)
 
  135    safe_deallocate_a(jj)   
 
  137    select case (space%dim)
 
  144    select case (st%d%ispin)
 
  147        if (rho(ip, 1) >= dmin) 
then 
  148          select case (space%dim)
 
  150            d0 = factor * rho(ip, 1)**(8.0_real64 / 
m_three)
 
  152            d0 = factor * rho(ip, 1)**3
 
  154          elf(ip, 1) = d0 * d0 / (d0 * d0 + kappa(ip, 1)**2)
 
  163          dens = rho(ip, 1) + rho(ip, 2)
 
  164          if (dens >= dmin) 
then 
  165            select case (space%dim)
 
  167              d0 = factor * dens ** (
m_five/
m_three) * rho(ip, 1) * rho(ip, 2)
 
  169              d0 = factor * dens ** 2 * rho(ip, 1) * rho(ip, 2)
 
  171            elf(ip, 3) = d0 * d0 / (d0 * d0 + (kappa(ip, 1) * rho(ip, 2) + kappa(ip,2) * rho(ip, 1))**2)
 
  178        do is = 1, st%d%spin_channels
 
  179          if (rho(ip, is) >= dmin) 
then 
  180            select case (space%dim)
 
  182              d0 = factor * rho(ip, is)**(8.0_real64/
m_three)
 
  184              d0 = factor * rho(ip, is)**3
 
  186            elf(ip, is) = d0 * d0 / (d0 * d0 + kappa(ip,is)**2)
 
  194    safe_deallocate_a(rho)
 
  195    safe_deallocate_a(kappa)
 
This module implements a calculator for the density and defines related functions.
 
subroutine, public density_calc(st, gr, density, istin)
Computes the density from the orbitals in st.
 
This module calculates the derivatives (gradients, Laplacians, etc.) of a 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)
(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_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.
 
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