19#include "./base/base_uses.f90"
25 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'qs_dos_utils'
50 INTEGER,
INTENT(IN) :: energy_unit
51 REAL(kind=
dp) :: scale
53 SELECT CASE (energy_unit)
69 INTEGER,
INTENT(IN) :: energy_unit
70 REAL(kind=
dp) :: scale
83 INTEGER,
INTENT(IN) :: energy_unit
84 CHARACTER(LEN=16) :: label
86 SELECT CASE (energy_unit)
90 label =
"Energy[a.u.]"
102 INTEGER,
INTENT(IN) :: energy_zero
103 CHARACTER(LEN=16) :: label
105 SELECT CASE (energy_zero)
127 INTEGER,
INTENT(IN) :: energy_zero
128 LOGICAL,
INTENT(IN) :: smearing_enabled, fractional_occupation
132 IF (smearing_enabled .OR. fractional_occupation)
THEN
138 resolved = energy_zero
154 LOGICAL,
INTENT(IN) :: do_dos_output
155 LOGICAL,
INTENT(OUT) :: do_projected_dos, do_pdos, do_pdos_raw
158 LOGICAL :: has_ldos, has_r_ldos
161 do_projected_dos = .false.
163 do_pdos_raw = .false.
167 IF (do_dos_output)
THEN
173 has_ldos = (nrep > 0)
176 has_r_ldos = (nrep > 0)
179 do_projected_dos = do_pdos .OR. has_ldos .OR. has_r_ldos
197 broaden_width, voigt_mixing)
199 REAL(kind=
dp),
DIMENSION(:),
INTENT(INOUT) :: dos, occ_dos
200 REAL(kind=
dp),
INTENT(IN) :: emin, de, eig, occ, weight
201 INTEGER,
INTENT(IN) :: broaden_type
202 REAL(kind=
dp),
INTENT(IN) :: broaden_width, voigt_mixing
204 INTEGER :: i, iend, istart, nhist
205 REAL(kind=
dp) :: eval, line_shape
208 istart = max(1, floor((eig -
broadening_cutoff(broaden_type, broaden_width) - emin)/de) + 1)
209 iend = min(nhist, ceiling((eig +
broadening_cutoff(broaden_type, broaden_width) - emin)/de) + 1)
211 eval = emin + (i - 1)*de
213 dos(i) = dos(i) + weight*line_shape
214 occ_dos(i) = occ_dos(i) + weight*occ*line_shape
231 broaden_width, voigt_mixing)
233 REAL(kind=
dp),
DIMENSION(:),
INTENT(INOUT) :: curve
234 REAL(kind=
dp),
INTENT(IN) :: emin, de, eig, weight
235 INTEGER,
INTENT(IN) :: broaden_type
236 REAL(kind=
dp),
INTENT(IN) :: broaden_width, voigt_mixing
238 INTEGER :: i, iend, istart, nhist
239 REAL(kind=
dp) :: eval, line_shape
242 istart = max(1, floor((eig -
broadening_cutoff(broaden_type, broaden_width) - emin)/de) + 1)
243 iend = min(nhist, ceiling((eig +
broadening_cutoff(broaden_type, broaden_width) - emin)/de) + 1)
245 eval = emin + (i - 1)*de
247 curve(i) = curve(i) + weight*line_shape
260 INTEGER,
INTENT(IN) :: broaden_type
261 REAL(kind=
dp),
INTENT(IN) :: broaden_width
262 REAL(kind=
dp) :: cutoff
265 cutoff = 8.0_dp*broaden_width
267 cutoff = 50.0_dp*broaden_width
282 REAL(kind=
dp),
INTENT(IN) :: delta_e
283 INTEGER,
INTENT(IN) :: broaden_type
284 REAL(kind=
dp),
INTENT(IN) :: broaden_width, voigt_mixing
285 REAL(kind=
dp) ::
value
287 REAL(kind=
dp) :: eta,
gamma, gaussian_value, sigma
289 IF (broaden_width <= 0.0_dp)
THEN
294 sigma = broaden_width/(2.0_dp*sqrt(2.0_dp*log(2.0_dp)))
295 gamma = 0.5_dp*broaden_width
296 gaussian_value = exp(-0.5_dp*(delta_e/sigma)**2)/(sigma*sqrt(2.0_dp*
pi))
298 SELECT CASE (broaden_type)
300 value = gaussian_value
304 eta = min(1.0_dp, max(0.0_dp, voigt_mixing))
305 value = eta*
gamma/(
pi*(delta_e**2 +
gamma**2)) + (1.0_dp - eta)*gaussian_value
307 value = gaussian_value
321 INTEGER,
INTENT(IN) :: iw, broaden_type
322 REAL(kind=
dp),
INTENT(IN) :: broaden_width, voigt_mixing
324 REAL(kind=
dp) :: broaden_width_ev
328 SELECT CASE (broaden_type)
330 WRITE (unit=iw, fmt=
"(A,F10.8,A,F8.6,A)") &
331 "# Gaussian broadening, FWHM = ", broaden_width,
" a.u. = ", broaden_width_ev,
" eV"
333 WRITE (unit=iw, fmt=
"(A,F10.8,A,F8.6,A)") &
334 "# Lorentzian broadening, FWHM = ", broaden_width,
" a.u. = ", broaden_width_ev,
" eV"
336 WRITE (unit=iw, fmt=
"(A,F10.8,A,F8.6,A,F8.4)") &
337 "# Pseudo-Voigt broadening, FWHM = ", broaden_width,
" a.u. = ", &
338 broaden_width_ev,
" eV, Lorentzian fraction = ", min(1.0_dp, max(0.0_dp, voigt_mixing))
real(kind=dp) function, public cp_unit_from_cp2k(value, unit_str, defaults, power)
converts from the internal cp2k units to the given unit
Calculation of the incomplete Gamma function F_n(t) for multi-center integrals over Cartesian Gaussia...
Defines the basic variable types.
integer, parameter, public dp
Definition of mathematical constants and functions.
real(kind=dp), parameter, public pi
Utilities for broadened DOS and PDOS output.
subroutine, public add_broadened_peak(dos, occ_dos, emin, de, eig, occ, weight, broaden_type, broaden_width, voigt_mixing)
Add a broadened spectral line to a DOS curve.
pure real(kind=dp) function, public broadening_function(delta_e, broaden_type, broaden_width, voigt_mixing)
Normalized broadening function. BROADEN_WIDTH is FWHM.
subroutine, public write_broadening_info(iw, broaden_type, broaden_width, voigt_mixing)
Write broadening metadata.
subroutine, public add_broadened_value(curve, emin, de, eig, weight, broaden_type, broaden_width, voigt_mixing)
Add a broadened spectral line with a scalar weight to a curve.
integer, parameter, public dos_energy_zero_hoco
integer, parameter, public dos_energy_zero_auto
integer, parameter, public dos_energy_unit_ev
character(len=16) function, public dos_energy_label(energy_unit)
Return the energy-column label for DOS-like output.
integer function, public dos_resolve_energy_zero(energy_zero, smearing_enabled, fractional_occupation)
Resolve AUTO energy-zero selection for DOS-like output.
real(kind=dp) function, public dos_energy_scale(energy_unit)
Return the conversion factor from internal energy units to the selected DOS energy unit.
integer, parameter, public dos_energy_zero_absolute
integer, parameter, public broadening_gaussian
integer, parameter, public dos_energy_zero_fermi
pure real(kind=dp) function, public broadening_cutoff(broaden_type, broaden_width)
Broadening cutoff used for numerical accumulation.
subroutine, public get_dos_pdos_flags(dos_section, do_dos_output, do_projected_dos, do_pdos, do_pdos_raw)
Resolve projected-DOS requests from a DOS print section.
real(kind=dp) function, public dos_density_scale(energy_unit)
Return the DOS-density conversion factor for the selected energy unit.
integer, parameter, public dos_energy_unit_hartree
integer, parameter, public broadening_pseudo_voigt
character(len=16) function, public dos_energy_zero_label(energy_zero)
Return the label for the selected DOS energy zero.
integer, parameter, public broadening_lorentzian