32  use, 
intrinsic :: iso_fortran_env
 
   67    logical :: computepdos
 
   72  subroutine dos_init(this, namespace, st, kpoints)
 
   73    type(dos_t),         
intent(out)   :: this
 
   74    type(namespace_t),   
intent(in)    :: namespace
 
   75    type(states_elec_t), 
intent(in)    :: st
 
   76    type(kpoints_t),     
intent(in)    :: kpoints
 
   78    real(real64) :: evalmin, evalmax, eextend
 
   85    npath = kpoints%nkpt_in_path()
 
   86    if (st%nik > npath) 
then 
   87      evalmin = minval(st%eigenval(1:st%nst, 1:(st%nik-npath)))
 
   88      evalmax = maxval(st%eigenval(1:st%nst, 1:(st%nik-npath)))
 
   90      evalmin = minval(st%eigenval(1:st%nst, 1:st%nik))
 
   91      evalmax = maxval(st%eigenval(1:st%nst, 1:st%nik))
 
   94    eextend  = (evalmax - evalmin) / 
m_four 
  123    call parse_variable(namespace, 
'DOSEnergyPoints', 500, this%epoints)
 
  149    call parse_variable(namespace, 
'DOSComputePDOS', .false., this%computepdos)
 
  152    this%de = (this%emax - this%emin) / (this%epoints - 1)
 
  160    character(len=*),         
intent(in) :: dir
 
  162    class(
box_t),             
intent(in) :: box
 
  163    type(
ions_t),     
target, 
intent(in) :: ions
 
  164    class(
mesh_t),            
intent(in) :: mesh
 
  168    integer :: ie, ik, ist, is, ns, maxdos
 
  169    integer, 
allocatable :: iunit(:)
 
  170    real(real64)   :: energy
 
  171    real(real64), 
allocatable :: tdos(:)
 
  172    real(real64), 
allocatable :: dos(:,:,:)
 
  173    character(len=64)  :: filename,format_str
 
  176    integer :: ii, ll, mm, nn, work, norb, work2
 
  177    integer :: ia, iorb, idim
 
  178    real(real64)   :: threshold
 
  179    real(real64), 
allocatable :: dpsi(:,:), ddot(:,:)
 
  180    complex(real64), 
allocatable :: zpsi(:,:), zdot(:,:)
 
  181    real(real64), 
allocatable :: weight(:,:,:)
 
  188    if (st%d%nspin == 2) ns = 2
 
  192      safe_allocate(dos(1:this%epoints, 1:st%nst, 0:ns-1))
 
  193      safe_allocate(iunit(0:ns-1))
 
  200            write(filename, 
'(a,i4.4,a,i1.1,a)') 
'dos-', ist, 
'-', is+1,
'.dat' 
  202            write(filename, 
'(a,i4.4,a)') 
'dos-', ist, 
'.dat' 
  204          iunit(is) = 
io_open(trim(dir)//
'/'//trim(filename), namespace, action=
'write')
 
  209        do ie = 1, this%epoints
 
  210          energy = this%emin + (ie - 1) * this%de
 
  213          do ik = 1, st%nik, ns
 
  215              dos(ie, ist, is) = dos(ie, ist, is) + st%kweights(ik+is) * 
m_one/
m_pi * &
 
  216                this%gamma / ((energy - st%eigenval(ist, ik+is))**2 + this%gamma**2)
 
  231      safe_allocate(tdos(1))
 
  234      if (st%d%nspin > 1) 
then 
  236          write(filename, 
'(a,i1.1,a)') 
'total-dos-', is+1,
'.dat' 
  237          iunit(is) = 
io_open(trim(dir)//
'/'//trim(filename), namespace, action=
'write')
 
  239          write(iunit(is), 
'(3a)') 
'# energy [', trim(
units_abbrev(
units_out%energy)), 
'], total DOS (spin-resolved)' 
  241          do ie = 1, this%epoints
 
  242            energy = this%emin + (ie - 1) * this%de
 
  245              tdos(1) = tdos(1) + dos(ie, ist, is)
 
  257      iunit(0) = 
io_open(trim(dir)//
'/'//
'total-dos.dat', namespace, action=
'write')
 
  261      do ie = 1, this%epoints
 
  262        energy = this%emin + (ie - 1) * this%de
 
  266            tdos(1) = tdos(1) + dos(ie, ist, is)
 
  276      safe_deallocate_a(tdos)
 
  280      iunit(0) = 
io_open(trim(dir)//
'/'//
'total-dos-efermi.dat', namespace, action=
'write')
 
  282        '] in a format compatible with total-dos.dat' 
  285      maxdos = st%smear%el_per_state * st%nst
 
  295    if (this%computepdos) 
then 
  298      call parse_variable(namespace, 
'AOThreshold', 0.01_real64, threshold)
 
  302        safe_allocate(dpsi(1:mesh%np, 1:st%d%dim))
 
  304        safe_allocate(zpsi(1:mesh%np, 1:st%d%dim))
 
  308      do ia = 1, ions%natoms
 
  315          os%spec => ions%atom(ia)%species
 
  319          do iorb = 1, os%spec%get_niwfs()
 
  320            call os%spec%get_iwf_ilm(iorb, 1, ii, ll, mm)
 
  321            call os%spec%get_iwf_n(iorb, 1, nn)
 
  327                option__aotruncation__ao_full, threshold)
 
  333          os%use_submesh = .false.
 
  335          do work = 1, os%norbs
 
  339                ions%atom(ia)%species, mesh, os%sphere, os%ii, os%ll, os%jj, &
 
  340                os, work, os%radius, os%ndim, use_mesh=.not.os%use_submesh, &
 
  341                normalize = normalize)
 
  344                ions%atom(ia)%species, mesh, os%sphere, os%ii, os%ll, os%jj, &
 
  345                os, work, os%radius, os%ndim, &
 
  346                use_mesh = .not. hm%phase%is_allocated() .and. .not. os%use_submesh, &
 
  347                normalize = normalize)
 
  351          if (hm%phase%is_allocated()) 
then 
  353            safe_allocate(os%phase(1:os%sphere%np, st%d%kpt%start:st%d%kpt%end))
 
  356            if (.not. os%use_submesh) 
then 
  357              safe_allocate(os%eorb_mesh(1:mesh%np, 1:os%norbs, 1:os%ndim, st%d%kpt%start:st%d%kpt%end))
 
  358              os%eorb_mesh(:,:,:,:) = 
m_zero 
  360              safe_allocate(os%eorb_submesh(1:os%sphere%np, 1:os%ndim, 1:os%norbs, st%d%kpt%start:st%d%kpt%end))
 
  361              os%eorb_submesh(:,:,:,:) = 
m_zero 
  365              os%ldorbs = max(
pad_pow2(os%sphere%np), 1)
 
  366              if(.not. os%use_submesh) os%ldorbs = max(
pad_pow2(os%sphere%mesh%np), 1)
 
  368              safe_allocate(os%buff_eorb(st%d%kpt%start:st%d%kpt%end))
 
  369              do ik= st%d%kpt%start, st%d%kpt%end
 
  375              vec_pot = hm%hm_base%uniform_vector_potential, &
 
  376              vec_pot_var = hm%hm_base%vector_potential)
 
  381              write(filename,
'(a, i3.3, a1, a, i1.1, a1,a)') 
'pdos-at', ia, 
'-', trim(os%spec%get_label()), &
 
  384              write(filename,
'(a,  i3.3, a1, a, a1,a)') 
'pdos-at', ia, 
'-', trim(os%spec%get_label()), &
 
  388            iunit(0) = 
io_open(trim(dir)//
'/'//trim(filename), namespace, action=
'write')
 
  391              '], projected DOS (total and orbital resolved)' 
  395            safe_allocate(ddot(1:st%d%dim,1:os%norbs))
 
  397            safe_allocate(zdot(1:st%d%dim,1:os%norbs))
 
  400          safe_allocate(weight(1:os%norbs,1:st%nik,1:st%nst))
 
  401          weight(1:os%norbs,1:st%nik,1:st%nst) = 
m_zero 
  403          do ist = st%st_start, st%st_end
 
  404            do ik = st%d%kpt%start, st%d%kpt%end
 
  405              if (abs(st%kweights(ik)) <= 
m_epsilon) cycle
 
  409                do iorb = 1, os%norbs
 
  410                  do idim = 1, st%d%dim
 
  411                    weight(iorb,ik,ist) = weight(iorb,ik,ist) + st%kweights(ik)*abs(ddot(idim,iorb))**2
 
  416                if (hm%phase%is_allocated()) 
then 
  418                  call hm%phase%apply_to_single(zpsi, mesh%np, st%d%dim, ik, .false.)
 
  423                do iorb = 1, os%norbs
 
  424                  do idim = 1, st%d%dim
 
  425                    weight(iorb,ik,ist) = weight(iorb,ik,ist) + st%kweights(ik)*abs(zdot(idim,iorb))**2
 
  432          if (st%parallel_in_states .or. st%d%kpt%parallel) 
then 
  436          safe_deallocate_a(ddot)
 
  437          safe_deallocate_a(zdot)
 
  440            write(format_str,
'(a,i2,a)') 
'(', os%norbs+2, 
'f12.6)' 
  441            safe_allocate(tdos(1:os%norbs))
 
  442            do ie = 1, this%epoints
 
  443              energy = this%emin + (ie - 1) * this%de
 
  444              do iorb = 1, os%norbs
 
  448                    tdos(iorb) = tdos(iorb) + weight(iorb,ik,ist) * 
m_one/
m_pi * &
 
  449                      this%gamma / ((energy - st%eigenval(ist, ik))**2 + this%gamma**2)
 
  458            safe_deallocate_a(tdos)
 
  463          safe_deallocate_a(weight)
 
  469      safe_deallocate_a(dpsi)
 
  470      safe_deallocate_a(zpsi)
 
  473    safe_deallocate_a(iunit)
 
  474    safe_deallocate_a(dos)
 
  480  subroutine dos_write_jdos(this, dir, st, box, ions, mesh, hm, namespace)
 
  481    type(
dos_t),               
intent(in) :: this
 
  482    character(len=*),         
intent(in) :: dir
 
  484    class(
box_t),             
intent(in) :: box
 
  485    type(
ions_t),     
target, 
intent(in) :: ions
 
  486    class(
mesh_t),            
intent(in) :: mesh
 
  490    integer :: ie, ik, val, cond, is, ns
 
  491    integer, 
allocatable :: iunit(:)
 
  492    real(real64) :: energy
 
  493    real(real64) :: tjdos(1)
 
  494    real(real64), 
allocatable :: jdos(:,:)
 
  495    character(len=64)  :: filename
 
  501    if (st%d%nspin == 2) ns = 2
 
  505      safe_allocate(jdos(1:this%epoints, 0:ns-1))
 
  506      safe_allocate(iunit(0:ns-1))
 
  511        do cond = val, st%nst
 
  512          do ik = 1, st%nik, ns
 
  515              if(st%occ(cond, ik+is) > 
m_epsilon) cycle
 
  516              do ie = 1, this%epoints
 
  517                energy = (ie - 1) * this%de
 
  519                jdos(ie, is) = jdos(ie, is) + st%kweights(ik+is) * 
m_one/
m_pi * &
 
  520                  this%gamma / ((energy - (st%eigenval(cond, ik+is)-st%eigenval(val, ik+is)))**2 + this%gamma**2)
 
  528      if (st%d%nspin > 1) 
then 
  530          write(filename, 
'(a,i1.1,a)') 
'total-jdos-', is+1,
'.dat' 
  531          iunit(is) = 
io_open(trim(dir)//
'/'//trim(filename), namespace, action=
'write')
 
  533          write(iunit(is), 
'(3a)') 
'# energy [', trim(
units_abbrev(
units_out%energy)), 
'], total JDOS (spin-resolved)' 
  535          do ie = 1, this%epoints
 
  536            energy = (ie - 1) * this%de
 
  547      iunit(0) = 
io_open(trim(dir)//
'/'//
'total-jdos.dat', namespace, action=
'write')
 
  551      do ie = 1, this%epoints
 
  552        energy = (ie - 1) * this%de
 
  555          tjdos(1) = tjdos(1) + jdos(ie, is)
 
  565    safe_deallocate_a(iunit)
 
  566    safe_deallocate_a(jdos)
 
pure logical function, public accel_is_enabled()
 
integer, parameter, public accel_mem_read_only
 
subroutine, public zget_atomic_orbital(namespace, space, latt, pos, species, mesh, sm, ii, ll, jj, os, orbind, radius, d_dim, use_mesh, normalize)
This routine returns the atomic orbital basis – provided by the pseudopotential structure in geo.
 
subroutine, public dget_atomic_orbital(namespace, space, latt, pos, species, mesh, sm, ii, ll, jj, os, orbind, radius, d_dim, use_mesh, normalize)
This routine returns the atomic orbital basis – provided by the pseudopotential structure in geo.
 
character(len=1), dimension(0:3), parameter, public l_notation
 
real(real64) function, public atomic_orbital_get_radius(species, mesh, iorb, ispin, truncation, threshold)
 
subroutine, public dos_write_dos(this, dir, st, box, ions, mesh, hm, namespace)
 
subroutine, public dos_init(this, namespace, st, kpoints)
 
subroutine, public dos_write_jdos(this, dir, st, box, ions, mesh, hm, namespace)
 
integer, parameter, public spin_polarized
 
real(real64), parameter, public m_zero
 
real(real64), parameter, public m_four
 
real(real64), parameter, public m_pi
some mathematical constants
 
real(real64), parameter, public m_epsilon
 
real(real64), parameter, public m_one
 
subroutine, public io_close(iunit, grp)
 
integer function, public io_open(file, namespace, action, status, form, position, die, recl, grp)
 
This module is intended to contain "only mathematical" functions and procedures.
 
integer pure function, public pad_pow2(size)
create array size, which is padded to powers of 2
 
This module defines the meshes, which are used in Octopus.
 
subroutine, public messages_info(no_lines, iunit, verbose_limit, stress, all_nodes, namespace)
 
character(len=256), dimension(max_lines), public message
to be output by fatal, warning
 
logical function mpi_grp_is_root(grp)
 
type(mpi_grp_t), public mpi_world
 
subroutine, public orbitalset_init(this)
 
subroutine, public orbitalset_end(this)
 
subroutine, public orbitalset_update_phase(os, dim, kpt, kpoints, spin_polarized, vec_pot, vec_pot_var, kpt_max)
Build the phase correction to the global phase in case the orbital crosses the border of the simulato...
 
subroutine, public dorbitalset_get_coefficients(os, ndim, psi, ik, has_phase, dot, reduce)
 
subroutine, public zorbitalset_get_coefficients(os, ndim, psi, ik, has_phase, dot, reduce)
 
integer function, public orbitalset_utils_count(species, iselect)
 
pure logical function, public states_are_real(st)
 
type(type_t), public type_cmplx
 
brief This module defines the class unit_t which is used by the unit_systems_oct_m module.
 
character(len=20) pure function, public units_abbrev(this)
 
This module defines the unit system, used for input and output.
 
type(unit_system_t), public units_out
 
type(unit_system_t), public units_inp
the units systems for reading and writing
 
type(unit_t), public unit_one
some special units required for particular quantities
 
class to tell whether a point is inside or outside
 
Describes mesh distribution to nodes.
 
The states_elec_t class contains all electronic wave functions.