1! --- 2! Copyright (C) 1996-2016 The SIESTA group 3! This file is distributed under the terms of the 4! GNU General Public License: see COPYING in the top directory 5! or http://www.gnu.org/copyleft/gpl.txt . 6! See Docs/Contributors.txt for a list of contributors. 7! --- 8 9 MODULE m_local_DOS 10 private 11 public :: local_DOS 12 13 CONTAINS 14 15 subroutine local_DOS( ) 16 use m_energies 17 18 use sparse_matrices 19 USE siesta_options 20 use siesta_geom 21 use atomlist, only: indxuo, indxua 22 use atomlist, only: qtot, qtots, no_u, no_l 23 use atomlist, only: iphorb 24 use atomlist, only: datm, no_s, iaorb 25 use fdf 26 use sys, only: die 27 use files, only: slabel ! system label 28 use files, only: filesOut_t ! derived type for output file names 29 use Kpoint_grid 30 use parallel, only: IOnode 31 use files, only : label_length 32 use m_ntm 33 use m_forces, only: fa 34 use m_energies, only: Ef, Efs 35 use m_eo 36 use m_spin, only: nspin 37 use m_spin, only: spinor_dim 38 use m_diagon, only: diagon 39 use m_dhscf, only: dhscf 40 use m_partial_charges, only: want_partial_charges 41 implicit none 42 43 integer :: dummy_iscf = 1 44 45 real(dp):: e1 ! Lower bound of energy range 46 real(dp):: e2 ! Upper bound of energy range 47 48 real(dp) :: dummy_str(3,3), dummy_strl(3,3) ! for dhscf call 49 real(dp) :: dummy_dipol(3) 50 51 real(dp) :: factor, g2max, dummy_Entrop 52 logical :: genlogic ! Generate local density of states? 53 logical :: want_partial_charges_save ! to skip Voronoi/Hirshfeld in LDOS calculation 54 55 type(block_fdf) :: bfdf 56 type(parsed_line), pointer :: pline 57 type(filesOut_t) :: filesOut ! blank output file names 58 59#ifdef DEBUG 60 call write_debug( ' PRE local_DOS' ) 61#endif 62! Find local density of states 63 genlogic = fdf_block('LocalDensityOfStates',bfdf) 64 65 if ( genlogic ) then 66 67 want_partial_charges_save = want_partial_charges 68 want_partial_charges = .false. 69 70! Find the desired energy range 71 if (.not. fdf_bline(bfdf,pline)) 72 . call die('local_DOS: ERROR in LocalDensityOfStates block') 73 if (.not. fdf_bmatch(pline,'vvn')) 74 . call die("Wrong format in LocalDensityofStates") 75 factor = fdf_convfac( fdf_bnames(pline,1), 'Ry' ) 76 e1 = fdf_bvalues(pline,1)*factor 77 e2 = fdf_bvalues(pline,2)*factor 78 call fdf_bclose(bfdf) 79 80 !Find the density matrix for states between e1 and e2 81 if ((isolve .eq. SOLVE_DIAGON) .or. 82 . ((isolve .eq. SOLVE_MINIM) .and. 83 . minim_calc_eigenvalues)) then 84 call diagon(no_s, spinor_dim, no_l, maxnh, maxnh, no_u, 85 . numh, listhptr, listh, numh, listhptr, listh, 86 . H, S, qtot, fixspin, qtots, temp, e1, e2, 87 . xijo, indxuo, gamma_SCF, nkpnt, kpoint, kweight, 88 . eo, qo, Dscf, Escf, ef, efs, dummy_Entrop, no_u, 89 . occtol, dummy_iscf, neigwanted) 90 91 !Find the LDOS in the real space mesh 92 filesOut%rho = trim(slabel) // '.LDOS' 93 g2max = g2cut 94 call dhscf( nspin, no_s, iaorb, iphorb, no_l, 95 . no_u, na_u, na_s, isa, xa_last, indxua, 96 . ntm, 0, 0, 0, filesOut, 97 . maxnh, numh, listhptr, listh, Dscf, Datm, maxnh, H, 98 . Enaatm, Enascf, Uatm, Uscf, DUscf, DUext, Exc, Dxc, 99 . dummy_dipol, dummy_str, fa, dummy_strl ) 100 ! next to last argument is dummy here, 101 ! as no forces are calculated 102 ! todo: make all these optional 103 else 104 if (IOnode) write(6,*) 105 . 'siesta: ERROR: LDOS implemented only with diagon' 106 endif 107 108 want_partial_charges = want_partial_charges_save 109 110 endif ! genlogic 111 112 113#ifdef DEBUG 114 call write_debug( ' POS local_DOS' ) 115#endif 116 END subroutine local_DOS 117 118 END module m_local_DOS 119