(git:1f9fd2c)
Loading...
Searching...
No Matches
qs_pdos.F
Go to the documentation of this file.
1!--------------------------------------------------------------------------------------------------!
2! CP2K: A general program to perform molecular dynamics simulations !
3! Copyright 2000-2026 CP2K developers group <https://cp2k.org> !
4! !
5! SPDX-License-Identifier: GPL-2.0-or-later !
6!--------------------------------------------------------------------------------------------------!
7
8! **************************************************************************************************
9!> \brief Calculation and writing of projected density of states
10!> The DOS is computed per angular momentum and per kind
11!> \par History
12!> -
13!> \author Marcella (29.02.2008,MK)
14! **************************************************************************************************
15MODULE qs_pdos
21 USE cell_types, ONLY: cell_type,&
22 pbc
25 USE cp_cfm_types, ONLY: cp_cfm_create,&
30 USE cp_dbcsr_api, ONLY: dbcsr_p_type
32 USE cp_fm_diag, ONLY: cp_fm_power
36 USE cp_fm_types, ONLY: cp_fm_create,&
45 USE cp_output_handling, ONLY: cp_p_file,&
53 USE kinds, ONLY: default_string_length,&
54 dp
56 USE kpoint_types, ONLY: kpoint_env_type,&
60 USE orbital_pointers, ONLY: nso,&
61 nsoset
62 USE orbital_symbols, ONLY: l_sym,&
66 USE pw_env_types, ONLY: pw_env_get,&
68 USE pw_pool_types, ONLY: pw_pool_p_type,&
70 USE pw_types, ONLY: pw_c1d_gs_type,&
73 USE qs_dos_utils, ONLY: &
80 USE qs_kind_types, ONLY: get_qs_kind,&
83 USE qs_mo_types, ONLY: get_mo_set,&
87#include "./base/base_uses.f90"
88
89 IMPLICIT NONE
90
91 PRIVATE
92
93 CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'qs_pdos'
94
95! **************************************************************************************************
96 ! *** Public subroutines ***
97
99
100 TYPE ldos_type
101 INTEGER :: maxl = -1, nlist = -1
102 LOGICAL :: separate_components = .false.
103 INTEGER, DIMENSION(:), POINTER :: list_index => null()
104 REAL(KIND=dp), DIMENSION(:, :), &
105 POINTER :: pdos_array => null()
106 END TYPE ldos_type
107
108 TYPE r_ldos_type
109 INTEGER :: nlist = -1, npoints = -1
110 INTEGER, DIMENSION(:, :), POINTER :: index_grid_local => null()
111 INTEGER, DIMENSION(:), POINTER :: list_index => null()
112 REAL(KIND=dp), DIMENSION(:), POINTER :: x_range => null(), y_range => null(), z_range => null()
113 REAL(KIND=dp), DIMENSION(:), POINTER :: eval_range => null()
114 REAL(KIND=dp), DIMENSION(:), &
115 POINTER :: pdos_array => null()
116 END TYPE r_ldos_type
117
118 TYPE ldos_p_type
119 TYPE(ldos_type), POINTER :: ldos => null()
120 END TYPE ldos_p_type
121
122 TYPE r_ldos_p_type
123 TYPE(r_ldos_type), POINTER :: ldos => null()
124 END TYPE r_ldos_p_type
125CONTAINS
126
127! **************************************************************************************************
128!> \brief Compute and write projected density of states
129!> \param mo_set ...
130!> \param atomic_kind_set ...
131!> \param qs_kind_set ...
132!> \param particle_set ...
133!> \param qs_env ...
134!> \param dft_section ...
135!> \param ispin ...
136!> \param xas_mittle ...
137!> \param external_matrix_shalf ...
138!> \param unoccupied_orbs ...
139!> \param unoccupied_evals ...
140!> \param pdos_print_key ...
141!> \param write_pdos ...
142!> \param write_pdos_raw ...
143!> \date 26.02.2008
144!> \par History:
145!> - Added optional external matrix_shalf to avoid recomputing it (A. Bussy, 09.2019)
146!> \par Variables
147!> -
148!> -
149!> \author MI
150!> \version 1.0
151! **************************************************************************************************
152 SUBROUTINE calculate_projected_dos(mo_set, atomic_kind_set, qs_kind_set, particle_set, qs_env, &
153 dft_section, ispin, xas_mittle, external_matrix_shalf, &
154 unoccupied_orbs, unoccupied_evals, pdos_print_key, write_pdos, write_pdos_raw)
155
156 TYPE(mo_set_type), INTENT(IN) :: mo_set
157 TYPE(atomic_kind_type), DIMENSION(:), POINTER :: atomic_kind_set
158 TYPE(qs_kind_type), DIMENSION(:), POINTER :: qs_kind_set
159 TYPE(particle_type), DIMENSION(:), POINTER :: particle_set
160 TYPE(qs_environment_type), POINTER :: qs_env
161 TYPE(section_vals_type), POINTER :: dft_section
162 INTEGER, INTENT(IN), OPTIONAL :: ispin
163 CHARACTER(LEN=default_string_length), INTENT(IN), &
164 OPTIONAL :: xas_mittle
165 TYPE(cp_fm_type), INTENT(IN), OPTIONAL, TARGET :: external_matrix_shalf, unoccupied_orbs
166 TYPE(cp_1d_r_p_type), INTENT(IN), OPTIONAL, TARGET :: unoccupied_evals
167 CHARACTER(LEN=*), INTENT(IN), OPTIONAL :: pdos_print_key
168 LOGICAL, INTENT(IN), OPTIONAL :: write_pdos, write_pdos_raw
169
170 CHARACTER(len=*), PARAMETER :: routinen = 'calculate_projected_dos'
171
172 CHARACTER(LEN=16) :: energy_label, fmtstr2
173 CHARACTER(LEN=27) :: fmtstr1
174 CHARACTER(LEN=32) :: zero_label
175 CHARACTER(LEN=6), ALLOCATABLE, DIMENSION(:, :, :) :: tmp_str
176 CHARACTER(LEN=default_string_length) :: kind_name, my_act, my_mittle, my_pos, &
177 my_print_key, spin(2)
178 CHARACTER(LEN=default_string_length), &
179 ALLOCATABLE, DIMENSION(:) :: ldos_index, r_ldos_index
180 INTEGER :: broaden_type, energy_unit, energy_zero, handle, homo, i, iatom, ikind, il, ildos, &
181 im, imo, in_x, in_y, in_z, ir, irow, iset, isgf, ishell, iso, iterstep, iw, j, jx, jy, &
182 jz, k, lcomponent, lshell, maxl, maxlgto, my_spin, n_dependent, n_r_ldos, n_rep, nao, &
183 natom, ncol_global, ndigits, nkind, nldos, nmo, np_tot, npoints, nrow_global, nset, nsgf, &
184 nvirt, out_each, output_unit, resolved_energy_zero
185 INTEGER, ALLOCATABLE, DIMENSION(:) :: firstrow
186 INTEGER, DIMENSION(:), POINTER :: list, nshell
187 INTEGER, DIMENSION(:, :), POINTER :: bo, l
188 LOGICAL :: append, calc_matsh, do_broaden, do_ldos, do_r_ldos, do_virt, &
189 fractional_occupation, ionode, separate_components, should_output, write_raw, &
190 write_standard
191 LOGICAL, DIMENSION(:, :), POINTER :: read_r
192 REAL(kind=dp) :: broaden_width, de, dh(3, 3), dvol, e_fermi, energy_factor, energy_ref, &
193 ev_factor, hoco, r(3), r_vec(3), ratom(3), voigt_mixing
194 REAL(kind=dp), DIMENSION(:), POINTER :: eigenvalues, evals_virt, &
195 occupation_numbers
196 REAL(kind=dp), DIMENSION(:, :), POINTER :: vecbuffer
197 REAL(kind=dp), DIMENSION(:, :, :), POINTER :: pdos_array
198 TYPE(cell_type), POINTER :: cell
199 TYPE(cp_blacs_env_type), POINTER :: context
200 TYPE(cp_fm_struct_type), POINTER :: fm_struct_tmp
201 TYPE(cp_fm_type) :: matrix_shalfc, matrix_work
202 TYPE(cp_fm_type), POINTER :: matrix_shalf, mo_coeff, mo_virt
203 TYPE(cp_logger_type), POINTER :: logger
204 TYPE(dbcsr_p_type), DIMENSION(:), POINTER :: s_matrix
205 TYPE(dft_control_type), POINTER :: dft_control
206 TYPE(gto_basis_set_type), POINTER :: orb_basis_set
207 TYPE(ldos_p_type), DIMENSION(:), POINTER :: ldos_p
208 TYPE(mp_para_env_type), POINTER :: para_env
209 TYPE(pw_c1d_gs_type) :: wf_g
210 TYPE(pw_env_type), POINTER :: pw_env
211 TYPE(pw_pool_p_type), DIMENSION(:), POINTER :: pw_pools
212 TYPE(pw_pool_type), POINTER :: auxbas_pw_pool
213 TYPE(pw_r3d_rs_type) :: wf_r
214 TYPE(r_ldos_p_type), DIMENSION(:), POINTER :: r_ldos_p
215 TYPE(section_vals_type), POINTER :: ldos_section
216
217 NULLIFY (logger)
218 logger => cp_get_default_logger()
219 ionode = logger%para_env%is_source()
220 my_print_key = "PRINT%PDOS"
221 IF (PRESENT(pdos_print_key)) my_print_key = trim(pdos_print_key)
222 write_standard = .true.
223 IF (PRESENT(write_pdos)) write_standard = write_pdos
224 write_raw = .true.
225 IF (PRESENT(write_pdos_raw)) write_raw = write_pdos_raw
226 write_raw = write_raw .AND. write_standard
227 should_output = btest(cp_print_key_should_output(logger%iter_info, dft_section, &
228 trim(my_print_key)), cp_p_file)
229 output_unit = cp_logger_get_default_io_unit(logger)
230
231 spin(1) = "ALPHA"
232 spin(2) = "BETA"
233 IF ((.NOT. should_output)) RETURN
234
235 NULLIFY (context, s_matrix, orb_basis_set, para_env, pdos_array)
236 NULLIFY (eigenvalues, fm_struct_tmp, mo_coeff, vecbuffer, mo_virt)
237 NULLIFY (ldos_section, list, cell, pw_env, auxbas_pw_pool, evals_virt)
238 NULLIFY (occupation_numbers, ldos_p, r_ldos_p, dft_control, occupation_numbers)
239
240 CALL timeset(routinen, handle)
241 iterstep = logger%iter_info%iteration(logger%iter_info%n_rlevel)
242
243 IF (output_unit > 0) WRITE (unit=output_unit, fmt='(/,(T3,A,T61,I10))') &
244 " Calculate PDOS at iteration step ", iterstep
245 CALL get_qs_env(qs_env=qs_env, &
246 matrix_s=s_matrix, &
247 dft_control=dft_control)
248
249 CALL get_atomic_kind_set(atomic_kind_set, natom=natom)
250 CALL get_qs_kind_set(qs_kind_set, nsgf=nsgf, maxlgto=maxlgto)
251 nkind = SIZE(atomic_kind_set)
252
253 CALL get_mo_set(mo_set=mo_set, mo_coeff=mo_coeff, homo=homo, nao=nao, nmo=nmo, &
254 mu=e_fermi)
255 CALL cp_fm_get_info(mo_coeff, &
256 context=context, para_env=para_env, &
257 nrow_global=nrow_global, &
258 ncol_global=ncol_global)
259
260 CALL section_vals_val_get(dft_section, trim(my_print_key)//"%OUT_EACH_MO", i_val=out_each)
261 IF (out_each == -1) out_each = nao + 1
262 CALL section_vals_val_get(dft_section, trim(my_print_key)//"%DELTA_E", r_val=de)
263 CALL section_vals_val_get(dft_section, trim(my_print_key)//"%BROADEN_TYPE", i_val=broaden_type)
264 CALL section_vals_val_get(dft_section, trim(my_print_key)//"%BROADEN_WIDTH", r_val=broaden_width)
265 CALL section_vals_val_get(dft_section, trim(my_print_key)//"%VOIGT_MIXING", r_val=voigt_mixing)
266 CALL section_vals_val_get(dft_section, trim(my_print_key)//"%NDIGITS", i_val=ndigits)
267 CALL section_vals_val_get(dft_section, trim(my_print_key)//"%ENERGY_UNIT", i_val=energy_unit)
268 CALL section_vals_val_get(dft_section, trim(my_print_key)//"%ENERGY_ZERO", i_val=energy_zero)
269 ndigits = min(max(ndigits, 1), 10)
270 do_broaden = (broaden_width > 0.0_dp)
271 IF (do_broaden) de = max(de, 0.00001_dp)
272 nvirt = 0
273 NULLIFY (evals_virt)
274 IF (PRESENT(unoccupied_orbs) .AND. PRESENT(unoccupied_evals)) THEN
275 IF (ASSOCIATED(unoccupied_evals%array)) THEN
276 nvirt = SIZE(unoccupied_evals%array)
277 IF (nvirt > 0) THEN
278 mo_virt => unoccupied_orbs
279 evals_virt => unoccupied_evals%array
280 END IF
281 END IF
282 END IF
283 do_virt = (nvirt > 0)
284
285 calc_matsh = .true.
286 IF (PRESENT(external_matrix_shalf)) calc_matsh = .false.
287
288 ! Create S^1/2 : from sparse to full matrix, if no external available
289 IF (calc_matsh) THEN
290 NULLIFY (matrix_shalf)
291 CALL cp_fm_struct_create(fm_struct_tmp, para_env=para_env, context=context, &
292 nrow_global=nrow_global, ncol_global=nrow_global)
293 ALLOCATE (matrix_shalf)
294 CALL cp_fm_create(matrix_shalf, fm_struct_tmp, name="matrix_shalf")
295 CALL cp_fm_create(matrix_work, fm_struct_tmp, name="matrix_work")
296 CALL cp_fm_struct_release(fm_struct_tmp)
297 CALL copy_dbcsr_to_fm(s_matrix(1)%matrix, matrix_shalf)
298 CALL cp_fm_power(matrix_shalf, matrix_work, 0.5_dp, epsilon(0.0_dp), n_dependent)
299 CALL cp_fm_release(matrix_work)
300 ELSE
301 matrix_shalf => external_matrix_shalf
302 END IF
303
304 ! Multiply S^(1/2) time the mOS coefficients to get orthonormalized MOS
305 CALL cp_fm_struct_create(fm_struct_tmp, para_env=para_env, context=context, &
306 nrow_global=nrow_global, ncol_global=ncol_global)
307 CALL cp_fm_create(matrix_shalfc, fm_struct_tmp, name="matrix_shalfc")
308 CALL parallel_gemm("N", "N", nrow_global, ncol_global, nrow_global, &
309 1.0_dp, matrix_shalf, mo_coeff, 0.0_dp, matrix_shalfc)
310 CALL cp_fm_struct_release(fm_struct_tmp)
311
312 IF (do_virt) THEN
313 IF (output_unit > 0) WRITE (unit=output_unit, fmt='(/,(T3,A,T14,I10,T27,A))') &
314 " Use ", nvirt, " additional unoccupied KS orbitals"
315 CALL cp_fm_struct_create(fm_struct_tmp, para_env=para_env, context=context, &
316 nrow_global=nrow_global, ncol_global=nvirt)
317 CALL cp_fm_create(matrix_work, fm_struct_tmp, name="matrix_shalfc")
318 CALL parallel_gemm("N", "N", nrow_global, nvirt, nrow_global, &
319 1.0_dp, matrix_shalf, mo_virt, 0.0_dp, matrix_work)
320 CALL cp_fm_struct_release(fm_struct_tmp)
321 END IF
322
323 IF (calc_matsh) THEN
324 CALL cp_fm_release(matrix_shalf)
325 DEALLOCATE (matrix_shalf)
326 END IF
327 ! Array to store the PDOS per kind and angular momentum
328 do_ldos = .false.
329 ldos_section => section_vals_get_subs_vals(dft_section, trim(my_print_key)//"%LDOS")
330
331 CALL section_vals_get(ldos_section, n_repetition=nldos)
332 IF (nldos > 0) THEN
333 IF (output_unit > 0) WRITE (unit=output_unit, fmt='(/,(T3,A,T61,I10))') &
334 " Prepare the list of atoms for LDOS. Number of lists: ", nldos
335 do_ldos = .true.
336 ALLOCATE (ldos_p(nldos))
337 ALLOCATE (ldos_index(nldos))
338 DO ildos = 1, nldos
339 WRITE (ldos_index(ildos), '(I0)') ildos
340 ALLOCATE (ldos_p(ildos)%ldos)
341 NULLIFY (ldos_p(ildos)%ldos%pdos_array)
342 NULLIFY (ldos_p(ildos)%ldos%list_index)
343
344 CALL section_vals_val_get(ldos_section, "LIST", i_rep_section=ildos, n_rep_val=n_rep)
345 IF (n_rep > 0) THEN
346 ldos_p(ildos)%ldos%nlist = 0
347 DO ir = 1, n_rep
348 NULLIFY (list)
349 CALL section_vals_val_get(ldos_section, "LIST", i_rep_section=ildos, i_rep_val=ir, &
350 i_vals=list)
351 IF (ASSOCIATED(list)) THEN
352 CALL reallocate(ldos_p(ildos)%ldos%list_index, 1, ldos_p(ildos)%ldos%nlist + SIZE(list))
353 DO i = 1, SIZE(list)
354 ldos_p(ildos)%ldos%list_index(i + ldos_p(ildos)%ldos%nlist) = list(i)
355 END DO
356 ldos_p(ildos)%ldos%nlist = ldos_p(ildos)%ldos%nlist + SIZE(list)
357 END IF
358 END DO
359 ELSE
360 ! stop, LDOS without list of atoms is not implemented
361 END IF
362
363 IF (output_unit > 0) WRITE (unit=output_unit, fmt='((T10,A,T18,I6,T25,A,T36,I10,A))') &
364 " List ", ildos, " contains ", ldos_p(ildos)%ldos%nlist, " atoms"
365 CALL section_vals_val_get(ldos_section, "COMPONENTS", i_rep_section=ildos, &
366 l_val=ldos_p(ildos)%ldos%separate_components)
367 IF (ldos_p(ildos)%ldos%separate_components) THEN
368 ALLOCATE (ldos_p(ildos)%ldos%pdos_array(nsoset(maxlgto), nmo + nvirt))
369 ELSE
370 ALLOCATE (ldos_p(ildos)%ldos%pdos_array(0:maxlgto, nmo + nvirt))
371 END IF
372 ldos_p(ildos)%ldos%pdos_array = 0.0_dp
373 ldos_p(ildos)%ldos%maxl = -1
374
375 END DO
376 END IF
377
378 do_r_ldos = .false.
379 ldos_section => section_vals_get_subs_vals(dft_section, trim(my_print_key)//"%R_LDOS")
380 CALL section_vals_get(ldos_section, n_repetition=n_r_ldos)
381 IF (n_r_ldos > 0) THEN
382 do_r_ldos = .true.
383 IF (output_unit > 0) WRITE (unit=output_unit, fmt='(/,(T3,A,T61,I10))') &
384 " Prepare the list of points for R_LDOS. Number of lists: ", n_r_ldos
385 ALLOCATE (r_ldos_p(n_r_ldos))
386 ALLOCATE (r_ldos_index(n_r_ldos))
387 CALL get_qs_env(qs_env=qs_env, &
388 cell=cell, &
389 dft_control=dft_control, &
390 pw_env=pw_env)
391 CALL pw_env_get(pw_env, auxbas_pw_pool=auxbas_pw_pool, &
392 pw_pools=pw_pools)
393
394 CALL auxbas_pw_pool%create_pw(wf_r)
395 CALL auxbas_pw_pool%create_pw(wf_g)
396 ALLOCATE (read_r(4, n_r_ldos))
397 DO ildos = 1, n_r_ldos
398 WRITE (r_ldos_index(ildos), '(I0)') ildos
399 ALLOCATE (r_ldos_p(ildos)%ldos)
400 NULLIFY (r_ldos_p(ildos)%ldos%pdos_array)
401 NULLIFY (r_ldos_p(ildos)%ldos%list_index)
402
403 CALL section_vals_val_get(ldos_section, "LIST", i_rep_section=ildos, n_rep_val=n_rep)
404 IF (n_rep > 0) THEN
405 r_ldos_p(ildos)%ldos%nlist = 0
406 DO ir = 1, n_rep
407 NULLIFY (list)
408 CALL section_vals_val_get(ldos_section, "LIST", i_rep_section=ildos, i_rep_val=ir, &
409 i_vals=list)
410 IF (ASSOCIATED(list)) THEN
411 CALL reallocate(r_ldos_p(ildos)%ldos%list_index, 1, r_ldos_p(ildos)%ldos%nlist + SIZE(list))
412 DO i = 1, SIZE(list)
413 r_ldos_p(ildos)%ldos%list_index(i + r_ldos_p(ildos)%ldos%nlist) = list(i)
414 END DO
415 r_ldos_p(ildos)%ldos%nlist = r_ldos_p(ildos)%ldos%nlist + SIZE(list)
416 END IF
417 END DO
418 ELSE
419 ! stop, LDOS without list of atoms is not implemented
420 END IF
421
422 ALLOCATE (r_ldos_p(ildos)%ldos%pdos_array(nmo + nvirt))
423 r_ldos_p(ildos)%ldos%pdos_array = 0.0_dp
424 read_r(1:3, ildos) = .false.
425 CALL section_vals_val_get(ldos_section, "XRANGE", i_rep_section=ildos, explicit=read_r(1, ildos))
426 IF (read_r(1, ildos)) THEN
427 CALL section_vals_val_get(ldos_section, "XRANGE", i_rep_section=ildos, r_vals= &
428 r_ldos_p(ildos)%ldos%x_range)
429 ELSE
430 ALLOCATE (r_ldos_p(ildos)%ldos%x_range(2))
431 r_ldos_p(ildos)%ldos%x_range = 0.0_dp
432 END IF
433 CALL section_vals_val_get(ldos_section, "YRANGE", i_rep_section=ildos, explicit=read_r(2, ildos))
434 IF (read_r(2, ildos)) THEN
435 CALL section_vals_val_get(ldos_section, "YRANGE", i_rep_section=ildos, r_vals= &
436 r_ldos_p(ildos)%ldos%y_range)
437 ELSE
438 ALLOCATE (r_ldos_p(ildos)%ldos%y_range(2))
439 r_ldos_p(ildos)%ldos%y_range = 0.0_dp
440 END IF
441 CALL section_vals_val_get(ldos_section, "ZRANGE", i_rep_section=ildos, explicit=read_r(3, ildos))
442 IF (read_r(3, ildos)) THEN
443 CALL section_vals_val_get(ldos_section, "ZRANGE", i_rep_section=ildos, r_vals= &
444 r_ldos_p(ildos)%ldos%z_range)
445 ELSE
446 ALLOCATE (r_ldos_p(ildos)%ldos%z_range(2))
447 r_ldos_p(ildos)%ldos%z_range = 0.0_dp
448 END IF
449
450 CALL section_vals_val_get(ldos_section, "ERANGE", i_rep_section=ildos, explicit=read_r(4, ildos))
451 IF (read_r(4, ildos)) THEN
452 CALL section_vals_val_get(ldos_section, "ERANGE", i_rep_section=ildos, &
453 r_vals=r_ldos_p(ildos)%ldos%eval_range)
454 ELSE
455 ALLOCATE (r_ldos_p(ildos)%ldos%eval_range(2))
456 r_ldos_p(ildos)%ldos%eval_range(1) = -huge(0.0_dp)
457 r_ldos_p(ildos)%ldos%eval_range(2) = +huge(0.0_dp)
458 END IF
459
460 bo => wf_r%pw_grid%bounds_local
461 dh = wf_r%pw_grid%dh
462 dvol = wf_r%pw_grid%dvol
463 np_tot = wf_r%pw_grid%npts(1)*wf_r%pw_grid%npts(2)*wf_r%pw_grid%npts(3)
464 ALLOCATE (r_ldos_p(ildos)%ldos%index_grid_local(3, np_tot))
465
466 r_ldos_p(ildos)%ldos%npoints = 0
467 DO jz = bo(1, 3), bo(2, 3)
468 DO jy = bo(1, 2), bo(2, 2)
469 DO jx = bo(1, 1), bo(2, 1)
470 !compute the position of the grid point
471 i = jx - wf_r%pw_grid%bounds(1, 1)
472 j = jy - wf_r%pw_grid%bounds(1, 2)
473 k = jz - wf_r%pw_grid%bounds(1, 3)
474 r(3) = k*dh(3, 3) + j*dh(3, 2) + i*dh(3, 1)
475 r(2) = k*dh(2, 3) + j*dh(2, 2) + i*dh(2, 1)
476 r(1) = k*dh(1, 3) + j*dh(1, 2) + i*dh(1, 1)
477
478 DO il = 1, r_ldos_p(ildos)%ldos%nlist
479 iatom = r_ldos_p(ildos)%ldos%list_index(il)
480 ratom = particle_set(iatom)%r
481 r_vec = pbc(ratom, r, cell)
482 IF (cell%orthorhombic) THEN
483 IF (cell%perd(1) == 0) r_vec(1) = modulo(r_vec(1), cell%hmat(1, 1))
484 IF (cell%perd(2) == 0) r_vec(2) = modulo(r_vec(2), cell%hmat(2, 2))
485 IF (cell%perd(3) == 0) r_vec(3) = modulo(r_vec(3), cell%hmat(3, 3))
486 END IF
487
488 in_x = 0
489 in_y = 0
490 in_z = 0
491 IF (r_ldos_p(ildos)%ldos%x_range(1) /= 0.0_dp) THEN
492 IF (r_vec(1) > r_ldos_p(ildos)%ldos%x_range(1) .AND. &
493 r_vec(1) < r_ldos_p(ildos)%ldos%x_range(2)) THEN
494 in_x = 1
495 END IF
496 ELSE
497 in_x = 1
498 END IF
499 IF (r_ldos_p(ildos)%ldos%y_range(1) /= 0.0_dp) THEN
500 IF (r_vec(2) > r_ldos_p(ildos)%ldos%y_range(1) .AND. &
501 r_vec(2) < r_ldos_p(ildos)%ldos%y_range(2)) THEN
502 in_y = 1
503 END IF
504 ELSE
505 in_y = 1
506 END IF
507 IF (r_ldos_p(ildos)%ldos%z_range(1) /= 0.0_dp) THEN
508 IF (r_vec(3) > r_ldos_p(ildos)%ldos%z_range(1) .AND. &
509 r_vec(3) < r_ldos_p(ildos)%ldos%z_range(2)) THEN
510 in_z = 1
511 END IF
512 ELSE
513 in_z = 1
514 END IF
515 IF (in_x*in_y*in_z > 0) THEN
516 r_ldos_p(ildos)%ldos%npoints = r_ldos_p(ildos)%ldos%npoints + 1
517 r_ldos_p(ildos)%ldos%index_grid_local(1, r_ldos_p(ildos)%ldos%npoints) = jx
518 r_ldos_p(ildos)%ldos%index_grid_local(2, r_ldos_p(ildos)%ldos%npoints) = jy
519 r_ldos_p(ildos)%ldos%index_grid_local(3, r_ldos_p(ildos)%ldos%npoints) = jz
520 EXIT
521 END IF
522 END DO
523 END DO
524 END DO
525 END DO
526 CALL reallocate(r_ldos_p(ildos)%ldos%index_grid_local, 1, 3, 1, r_ldos_p(ildos)%ldos%npoints)
527 npoints = r_ldos_p(ildos)%ldos%npoints
528 CALL para_env%sum(npoints)
529 IF (output_unit > 0) WRITE (unit=output_unit, fmt='((T10,A,T18,I6,T25,A,T36,I10,A))') &
530 " List ", ildos, " contains ", npoints, " grid points"
531 END DO
532 END IF
533
534 IF (trim(my_print_key) == "PRINT%DOS") THEN
535 CALL section_vals_val_get(dft_section, trim(my_print_key)//"%PDOS%COMPONENTS", l_val=separate_components)
536 ELSE
537 CALL section_vals_val_get(dft_section, trim(my_print_key)//"%COMPONENTS", l_val=separate_components)
538 END IF
539 IF (separate_components) THEN
540 ALLOCATE (pdos_array(nsoset(maxlgto), nkind, nmo + nvirt))
541 ELSE
542 ALLOCATE (pdos_array(0:maxlgto, nkind, nmo + nvirt))
543 END IF
544 IF (do_virt) THEN
545 ALLOCATE (eigenvalues(nmo + nvirt))
546 eigenvalues(1:nmo) = mo_set%eigenvalues(1:nmo)
547 eigenvalues(nmo + 1:nmo + nvirt) = evals_virt(1:nvirt)
548 ALLOCATE (occupation_numbers(nmo + nvirt))
549 occupation_numbers(:) = 0.0_dp
550 occupation_numbers(1:nmo) = mo_set%occupation_numbers(1:nmo)
551 ELSE
552 eigenvalues => mo_set%eigenvalues
553 occupation_numbers => mo_set%occupation_numbers
554 END IF
555
556 hoco = -huge(0.0_dp)
557 fractional_occupation = .false.
558 DO imo = 1, nmo + nvirt
559 IF (occupation_numbers(imo) > 1.0e-10_dp) hoco = max(hoco, eigenvalues(imo))
560 IF (abs(occupation_numbers(imo) - real(nint(occupation_numbers(imo)), kind=dp)) > &
561 1.0e-8_dp) fractional_occupation = .true.
562 END DO
563 IF (hoco < -0.5_dp*huge(0.0_dp)) hoco = e_fermi
564 resolved_energy_zero = dos_resolve_energy_zero(energy_zero, dft_control%smear, fractional_occupation)
565 SELECT CASE (resolved_energy_zero)
567 energy_ref = 0.0_dp
569 energy_ref = hoco
570 CASE DEFAULT
571 energy_ref = e_fermi
572 END SELECT
573 energy_factor = dos_energy_scale(energy_unit)
574 energy_label = dos_energy_label(energy_unit)
575 zero_label = dos_energy_zero_label(resolved_energy_zero)
576 IF (energy_zero == dos_energy_zero_auto) zero_label = "AUTO -> "//trim(zero_label)
578
579 pdos_array = 0.0_dp
580 nao = mo_set%nao
581 ALLOCATE (vecbuffer(1, nao))
582 vecbuffer = 0.0_dp
583 ALLOCATE (firstrow(natom))
584 firstrow = 0
585
586 !Adjust energy range for r_ldos
587 DO ildos = 1, n_r_ldos
588 IF (eigenvalues(1) > r_ldos_p(ildos)%ldos%eval_range(1)) &
589 r_ldos_p(ildos)%ldos%eval_range(1) = eigenvalues(1)
590 IF (eigenvalues(nmo + nvirt) < r_ldos_p(ildos)%ldos%eval_range(2)) &
591 r_ldos_p(ildos)%ldos%eval_range(2) = eigenvalues(nmo + nvirt)
592 END DO
593
594 IF (output_unit > 0) WRITE (unit=output_unit, fmt='(/,(T15,A))') &
595 "---- PDOS: start iteration on the KS states --- "
596
597 DO imo = 1, nmo + nvirt
598
599 IF (output_unit > 0 .AND. mod(imo, out_each) == 0) WRITE (unit=output_unit, fmt='((T20,A,I10))') &
600 " KS state index : ", imo
601 ! Extract the eigenvector from the distributed full matrix
602 IF (imo > nmo) THEN
603 CALL cp_fm_get_submatrix(matrix_work, vecbuffer, 1, imo - nmo, &
604 nao, 1, transpose=.true.)
605 ELSE
606 CALL cp_fm_get_submatrix(matrix_shalfc, vecbuffer, 1, imo, &
607 nao, 1, transpose=.true.)
608 END IF
609
610 ! Calculate the pdos for all the kinds
611 irow = 1
612 DO iatom = 1, natom
613 firstrow(iatom) = irow
614 NULLIFY (orb_basis_set)
615 CALL get_atomic_kind(particle_set(iatom)%atomic_kind, kind_number=ikind)
616 CALL get_qs_kind(qs_kind_set(ikind), basis_set=orb_basis_set)
617 CALL get_gto_basis_set(gto_basis_set=orb_basis_set, &
618 nset=nset, &
619 nshell=nshell, &
620 l=l, maxl=maxl)
621 IF (separate_components) THEN
622 isgf = 1
623 DO iset = 1, nset
624 DO ishell = 1, nshell(iset)
625 lshell = l(ishell, iset)
626 DO iso = 1, nso(lshell)
627 lcomponent = nsoset(lshell - 1) + iso
628 pdos_array(lcomponent, ikind, imo) = &
629 pdos_array(lcomponent, ikind, imo) + &
630 vecbuffer(1, irow)*vecbuffer(1, irow)
631 irow = irow + 1
632 END DO ! iso
633 END DO ! ishell
634 END DO ! iset
635 ELSE
636 isgf = 1
637 DO iset = 1, nset
638 DO ishell = 1, nshell(iset)
639 lshell = l(ishell, iset)
640 DO iso = 1, nso(lshell)
641 pdos_array(lshell, ikind, imo) = &
642 pdos_array(lshell, ikind, imo) + &
643 vecbuffer(1, irow)*vecbuffer(1, irow)
644 irow = irow + 1
645 END DO ! iso
646 END DO ! ishell
647 END DO ! iset
648 END IF
649 END DO ! iatom
650
651 ! Calculate the pdos for all the lists
652 DO ildos = 1, nldos
653 DO il = 1, ldos_p(ildos)%ldos%nlist
654 iatom = ldos_p(ildos)%ldos%list_index(il)
655
656 irow = firstrow(iatom)
657 NULLIFY (orb_basis_set)
658 CALL get_atomic_kind(particle_set(iatom)%atomic_kind, kind_number=ikind)
659 CALL get_qs_kind(qs_kind_set(ikind), basis_set=orb_basis_set)
660
661 CALL get_gto_basis_set(gto_basis_set=orb_basis_set, &
662 nset=nset, &
663 nshell=nshell, &
664 l=l, maxl=maxl)
665 ldos_p(ildos)%ldos%maxl = max(ldos_p(ildos)%ldos%maxl, maxl)
666 IF (ldos_p(ildos)%ldos%separate_components) THEN
667 isgf = 1
668 DO iset = 1, nset
669 DO ishell = 1, nshell(iset)
670 lshell = l(ishell, iset)
671 DO iso = 1, nso(lshell)
672 lcomponent = nsoset(lshell - 1) + iso
673 ldos_p(ildos)%ldos%pdos_array(lcomponent, imo) = &
674 ldos_p(ildos)%ldos%pdos_array(lcomponent, imo) + &
675 vecbuffer(1, irow)*vecbuffer(1, irow)
676 irow = irow + 1
677 END DO ! iso
678 END DO ! ishell
679 END DO ! iset
680 ELSE
681 isgf = 1
682 DO iset = 1, nset
683 DO ishell = 1, nshell(iset)
684 lshell = l(ishell, iset)
685 DO iso = 1, nso(lshell)
686 ldos_p(ildos)%ldos%pdos_array(lshell, imo) = &
687 ldos_p(ildos)%ldos%pdos_array(lshell, imo) + &
688 vecbuffer(1, irow)*vecbuffer(1, irow)
689 irow = irow + 1
690 END DO ! iso
691 END DO ! ishell
692 END DO ! iset
693 END IF
694 END DO !il
695 END DO !ildos
696
697 ! Calculate the DOS projected in a given volume in real space
698 DO ildos = 1, n_r_ldos
699 IF (r_ldos_p(ildos)%ldos%eval_range(1) <= eigenvalues(imo) .AND. &
700 r_ldos_p(ildos)%ldos%eval_range(2) >= eigenvalues(imo)) THEN
701
702 IF (imo > nmo) THEN
703 CALL calculate_wavefunction(mo_virt, imo - nmo, &
704 wf_r, wf_g, atomic_kind_set, qs_kind_set, cell, dft_control, particle_set, &
705 pw_env)
706 ELSE
707 CALL calculate_wavefunction(mo_coeff, imo, &
708 wf_r, wf_g, atomic_kind_set, qs_kind_set, cell, dft_control, particle_set, &
709 pw_env)
710 END IF
711 r_ldos_p(ildos)%ldos%pdos_array(imo) = 0.0_dp
712 DO il = 1, r_ldos_p(ildos)%ldos%npoints
713 j = j + 1
714 jx = r_ldos_p(ildos)%ldos%index_grid_local(1, il)
715 jy = r_ldos_p(ildos)%ldos%index_grid_local(2, il)
716 jz = r_ldos_p(ildos)%ldos%index_grid_local(3, il)
717 r_ldos_p(ildos)%ldos%pdos_array(imo) = r_ldos_p(ildos)%ldos%pdos_array(imo) + &
718 wf_r%array(jx, jy, jz)*wf_r%array(jx, jy, jz)
719 END DO
720 r_ldos_p(ildos)%ldos%pdos_array(imo) = r_ldos_p(ildos)%ldos%pdos_array(imo)*dvol
721 END IF
722 END DO
723 END DO ! imo
724
725 CALL cp_fm_release(matrix_shalfc)
726 DEALLOCATE (vecbuffer)
727
728 CALL section_vals_val_get(dft_section, trim(my_print_key)//"%APPEND", l_val=append)
729 IF (append .AND. iterstep > 1) THEN
730 my_pos = "APPEND"
731 ELSE
732 my_pos = "REWIND"
733 END IF
734 my_act = "WRITE"
735 IF (write_standard .OR. write_raw) THEN
736 DO ikind = 1, nkind
737
738 NULLIFY (orb_basis_set)
739 CALL get_atomic_kind(atomic_kind_set(ikind), name=kind_name)
740 CALL get_qs_kind(qs_kind_set(ikind), basis_set=orb_basis_set)
741 CALL get_gto_basis_set(gto_basis_set=orb_basis_set, maxl=maxl)
742
743 ! basis none has no associated maxl, and no pdos
744 IF (maxl < 0) cycle
745
746 IF (PRESENT(ispin)) THEN
747 IF (PRESENT(xas_mittle)) THEN
748 my_mittle = trim(xas_mittle)//trim(spin(ispin))//"_k"//trim(adjustl(cp_to_string(ikind)))
749 ELSE
750 my_mittle = trim(spin(ispin))//"_k"//trim(adjustl(cp_to_string(ikind)))
751 END IF
752 my_spin = ispin
753 ELSE
754 my_mittle = "k"//trim(adjustl(cp_to_string(ikind)))
755 my_spin = 1
756 END IF
757
758 IF (write_standard .AND. do_broaden) THEN
759 IF (separate_components) THEN
760 CALL write_broadened_pdos(logger, dft_section, trim(my_mittle), my_pos, my_act, iterstep, &
761 e_fermi, hoco, energy_ref, trim(zero_label), &
762 "Projected DOS for atomic kind "//trim(kind_name), &
763 maxl, .true., pdos_array(1:nsoset(maxl), ikind, :), &
764 eigenvalues, nmo + nvirt, de, broaden_type, broaden_width, &
765 voigt_mixing, ndigits, pdos_print_key=trim(my_print_key))
766 ELSE
767 CALL write_broadened_pdos(logger, dft_section, trim(my_mittle), my_pos, my_act, iterstep, &
768 e_fermi, hoco, energy_ref, trim(zero_label), &
769 "Projected DOS for atomic kind "//trim(kind_name), &
770 maxl, .false., pdos_array(0:maxl, ikind, :), &
771 eigenvalues, nmo + nvirt, de, broaden_type, broaden_width, &
772 voigt_mixing, ndigits, pdos_print_key=trim(my_print_key))
773 END IF
774 END IF
775
776 IF (write_raw) THEN
777 iw = cp_print_key_unit_nr(logger, dft_section, trim(my_print_key), &
778 extension=".pdos_raw", file_position=my_pos, file_action=my_act, &
779 file_form="FORMATTED", middle_name=trim(my_mittle))
780 IF (iw > 0) THEN
781
782 fmtstr1 = "(I8,2X,2F16.6, (2X,F16.8))"
783 fmtstr2 = "(A42, (10X,A8))"
784 IF (separate_components) THEN
785 WRITE (unit=fmtstr1(15:16), fmt="(I2)") nsoset(maxl) + 1
786 WRITE (unit=fmtstr2(6:7), fmt="(I2)") nsoset(maxl) + 1
787 ELSE
788 WRITE (unit=fmtstr1(15:16), fmt="(I2)") maxl + 2
789 WRITE (unit=fmtstr2(6:7), fmt="(I2)") maxl + 2
790 END IF
791
792 WRITE (unit=iw, fmt="(A,I0)") &
793 "# Projected DOS for atomic kind "//trim(kind_name)//" at iteration step i = ", iterstep
794 WRITE (unit=iw, fmt="(A,F12.6,A,F12.6,A)") &
795 "# E(Fermi) = ", e_fermi, " a.u. = ", e_fermi*ev_factor, " eV"
796 WRITE (unit=iw, fmt="(A,F12.6,A,F12.6,A)") &
797 "# E(HOCO) = ", hoco, " a.u. = ", hoco*ev_factor, " eV"
798 WRITE (unit=iw, fmt="(A,A)") "# Energy zero: ", trim(zero_label)
799 IF (separate_components) THEN
800 ALLOCATE (tmp_str(0:0, 0:maxl, -maxl:maxl))
801 tmp_str = ""
802 DO j = 0, maxl
803 DO i = -j, j
804 tmp_str(0, j, i) = sgf_symbol(0, j, i)
805 END DO
806 END DO
807
808 WRITE (unit=iw, fmt=fmtstr2) &
809 "# MO "//trim(energy_label)//" Occupation", "Total", &
810 ((trim(tmp_str(0, il, im)), im=-il, il), il=0, maxl)
811 DO imo = 1, nmo + nvirt
812 WRITE (unit=iw, fmt=fmtstr1) imo, (eigenvalues(imo) - energy_ref)*energy_factor, &
813 occupation_numbers(imo), sum(pdos_array(1:nsoset(maxl), ikind, imo)), &
814 (pdos_array(lshell, ikind, imo), lshell=1, nsoset(maxl))
815 END DO
816 DEALLOCATE (tmp_str)
817 ELSE
818 WRITE (unit=iw, fmt=fmtstr2) &
819 "# MO "//trim(energy_label)//" Occupation", "Total", &
820 (trim(l_sym(il)), il=0, maxl)
821 DO imo = 1, nmo + nvirt
822 WRITE (unit=iw, fmt=fmtstr1) imo, (eigenvalues(imo) - energy_ref)*energy_factor, &
823 occupation_numbers(imo), sum(pdos_array(0:maxl, ikind, imo)), &
824 (pdos_array(lshell, ikind, imo), lshell=0, maxl)
825 END DO
826 END IF
827 END IF
828 CALL cp_print_key_finished_output(iw, logger, dft_section, &
829 trim(my_print_key))
830 END IF
831
832 END DO ! ikind
833 END IF
834
835 ! write the pdos for the lists, each ona different file,
836 ! the filenames are indexed with the list number
837 DO ildos = 1, nldos
838 ! basis none has no associated maxl, and no pdos
839 IF (ldos_p(ildos)%ldos%maxl > 0) THEN
840
841 IF (PRESENT(ispin)) THEN
842 IF (PRESENT(xas_mittle)) THEN
843 my_mittle = trim(xas_mittle)//trim(spin(ispin))//"_list"//trim(ldos_index(ildos))
844 ELSE
845 my_mittle = trim(spin(ispin))//"_list"//trim(ldos_index(ildos))
846 END IF
847 my_spin = ispin
848 ELSE
849 my_mittle = "list"//trim(ldos_index(ildos))
850 my_spin = 1
851 END IF
852
853 IF (do_broaden) THEN
854 IF (ldos_p(ildos)%ldos%separate_components) THEN
855 CALL write_broadened_pdos(logger, dft_section, trim(my_mittle), my_pos, my_act, iterstep, &
856 e_fermi, hoco, energy_ref, trim(zero_label), &
857 "Projected DOS for atom list "//trim(ldos_index(ildos)), &
858 ldos_p(ildos)%ldos%maxl, .true., &
859 ldos_p(ildos)%ldos%pdos_array(1:nsoset(ldos_p(ildos)%ldos%maxl), :), &
860 eigenvalues, nmo + nvirt, de, broaden_type, broaden_width, &
861 voigt_mixing, ndigits, pdos_print_key=trim(my_print_key))
862 ELSE
863 CALL write_broadened_pdos(logger, dft_section, trim(my_mittle), my_pos, my_act, iterstep, &
864 e_fermi, hoco, energy_ref, trim(zero_label), &
865 "Projected DOS for atom list "//trim(ldos_index(ildos)), &
866 ldos_p(ildos)%ldos%maxl, .false., &
867 ldos_p(ildos)%ldos%pdos_array(0:ldos_p(ildos)%ldos%maxl, :), &
868 eigenvalues, nmo + nvirt, de, broaden_type, broaden_width, &
869 voigt_mixing, ndigits, pdos_print_key=trim(my_print_key))
870 END IF
871 END IF
872
873 iw = cp_print_key_unit_nr(logger, dft_section, trim(my_print_key), &
874 extension=".pdos_raw", file_position=my_pos, file_action=my_act, &
875 file_form="FORMATTED", middle_name=trim(my_mittle))
876 IF (iw > 0) THEN
877
878 fmtstr1 = "(I8,2X,2F16.6, (2X,F16.8))"
879 fmtstr2 = "(A42, (10X,A8))"
880 IF (ldos_p(ildos)%ldos%separate_components) THEN
881 WRITE (unit=fmtstr1(15:16), fmt="(I2)") nsoset(ldos_p(ildos)%ldos%maxl) + 1
882 WRITE (unit=fmtstr2(6:7), fmt="(I2)") nsoset(ldos_p(ildos)%ldos%maxl) + 1
883 ELSE
884 WRITE (unit=fmtstr1(15:16), fmt="(I2)") ldos_p(ildos)%ldos%maxl + 2
885 WRITE (unit=fmtstr2(6:7), fmt="(I2)") ldos_p(ildos)%ldos%maxl + 2
886 END IF
887
888 WRITE (unit=iw, fmt="(A,I0,A,I0,A,I0)") &
889 "# Projected DOS for list ", ildos, " of ", ldos_p(ildos)%ldos%nlist, &
890 " atoms, at iteration step i = ", iterstep
891 WRITE (unit=iw, fmt="(A,F12.6,A,F12.6,A)") &
892 "# E(Fermi) = ", e_fermi, " a.u. = ", e_fermi*ev_factor, " eV"
893 WRITE (unit=iw, fmt="(A,F12.6,A,F12.6,A)") &
894 "# E(HOCO) = ", hoco, " a.u. = ", hoco*ev_factor, " eV"
895 WRITE (unit=iw, fmt="(A,A)") "# Energy zero: ", trim(zero_label)
896 IF (ldos_p(ildos)%ldos%separate_components) THEN
897 ALLOCATE (tmp_str(0:0, 0:ldos_p(ildos)%ldos%maxl, -ldos_p(ildos)%ldos%maxl:ldos_p(ildos)%ldos%maxl))
898 tmp_str = ""
899 DO j = 0, ldos_p(ildos)%ldos%maxl
900 DO i = -j, j
901 tmp_str(0, j, i) = sgf_symbol(0, j, i)
902 END DO
903 END DO
904
905 WRITE (unit=iw, fmt=fmtstr2) &
906 "# MO "//trim(energy_label)//" Occupation", "Total", &
907 ((trim(tmp_str(0, il, im)), im=-il, il), il=0, ldos_p(ildos)%ldos%maxl)
908 DO imo = 1, nmo + nvirt
909 WRITE (unit=iw, fmt=fmtstr1) imo, (eigenvalues(imo) - energy_ref)*energy_factor, &
910 occupation_numbers(imo), &
911 sum(ldos_p(ildos)%ldos%pdos_array(1:nsoset(ldos_p(ildos)%ldos%maxl), imo)), &
912 (ldos_p(ildos)%ldos%pdos_array(lshell, imo), &
913 lshell=1, nsoset(ldos_p(ildos)%ldos%maxl))
914 END DO
915 DEALLOCATE (tmp_str)
916 ELSE
917 WRITE (unit=iw, fmt=fmtstr2) &
918 "# MO "//trim(energy_label)//" Occupation", "Total", &
919 (trim(l_sym(il)), il=0, ldos_p(ildos)%ldos%maxl)
920 DO imo = 1, nmo + nvirt
921 WRITE (unit=iw, fmt=fmtstr1) imo, (eigenvalues(imo) - energy_ref)*energy_factor, &
922 occupation_numbers(imo), &
923 sum(ldos_p(ildos)%ldos%pdos_array(0:ldos_p(ildos)%ldos%maxl, imo)), &
924 (ldos_p(ildos)%ldos%pdos_array(lshell, imo), lshell=0, ldos_p(ildos)%ldos%maxl)
925 END DO
926 END IF
927 END IF
928 CALL cp_print_key_finished_output(iw, logger, dft_section, &
929 trim(my_print_key))
930 END IF ! maxl>0
931 END DO ! ildos
932
933 ! write the pdos for the lists, each ona different file,
934 ! the filenames are indexed with the list number
935 DO ildos = 1, n_r_ldos
936
937 npoints = r_ldos_p(ildos)%ldos%npoints
938 CALL para_env%sum(npoints)
939 CALL para_env%sum(np_tot)
940 CALL para_env%sum(r_ldos_p(ildos)%ldos%pdos_array)
941 IF (PRESENT(ispin)) THEN
942 IF (PRESENT(xas_mittle)) THEN
943 my_mittle = trim(xas_mittle)//trim(spin(ispin))//"_r_list"//trim(r_ldos_index(ildos))
944 ELSE
945 my_mittle = trim(spin(ispin))//"_r_list"//trim(r_ldos_index(ildos))
946 END IF
947 my_spin = ispin
948 ELSE
949 my_mittle = "r_list"//trim(r_ldos_index(ildos))
950 my_spin = 1
951 END IF
952
953 iw = cp_print_key_unit_nr(logger, dft_section, trim(my_print_key), &
954 extension=".pdos_raw", file_position=my_pos, file_action=my_act, &
955 file_form="FORMATTED", middle_name=trim(my_mittle))
956 IF (iw > 0) THEN
957 fmtstr1 = "(I8,2X,2F16.6, (2X,F16.8))"
958 fmtstr2 = "(A42, (10X,A8))"
959
960 WRITE (unit=iw, fmt="(A,I0,A,F12.6,F12.6,A)") &
961 "# Projected DOS in real space, using ", npoints, &
962 " points of the grid, and eval in the range", r_ldos_p(ildos)%ldos%eval_range(1:2), " Hartree"
963 WRITE (unit=iw, fmt="(A,F12.6,A,F12.6,A)") &
964 "# E(Fermi) = ", e_fermi, " a.u. = ", e_fermi*ev_factor, " eV"
965 WRITE (unit=iw, fmt="(A,F12.6,A,F12.6,A)") &
966 "# E(HOCO) = ", hoco, " a.u. = ", hoco*ev_factor, " eV"
967 WRITE (unit=iw, fmt="(A,A)") "# Energy zero: ", trim(zero_label)
968 WRITE (unit=iw, fmt="(A,A,A)") &
969 "# MO ", trim(energy_label), " Occupation LDOS"
970 DO imo = 1, nmo + nvirt
971 IF (r_ldos_p(ildos)%ldos%eval_range(1) <= eigenvalues(imo) .AND. &
972 r_ldos_p(ildos)%ldos%eval_range(2) >= eigenvalues(imo)) THEN
973 WRITE (unit=iw, fmt="(I8,2X,2F16.6,E20.10,E20.10)") imo, &
974 (eigenvalues(imo) - energy_ref)*energy_factor, occupation_numbers(imo), &
975 r_ldos_p(ildos)%ldos%pdos_array(imo), r_ldos_p(ildos)%ldos%pdos_array(imo)*np_tot
976 END IF
977 END DO
978
979 END IF
980 CALL cp_print_key_finished_output(iw, logger, dft_section, &
981 trim(my_print_key))
982 END DO
983
984 ! deallocate local variables
985 DEALLOCATE (pdos_array)
986 DEALLOCATE (firstrow)
987 IF (do_ldos) THEN
988 DO ildos = 1, nldos
989 DEALLOCATE (ldos_p(ildos)%ldos%pdos_array)
990 DEALLOCATE (ldos_p(ildos)%ldos%list_index)
991 DEALLOCATE (ldos_p(ildos)%ldos)
992 END DO
993 DEALLOCATE (ldos_p)
994 DEALLOCATE (ldos_index)
995 END IF
996 IF (do_r_ldos) THEN
997 DO ildos = 1, n_r_ldos
998 DEALLOCATE (r_ldos_p(ildos)%ldos%index_grid_local)
999 DEALLOCATE (r_ldos_p(ildos)%ldos%pdos_array)
1000 DEALLOCATE (r_ldos_p(ildos)%ldos%list_index)
1001 IF (.NOT. read_r(1, ildos)) THEN
1002 DEALLOCATE (r_ldos_p(ildos)%ldos%x_range)
1003 END IF
1004 IF (.NOT. read_r(2, ildos)) THEN
1005 DEALLOCATE (r_ldos_p(ildos)%ldos%y_range)
1006 END IF
1007 IF (.NOT. read_r(3, ildos)) THEN
1008 DEALLOCATE (r_ldos_p(ildos)%ldos%z_range)
1009 END IF
1010 IF (.NOT. read_r(4, ildos)) THEN
1011 DEALLOCATE (r_ldos_p(ildos)%ldos%eval_range)
1012 END IF
1013 DEALLOCATE (r_ldos_p(ildos)%ldos)
1014 END DO
1015 DEALLOCATE (read_r)
1016 DEALLOCATE (r_ldos_p)
1017 DEALLOCATE (r_ldos_index)
1018 CALL auxbas_pw_pool%give_back_pw(wf_r)
1019 CALL auxbas_pw_pool%give_back_pw(wf_g)
1020 END IF
1021 IF (do_virt) THEN
1022 CALL cp_fm_release(matrix_work)
1023 DEALLOCATE (eigenvalues)
1024 DEALLOCATE (occupation_numbers)
1025 END IF
1026
1027 CALL timestop(handle)
1028
1029 END SUBROUTINE calculate_projected_dos
1030
1031! **************************************************************************************************
1032!> \brief Compute and write broadened projected density of states for k-point calculations.
1033!> \param qs_env ...
1034!> \param dft_section ...
1035!> \param pdos_print_key ...
1036!> \param write_pdos ...
1037!> \param write_pdos_raw ...
1038! **************************************************************************************************
1039 SUBROUTINE calculate_projected_dos_kp(qs_env, dft_section, pdos_print_key, write_pdos, write_pdos_raw)
1040
1041 TYPE(qs_environment_type), POINTER :: qs_env
1042 TYPE(section_vals_type), POINTER :: dft_section
1043 CHARACTER(LEN=*), INTENT(IN), OPTIONAL :: pdos_print_key
1044 LOGICAL, INTENT(IN), OPTIONAL :: write_pdos, write_pdos_raw
1045
1046 CHARACTER(len=*), PARAMETER :: routinen = 'calculate_projected_dos_kp'
1047
1048 CHARACTER(LEN=32) :: zero_label
1049 CHARACTER(LEN=default_string_length) :: kind_name, my_act, my_mittle, my_pos, &
1050 my_print_key, spin(2)
1051 COMPLEX(KIND=dp), ALLOCATABLE, DIMENSION(:, :) :: zvecbuffer
1052 INTEGER :: broaden_type, energy_zero, fractional_occupation_int, handle, icomp, ik, ikind, &
1053 imo, ispin, iterstep, maxl, maxlgto, n_r_ldos, nao, ncomp, ndigits, nhist, nkind, nldos, &
1054 nmo_kp, nspins, output_unit, resolved_energy_zero
1055 INTEGER, ALLOCATABLE, DIMENSION(:) :: ao_comp, ao_kind, ao_l, kind_maxl
1056 LOGICAL :: append, fractional_occupation, &
1057 separate_components, should_output, &
1058 write_raw, write_standard
1059 REAL(kind=dp) :: broaden_cutoff, broaden_width, de, e1, &
1060 e2, e_fermi(2), emax, emin, &
1061 energy_ref(2), hoco(2), voigt_mixing, &
1062 wkp
1063 REAL(kind=dp), ALLOCATABLE, DIMENSION(:) :: ao_weight
1064 REAL(kind=dp), ALLOCATABLE, DIMENSION(:, :) :: proj_weight, vecbuffer
1065 REAL(kind=dp), ALLOCATABLE, DIMENSION(:, :, :, :) :: pdos_curve
1066 REAL(kind=dp), DIMENSION(:), POINTER :: eigenvalues, occupation_numbers
1067 TYPE(atomic_kind_type), DIMENSION(:), POINTER :: atomic_kind_set
1068 TYPE(cp_cfm_type) :: cshalfc
1069 TYPE(cp_fm_struct_type), POINTER :: fm_struct_tmp
1070 TYPE(cp_fm_type) :: shalfc
1071 TYPE(cp_logger_type), POINTER :: logger
1072 TYPE(dbcsr_p_type), DIMENSION(:, :), POINTER :: matrix_s_kp
1073 TYPE(dft_control_type), POINTER :: dft_control
1074 TYPE(gto_basis_set_type), POINTER :: orb_basis_set
1075 TYPE(kpoint_env_type), POINTER :: kp
1076 TYPE(kpoint_type), POINTER :: kpoints
1077 TYPE(mo_set_type), POINTER :: mo_set
1078 TYPE(mp_para_env_type), POINTER :: para_env
1079 TYPE(particle_type), DIMENSION(:), POINTER :: particle_set
1080 TYPE(qs_kind_type), DIMENSION(:), POINTER :: qs_kind_set
1081 TYPE(qs_scf_env_type), POINTER :: scf_env
1082 TYPE(section_vals_type), POINTER :: ldos_section
1083
1084 NULLIFY (logger, kpoints, dft_control, para_env, atomic_kind_set, qs_kind_set, particle_set)
1085 NULLIFY (matrix_s_kp, scf_env)
1086 NULLIFY (kp, mo_set, eigenvalues, fm_struct_tmp, orb_basis_set, ldos_section)
1087 logger => cp_get_default_logger()
1088 my_print_key = "PRINT%PDOS"
1089 IF (PRESENT(pdos_print_key)) my_print_key = trim(pdos_print_key)
1090 write_standard = .true.
1091 IF (PRESENT(write_pdos)) write_standard = write_pdos
1092 write_raw = .false.
1093 IF (PRESENT(write_pdos_raw)) write_raw = write_pdos_raw
1094 write_raw = write_raw .AND. write_standard
1095 should_output = btest(cp_print_key_should_output(logger%iter_info, dft_section, &
1096 trim(my_print_key)), cp_p_file)
1097 output_unit = cp_logger_get_default_io_unit(logger)
1098 IF ((.NOT. should_output)) RETURN
1099
1100 CALL timeset(routinen, handle)
1101 iterstep = logger%iter_info%iteration(logger%iter_info%n_rlevel)
1102
1103 IF (output_unit > 0) WRITE (unit=output_unit, fmt='(/,(T3,A,T61,I10))') &
1104 " Calculate k-point PDOS at iteration step ", iterstep
1105
1106 CALL get_qs_env(qs_env=qs_env, &
1107 kpoints=kpoints, &
1108 dft_control=dft_control, &
1109 matrix_s_kp=matrix_s_kp, &
1110 scf_env=scf_env, &
1111 atomic_kind_set=atomic_kind_set, &
1112 qs_kind_set=qs_kind_set, &
1113 particle_set=particle_set)
1114 para_env => kpoints%para_env_inter_kp
1115 nspins = dft_control%nspins
1116 nkind = SIZE(atomic_kind_set)
1117 CALL get_qs_kind_set(qs_kind_set, maxlgto=maxlgto)
1118 IF (.NOT. ASSOCIATED(kpoints%kp_env)) THEN
1119 cpwarn("No local k points available for k-point PDOS")
1120 CALL timestop(handle)
1121 RETURN
1122 END IF
1123 IF (SIZE(kpoints%kp_env) == 0) THEN
1124 cpwarn("No local k points available for k-point PDOS")
1125 CALL timestop(handle)
1126 RETURN
1127 END IF
1128
1129 CALL section_vals_val_get(dft_section, trim(my_print_key)//"%DELTA_E", r_val=de)
1130 CALL section_vals_val_get(dft_section, trim(my_print_key)//"%APPEND", l_val=append)
1131 IF (trim(my_print_key) == "PRINT%DOS") THEN
1132 CALL section_vals_val_get(dft_section, trim(my_print_key)//"%PDOS%COMPONENTS", l_val=separate_components)
1133 ELSE
1134 CALL section_vals_val_get(dft_section, trim(my_print_key)//"%COMPONENTS", l_val=separate_components)
1135 END IF
1136 CALL section_vals_val_get(dft_section, trim(my_print_key)//"%NDIGITS", i_val=ndigits)
1137 CALL section_vals_val_get(dft_section, trim(my_print_key)//"%BROADEN_TYPE", i_val=broaden_type)
1138 CALL section_vals_val_get(dft_section, trim(my_print_key)//"%BROADEN_WIDTH", r_val=broaden_width)
1139 CALL section_vals_val_get(dft_section, trim(my_print_key)//"%VOIGT_MIXING", r_val=voigt_mixing)
1140 CALL section_vals_val_get(dft_section, trim(my_print_key)//"%ENERGY_ZERO", i_val=energy_zero)
1141 ndigits = min(max(ndigits, 1), 10)
1142 de = max(de, 0.00001_dp)
1143
1144 ldos_section => section_vals_get_subs_vals(dft_section, trim(my_print_key)//"%LDOS")
1145 CALL section_vals_get(ldos_section, n_repetition=nldos)
1146 ldos_section => section_vals_get_subs_vals(dft_section, trim(my_print_key)//"%R_LDOS")
1147 CALL section_vals_get(ldos_section, n_repetition=n_r_ldos)
1148 IF (nldos > 0 .OR. n_r_ldos > 0) THEN
1149 cpwarn("LDOS/R_LDOS are not implemented for k-point PDOS and will be ignored")
1150 END IF
1151 IF (write_raw) THEN
1152 cpwarn("Raw k-point PDOS output is not implemented and will be ignored")
1153 END IF
1154 IF (broaden_width <= 0.0_dp) THEN
1155 cpwarn("Broadened k-point PDOS output requires a finite BROADEN_WIDTH")
1156 CALL timestop(handle)
1157 RETURN
1158 END IF
1159
1160 IF (separate_components) THEN
1161 ncomp = nsoset(maxlgto)
1162 ELSE
1163 ncomp = maxlgto + 1
1164 END IF
1165 ALLOCATE (kind_maxl(nkind))
1166 kind_maxl = -1
1167 DO ikind = 1, nkind
1168 NULLIFY (orb_basis_set)
1169 CALL get_qs_kind(qs_kind_set(ikind), basis_set=orb_basis_set)
1170 CALL get_gto_basis_set(gto_basis_set=orb_basis_set, maxl=maxl)
1171 kind_maxl(ikind) = maxl
1172 END DO
1173
1174 emin = huge(0.0_dp)
1175 emax = -huge(0.0_dp)
1176 e_fermi(:) = 0.0_dp
1177 hoco(:) = -huge(0.0_dp)
1178 fractional_occupation = .false.
1179 IF (kpoints%nkp /= 0) THEN
1180 DO ik = 1, SIZE(kpoints%kp_env)
1181 kp => kpoints%kp_env(ik)%kpoint_env
1182 DO ispin = 1, nspins
1183 mo_set => kp%mos(1, ispin)
1184 CALL get_mo_set(mo_set=mo_set, nmo=nmo_kp, mu=e_fermi(ispin))
1185 eigenvalues => mo_set%eigenvalues
1186 occupation_numbers => mo_set%occupation_numbers
1187 DO imo = 1, nmo_kp
1188 IF (occupation_numbers(imo) > 1.0e-10_dp) hoco(ispin) = max(hoco(ispin), eigenvalues(imo))
1189 IF (abs(occupation_numbers(imo) - real(nint(occupation_numbers(imo)), kind=dp)) > &
1190 1.0e-8_dp) fractional_occupation = .true.
1191 END DO
1192 e1 = minval(eigenvalues(1:nmo_kp))
1193 e2 = maxval(eigenvalues(1:nmo_kp))
1194 emin = min(emin, e1)
1195 emax = max(emax, e2)
1196 END DO
1197 END DO
1198 END IF
1199 CALL para_env%min(emin)
1200 CALL para_env%max(emax)
1201 CALL para_env%max(e_fermi)
1202 CALL para_env%max(hoco)
1203 fractional_occupation_int = merge(1, 0, fractional_occupation)
1204 CALL para_env%max(fractional_occupation_int)
1205 fractional_occupation = (fractional_occupation_int /= 0)
1206 DO ispin = 1, nspins
1207 IF (hoco(ispin) < -0.5_dp*huge(0.0_dp)) hoco(ispin) = e_fermi(ispin)
1208 END DO
1209 resolved_energy_zero = dos_resolve_energy_zero(energy_zero, dft_control%smear, fractional_occupation)
1210 SELECT CASE (resolved_energy_zero)
1212 energy_ref(:) = 0.0_dp
1214 energy_ref(:) = hoco(:)
1215 CASE DEFAULT
1216 energy_ref(:) = e_fermi(:)
1217 END SELECT
1218 zero_label = dos_energy_zero_label(resolved_energy_zero)
1219 IF (energy_zero == dos_energy_zero_auto) zero_label = "AUTO -> "//trim(zero_label)
1220 broaden_cutoff = broadening_cutoff(broaden_type, broaden_width)
1221 emin = emin - broaden_cutoff
1222 emax = emax + broaden_cutoff
1223 nhist = nint((emax - emin)/de) + 1
1224 ALLOCATE (pdos_curve(nhist, ncomp, nkind, nspins))
1225 pdos_curve = 0.0_dp
1226
1227 ! Ensure that S(k)^1/2 is available for the Lowdin projection.
1228 ! This is normally only constructed for Lowdin population/DFT+U paths.
1229 CALL diag_kp_smat(matrix_s_kp, kpoints, scf_env%scf_work1)
1230
1231 ! Use the first local k point to construct the AO -> kind/l/component map.
1232 kp => kpoints%kp_env(1)%kpoint_env
1233 mo_set => kp%mos(1, 1)
1234 CALL get_mo_set(mo_set=mo_set, nao=nao)
1235 CALL build_pdos_ao_map(qs_kind_set, particle_set, nao, ao_kind, ao_l, ao_comp)
1236 ALLOCATE (ao_weight(nao), proj_weight(ncomp, nkind))
1237 ALLOCATE (vecbuffer(1, nao), zvecbuffer(1, nao))
1238
1239 IF (kpoints%nkp /= 0) THEN
1240 DO ik = 1, SIZE(kpoints%kp_env)
1241 kp => kpoints%kp_env(ik)%kpoint_env
1242 wkp = kp%wkp
1243 DO ispin = 1, nspins
1244 mo_set => kp%mos(1, ispin)
1245 CALL get_mo_set(mo_set=mo_set, nao=nao, nmo=nmo_kp)
1246 eigenvalues => mo_set%eigenvalues
1247 CALL cp_fm_get_info(mo_set%mo_coeff, matrix_struct=fm_struct_tmp)
1248 IF (kpoints%use_real_wfn) THEN
1249 CALL cp_fm_create(shalfc, fm_struct_tmp, name="shalfc")
1250 CALL lowdin_kp_mo_coeff(kp, ispin, kpoints%use_real_wfn, shalfc=shalfc)
1251 ELSE
1252 CALL cp_cfm_create(cshalfc, fm_struct_tmp, name="cshalfc")
1253 CALL lowdin_kp_mo_coeff(kp, ispin, kpoints%use_real_wfn, cshalfc=cshalfc)
1254 END IF
1255
1256 DO imo = 1, nmo_kp
1257 IF (kpoints%use_real_wfn) THEN
1258 CALL cp_fm_get_submatrix(shalfc, vecbuffer, 1, imo, nao, 1, transpose=.true.)
1259 ao_weight(:) = vecbuffer(1, 1:nao)**2
1260 ELSE
1261 CALL cp_cfm_get_submatrix(cshalfc, zvecbuffer, 1, imo, nao, 1, transpose=.true.)
1262 ao_weight(:) = real(conjg(zvecbuffer(1, 1:nao))*zvecbuffer(1, 1:nao), kind=dp)
1263 END IF
1264 proj_weight = 0.0_dp
1265 CALL accumulate_pdos_weights(ao_weight, ao_kind, ao_l, ao_comp, &
1266 separate_components, proj_weight)
1267 DO ikind = 1, nkind
1268 IF (kind_maxl(ikind) < 0) cycle
1269 IF (separate_components) THEN
1270 DO icomp = 1, nsoset(kind_maxl(ikind))
1271 CALL add_broadened_value(pdos_curve(:, icomp, ikind, ispin), &
1272 emin, de, eigenvalues(imo), &
1273 wkp*proj_weight(icomp, ikind), &
1274 broaden_type, broaden_width, voigt_mixing)
1275 END DO
1276 ELSE
1277 DO icomp = 1, kind_maxl(ikind) + 1
1278 CALL add_broadened_value(pdos_curve(:, icomp, ikind, ispin), &
1279 emin, de, eigenvalues(imo), &
1280 wkp*proj_weight(icomp, ikind), &
1281 broaden_type, broaden_width, voigt_mixing)
1282 END DO
1283 END IF
1284 END DO
1285 END DO
1286
1287 IF (kpoints%use_real_wfn) THEN
1288 CALL cp_fm_release(shalfc)
1289 ELSE
1290 CALL cp_cfm_release(cshalfc)
1291 END IF
1292 END DO
1293 END DO
1294 END IF
1295 CALL para_env%sum(pdos_curve)
1296
1297 IF (append .AND. iterstep > 1) THEN
1298 my_pos = "APPEND"
1299 ELSE
1300 my_pos = "REWIND"
1301 END IF
1302 my_act = "WRITE"
1303 spin(1) = "ALPHA"
1304 spin(2) = "BETA"
1305 IF (write_standard) THEN
1306 DO ikind = 1, nkind
1307 IF (kind_maxl(ikind) < 0) cycle
1308 CALL get_atomic_kind(atomic_kind_set(ikind), name=kind_name)
1309 DO ispin = 1, nspins
1310 IF (nspins == 2) THEN
1311 my_mittle = trim(spin(ispin))//"_k"//trim(adjustl(cp_to_string(ikind)))
1312 ELSE
1313 my_mittle = "k"//trim(adjustl(cp_to_string(ikind)))
1314 END IF
1315 CALL write_broadened_pdos_curve(logger, dft_section, trim(my_mittle), my_pos, my_act, &
1316 iterstep, e_fermi(ispin), hoco(ispin), energy_ref(ispin), &
1317 trim(zero_label), &
1318 "K-point projected DOS for atomic kind "//trim(kind_name), &
1319 kind_maxl(ikind), separate_components, &
1320 pdos_curve(:, :, ikind, ispin), emin, de, &
1321 broaden_type, broaden_width, voigt_mixing, ndigits, pdos_print_key=trim(my_print_key))
1322 END DO
1323 END DO
1324 END IF
1325
1326 DEALLOCATE (ao_comp, ao_kind, ao_l, ao_weight, kind_maxl, pdos_curve, proj_weight, &
1327 vecbuffer, zvecbuffer)
1328
1329 CALL timestop(handle)
1330
1331 END SUBROUTINE calculate_projected_dos_kp
1332
1333! **************************************************************************************************
1334!> \brief Build AO mapping arrays for PDOS accumulation.
1335!> \param qs_kind_set ...
1336!> \param particle_set ...
1337!> \param nao ...
1338!> \param ao_kind ...
1339!> \param ao_l ...
1340!> \param ao_comp ...
1341! **************************************************************************************************
1342 SUBROUTINE build_pdos_ao_map(qs_kind_set, particle_set, nao, ao_kind, ao_l, ao_comp)
1343
1344 TYPE(qs_kind_type), DIMENSION(:), POINTER :: qs_kind_set
1345 TYPE(particle_type), DIMENSION(:), POINTER :: particle_set
1346 INTEGER, INTENT(IN) :: nao
1347 INTEGER, ALLOCATABLE, DIMENSION(:), INTENT(OUT) :: ao_kind, ao_l, ao_comp
1348
1349 INTEGER :: iatom, ikind, irow, iset, ishell, iso, &
1350 lshell, maxl, nset
1351 INTEGER, DIMENSION(:), POINTER :: nshell
1352 INTEGER, DIMENSION(:, :), POINTER :: l
1353 TYPE(gto_basis_set_type), POINTER :: orb_basis_set
1354
1355 ALLOCATE (ao_kind(nao), ao_l(nao), ao_comp(nao))
1356 irow = 0
1357 DO iatom = 1, SIZE(particle_set)
1358 NULLIFY (orb_basis_set)
1359 CALL get_atomic_kind(particle_set(iatom)%atomic_kind, kind_number=ikind)
1360 CALL get_qs_kind(qs_kind_set(ikind), basis_set=orb_basis_set)
1361 CALL get_gto_basis_set(gto_basis_set=orb_basis_set, &
1362 nset=nset, &
1363 nshell=nshell, &
1364 l=l, maxl=maxl)
1365 DO iset = 1, nset
1366 DO ishell = 1, nshell(iset)
1367 lshell = l(ishell, iset)
1368 DO iso = 1, nso(lshell)
1369 irow = irow + 1
1370 cpassert(irow <= nao)
1371 ao_kind(irow) = ikind
1372 ao_l(irow) = lshell
1373 ao_comp(irow) = nsoset(lshell - 1) + iso
1374 END DO
1375 END DO
1376 END DO
1377 END DO
1378 cpassert(irow == nao)
1379
1380 END SUBROUTINE build_pdos_ao_map
1381
1382! **************************************************************************************************
1383!> \brief Accumulate AO weights into kind/l or kind/component projected weights.
1384!> \param ao_weight ...
1385!> \param ao_kind ...
1386!> \param ao_l ...
1387!> \param ao_comp ...
1388!> \param separate_components ...
1389!> \param proj_weight ...
1390! **************************************************************************************************
1391 SUBROUTINE accumulate_pdos_weights(ao_weight, ao_kind, ao_l, ao_comp, &
1392 separate_components, proj_weight)
1393
1394 REAL(kind=dp), DIMENSION(:), INTENT(IN) :: ao_weight
1395 INTEGER, DIMENSION(:), INTENT(IN) :: ao_kind, ao_l, ao_comp
1396 LOGICAL, INTENT(IN) :: separate_components
1397 REAL(kind=dp), DIMENSION(:, :), INTENT(INOUT) :: proj_weight
1398
1399 INTEGER :: iao, icomp, ikind
1400
1401 DO iao = 1, SIZE(ao_weight)
1402 ikind = ao_kind(iao)
1403 IF (separate_components) THEN
1404 icomp = ao_comp(iao)
1405 ELSE
1406 icomp = ao_l(iao) + 1
1407 END IF
1408 proj_weight(icomp, ikind) = proj_weight(icomp, ikind) + ao_weight(iao)
1409 END DO
1410
1411 END SUBROUTINE accumulate_pdos_weights
1412
1413! **************************************************************************************************
1414!> \brief Write a broadened k-point PDOS curve.
1415!> \param logger ...
1416!> \param dft_section ...
1417!> \param middle_name ...
1418!> \param file_position ...
1419!> \param file_action ...
1420!> \param iterstep ...
1421!> \param e_fermi ...
1422!> \param hoco ...
1423!> \param energy_ref ...
1424!> \param zero_label ...
1425!> \param title ...
1426!> \param maxl ...
1427!> \param separate_components ...
1428!> \param pdos_curve ...
1429!> \param emin ...
1430!> \param de ...
1431!> \param broaden_type ...
1432!> \param broaden_width ...
1433!> \param voigt_mixing ...
1434!> \param ndigits ...
1435!> \param pdos_print_key ...
1436! **************************************************************************************************
1437 SUBROUTINE write_broadened_pdos_curve(logger, dft_section, middle_name, file_position, &
1438 file_action, iterstep, e_fermi, hoco, energy_ref, zero_label, &
1439 title, maxl, &
1440 separate_components, pdos_curve, emin, de, &
1441 broaden_type, broaden_width, voigt_mixing, ndigits, pdos_print_key)
1442
1443 TYPE(cp_logger_type), POINTER :: logger
1444 TYPE(section_vals_type), POINTER :: dft_section
1445 CHARACTER(LEN=*), INTENT(IN) :: middle_name, file_position, file_action
1446 INTEGER, INTENT(IN) :: iterstep
1447 REAL(kind=dp), INTENT(IN) :: e_fermi, hoco, energy_ref
1448 CHARACTER(LEN=*), INTENT(IN) :: zero_label, title
1449 INTEGER, INTENT(IN) :: maxl
1450 LOGICAL, INTENT(IN) :: separate_components
1451 REAL(kind=dp), DIMENSION(:, :), INTENT(IN) :: pdos_curve
1452 REAL(kind=dp), INTENT(IN) :: emin, de
1453 INTEGER, INTENT(IN) :: broaden_type
1454 REAL(kind=dp), INTENT(IN) :: broaden_width, voigt_mixing
1455 INTEGER, INTENT(IN) :: ndigits
1456 CHARACTER(LEN=*), INTENT(IN), OPTIONAL :: pdos_print_key
1457
1458 CHARACTER(LEN=16) :: energy_label
1459 CHARACTER(LEN=20) :: fmtstr_data
1460 CHARACTER(LEN=6), ALLOCATABLE, DIMENSION(:, :, :) :: tmp_str
1461 CHARACTER(LEN=default_string_length) :: my_print_key
1462 INTEGER :: energy_unit, i, icomp, il, im, iw, &
1463 ncomponents, nhist
1464 REAL(kind=dp) :: density_factor, energy_factor, &
1465 ev_factor, eval
1466
1467 my_print_key = "PRINT%PDOS"
1468 IF (PRESENT(pdos_print_key)) my_print_key = trim(pdos_print_key)
1469
1470 nhist = SIZE(pdos_curve, 1)
1471 IF (separate_components) THEN
1472 ncomponents = nsoset(maxl)
1473 ELSE
1474 ncomponents = maxl + 1
1475 END IF
1476 CALL section_vals_val_get(dft_section, trim(my_print_key)//"%ENERGY_UNIT", i_val=energy_unit)
1477 energy_factor = dos_energy_scale(energy_unit)
1478 density_factor = dos_density_scale(energy_unit)
1479 energy_label = dos_energy_label(energy_unit)
1481 iw = cp_print_key_unit_nr(logger, dft_section, trim(my_print_key), &
1482 extension=".pdos", file_position=file_position, file_action=file_action, &
1483 file_form="FORMATTED", middle_name=trim(middle_name))
1484 IF (iw > 0) THEN
1485 WRITE (unit=iw, fmt="(A,I0)") "# "//trim(title)//" at iteration step i = ", iterstep
1486 WRITE (unit=iw, fmt="(A,F12.6,A,F12.6,A)") &
1487 "# E(Fermi) = ", e_fermi, " a.u. = ", e_fermi*ev_factor, " eV"
1488 WRITE (unit=iw, fmt="(A,F12.6,A,F12.6,A)") &
1489 "# E(HOCO) = ", hoco, " a.u. = ", hoco*ev_factor, " eV"
1490 WRITE (unit=iw, fmt="(A,A)") "# Energy zero: ", trim(zero_label)
1491 CALL write_broadening_info(iw, broaden_type, broaden_width, voigt_mixing)
1492 WRITE (unit=iw, fmt="(A)", advance="NO") "# "//trim(energy_label)
1493 WRITE (unit=iw, fmt="(2X,A)", advance="NO") "total"
1494 IF (separate_components) THEN
1495 ALLOCATE (tmp_str(0:0, 0:maxl, -maxl:maxl))
1496 tmp_str = ""
1497 DO il = 0, maxl
1498 DO im = -il, il
1499 tmp_str(0, il, im) = sgf_symbol(0, il, im)
1500 WRITE (unit=iw, fmt="(2X,A)", advance="NO") trim(tmp_str(0, il, im))
1501 END DO
1502 END DO
1503 DEALLOCATE (tmp_str)
1504 ELSE
1505 DO il = 0, maxl
1506 WRITE (unit=iw, fmt="(2X,A)", advance="NO") trim(l_sym(il))
1507 END DO
1508 END IF
1509 WRITE (unit=iw, fmt="()")
1510 WRITE (unit=fmtstr_data, fmt="(A,I0,A)") "(2X,F20.", ndigits, ")"
1511 DO i = 1, nhist
1512 eval = (emin + (i - 1)*de - energy_ref)*energy_factor
1513 WRITE (unit=iw, fmt="(F15.8)", advance="NO") eval
1514 WRITE (unit=iw, fmt=fmtstr_data, advance="NO") sum(pdos_curve(i, 1:ncomponents))*density_factor
1515 DO icomp = 1, ncomponents
1516 WRITE (unit=iw, fmt=fmtstr_data, advance="NO") pdos_curve(i, icomp)*density_factor
1517 END DO
1518 WRITE (unit=iw, fmt="()")
1519 END DO
1520 END IF
1521 CALL cp_print_key_finished_output(iw, logger, dft_section, trim(my_print_key))
1522
1523 END SUBROUTINE write_broadened_pdos_curve
1524
1525! **************************************************************************************************
1526!> \brief Write a broadened PDOS curve for a projected weight matrix.
1527!> \param logger ...
1528!> \param dft_section ...
1529!> \param middle_name ...
1530!> \param file_position ...
1531!> \param file_action ...
1532!> \param iterstep ...
1533!> \param e_fermi ...
1534!> \param hoco ...
1535!> \param energy_ref ...
1536!> \param zero_label ...
1537!> \param title ...
1538!> \param maxl ...
1539!> \param separate_components ...
1540!> \param weights ...
1541!> \param eigenvalues ...
1542!> \param nstates ...
1543!> \param de ...
1544!> \param broaden_type ...
1545!> \param broaden_width ...
1546!> \param voigt_mixing ...
1547!> \param ndigits ...
1548!> \param pdos_print_key ...
1549! **************************************************************************************************
1550 SUBROUTINE write_broadened_pdos(logger, dft_section, middle_name, file_position, file_action, &
1551 iterstep, e_fermi, hoco, energy_ref, zero_label, title, maxl, separate_components, weights, &
1552 eigenvalues, nstates, de, broaden_type, broaden_width, &
1553 voigt_mixing, ndigits, pdos_print_key)
1554
1555 TYPE(cp_logger_type), POINTER :: logger
1556 TYPE(section_vals_type), POINTER :: dft_section
1557 CHARACTER(LEN=*), INTENT(IN) :: middle_name, file_position, file_action
1558 INTEGER, INTENT(IN) :: iterstep
1559 REAL(kind=dp), INTENT(IN) :: e_fermi, hoco, energy_ref
1560 CHARACTER(LEN=*), INTENT(IN) :: zero_label, title
1561 INTEGER, INTENT(IN) :: maxl
1562 LOGICAL, INTENT(IN) :: separate_components
1563 REAL(kind=dp), DIMENSION(:, :), INTENT(IN) :: weights
1564 REAL(kind=dp), DIMENSION(:), INTENT(IN) :: eigenvalues
1565 INTEGER, INTENT(IN) :: nstates
1566 REAL(kind=dp), INTENT(IN) :: de
1567 INTEGER, INTENT(IN) :: broaden_type
1568 REAL(kind=dp), INTENT(IN) :: broaden_width, voigt_mixing
1569 INTEGER, INTENT(IN) :: ndigits
1570 CHARACTER(LEN=*), INTENT(IN), OPTIONAL :: pdos_print_key
1571
1572 INTEGER :: i, icomp, imo, ncomponents, nhist
1573 REAL(kind=dp) :: cutoff, emax, emin, eval, line_shape
1574 REAL(kind=dp), ALLOCATABLE, DIMENSION(:, :) :: pdos_curve
1575
1576 IF (broaden_width <= 0.0_dp) RETURN
1577
1578 ncomponents = SIZE(weights, 1)
1579 cutoff = broadening_cutoff(broaden_type, broaden_width)
1580 emin = minval(eigenvalues(1:nstates)) - cutoff
1581 emax = maxval(eigenvalues(1:nstates)) + cutoff
1582 nhist = nint((emax - emin)/de) + 1
1583 ALLOCATE (pdos_curve(nhist, ncomponents))
1584 pdos_curve = 0.0_dp
1585
1586 DO imo = 1, nstates
1587 DO i = max(1, floor((eigenvalues(imo) - cutoff - emin)/de) + 1), &
1588 min(nhist, ceiling((eigenvalues(imo) + cutoff - emin)/de) + 1)
1589 eval = emin + (i - 1)*de
1590 line_shape = broadening_function(eval - eigenvalues(imo), broaden_type, broaden_width, &
1591 voigt_mixing)
1592 DO icomp = 1, ncomponents
1593 pdos_curve(i, icomp) = pdos_curve(i, icomp) + weights(icomp, imo)*line_shape
1594 END DO
1595 END DO
1596 END DO
1597
1598 CALL write_broadened_pdos_curve(logger, dft_section, middle_name, file_position, file_action, &
1599 iterstep, e_fermi, hoco, energy_ref, zero_label, title, maxl, separate_components, &
1600 pdos_curve, emin, de, broaden_type, broaden_width, &
1601 voigt_mixing, ndigits, pdos_print_key=pdos_print_key)
1602
1603 DEALLOCATE (pdos_curve)
1604
1605 END SUBROUTINE write_broadened_pdos
1606
1607END MODULE qs_pdos
static GRID_HOST_DEVICE int modulo(int a, int m)
Equivalent of Fortran's MODULO, which always return a positive number. https://gcc....
Define the atomic kind types and their sub types.
subroutine, public get_atomic_kind_set(atomic_kind_set, atom_of_kind, kind_of, natom_of_kind, maxatom, natom, nshell, fist_potential_present, shell_present, shell_adiabatic, shell_check_distance, damping_present)
Get attributes of an atomic kind set.
subroutine, public get_atomic_kind(atomic_kind, fist_potential, element_symbol, name, mass, kind_number, natom, atom_list, rcov, rvdw, z, qeff, apol, cpol, mm_radius, shell, shell_active, damping)
Get attributes of an atomic kind.
subroutine, public get_gto_basis_set(gto_basis_set, name, aliases, norm_type, kind_radius, ncgf, nset, nsgf, cgf_symbol, sgf_symbol, norm_cgf, set_radius, lmax, lmin, lx, ly, lz, m, ncgf_set, npgf, nsgf_set, nshell, cphi, pgf_radius, sphi, scon, zet, first_cgf, first_sgf, l, last_cgf, last_sgf, n, gcc, maxco, maxl, maxpgf, maxsgf_set, maxshell, maxso, nco_sum, npgf_sum, nshell_sum, maxder, short_kind_radius, npgf_seg_sum, ccon)
...
Handles all functions related to the CELL.
Definition cell_types.F:15
various utilities that regard array of different kinds: output, allocation,... maybe it is not a good...
methods related to the blacs parallel environment
Represents a complex full matrix distributed on many processors.
subroutine, public cp_cfm_get_submatrix(fm, target_m, start_row, start_col, n_rows, n_cols, transpose)
Extract a sub-matrix from the full matrix: op(target_m)(1:n_rows,1:n_cols) = fm(start_row:start_row+n...
subroutine, public cp_cfm_release(matrix)
Releases a full matrix.
subroutine, public cp_cfm_create(matrix, matrix_struct, name, nrow, ncol, set_zero)
Creates a new full matrix with the given structure.
Defines control structures, which contain the parameters and the settings for the DFT-based calculati...
DBCSR operations in CP2K.
subroutine, public copy_dbcsr_to_fm(matrix, fm)
Copy a DBCSR matrix to a BLACS matrix.
used for collecting some of the diagonalization schemes available for cp_fm_type. cp_fm_power also mo...
Definition cp_fm_diag.F:17
subroutine, public cp_fm_power(matrix, work, exponent, threshold, n_dependent, verbose, eigvals)
...
represent the structure of a full matrix
subroutine, public cp_fm_struct_create(fmstruct, para_env, context, nrow_global, ncol_global, nrow_block, ncol_block, descriptor, first_p_pos, local_leading_dimension, template_fmstruct, square_blocks, force_block)
allocates and initializes a full matrix structure
subroutine, public cp_fm_struct_release(fmstruct)
releases a full matrix structure
represent a full matrix distributed on many processors
Definition cp_fm_types.F:15
subroutine, public cp_fm_get_info(matrix, name, nrow_global, ncol_global, nrow_block, ncol_block, nrow_local, ncol_local, row_indices, col_indices, local_data, context, nrow_locals, ncol_locals, matrix_struct, para_env)
returns all kind of information about the full matrix
subroutine, public cp_fm_create(matrix, matrix_struct, name, nrow, ncol, set_zero)
creates a new full matrix with the given structure
subroutine, public cp_fm_get_submatrix(fm, target_m, start_row, start_col, n_rows, n_cols, transpose)
gets a submatrix of a full matrix op(target_m)(1:n_rows,1:n_cols) =fm(start_row:start_row+n_rows,...
various routines to log and control the output. The idea is that decisions about where to log should ...
integer function, public cp_logger_get_default_io_unit(logger)
returns the unit nr for the ionode (-1 on all other processors) skips as well checks if the procs cal...
type(cp_logger_type) function, pointer, public cp_get_default_logger()
returns the default logger
routines to handle the output, The idea is to remove the decision of wheter to output and what to out...
integer function, public cp_print_key_unit_nr(logger, basis_section, print_key_path, extension, middle_name, local, log_filename, ignore_should_output, file_form, file_position, file_action, file_status, do_backup, on_file, is_new_file, mpi_io, fout)
...
subroutine, public cp_print_key_finished_output(unit_nr, logger, basis_section, print_key_path, local, ignore_should_output, on_file, mpi_io)
should be called after you finish working with a unit obtained with cp_print_key_unit_nr,...
integer, parameter, public cp_p_file
integer function, public cp_print_key_should_output(iteration_info, basis_section, print_key_path, used_print_key, first_time)
returns what should be done with the given property if btest(res,cp_p_store) then the property should...
objects that represent the structure of input sections and the data contained in an input section
recursive type(section_vals_type) function, pointer, public section_vals_get_subs_vals(section_vals, subsection_name, i_rep_section, can_return_null)
returns the values of the requested subsection
subroutine, public section_vals_get(section_vals, ref_count, n_repetition, n_subs_vals_rep, section, explicit)
returns various attributes about the section_vals
subroutine, public section_vals_val_get(section_vals, keyword_name, i_rep_section, i_rep_val, n_rep_val, val, l_val, i_val, r_val, c_val, l_vals, i_vals, r_vals, c_vals, explicit)
returns the requested value
Defines the basic variable types.
Definition kinds.F:23
integer, parameter, public dp
Definition kinds.F:34
integer, parameter, public default_string_length
Definition kinds.F:57
Routines needed for kpoint calculation.
subroutine, public lowdin_kp_mo_coeff(kp, ispin, use_real_wfn, shalfc, cshalfc)
Calculate S(k)^1/2 C(k) for real or complex k-point wavefunctions.
Types and basic routines needed for a kpoint calculation.
An array-based list which grows on demand. When the internal array is full, a new array of twice the ...
Definition list.F:24
Utility routines for the memory handling.
Interface to the message passing library MPI.
Provides Cartesian and spherical orbital pointers and indices.
integer, dimension(:), allocatable, public nsoset
integer, dimension(:), allocatable, public nso
orbital_symbols
character(len=6) function, public sgf_symbol(n, l, m)
Build a spherical orbital symbol (orbital labels for printing).
character(len=1), dimension(0:11), parameter, public l_sym
basic linear algebra operations for full matrixes
Define the data structure for the particle information.
container for various plainwaves related things
subroutine, public pw_env_get(pw_env, pw_pools, cube_info, gridlevel_info, auxbas_pw_pool, auxbas_grid, auxbas_rs_desc, auxbas_rs_grid, rs_descs, rs_grids, xc_pw_pool, vdw_pw_pool, poisson_env, interp_section)
returns the various attributes of the pw env
Manages a pool of grids (to be used for example as tmp objects), but can also be used to instantiate ...
Calculate the plane wave density by collocating the primitive Gaussian functions (pgf).
subroutine, public calculate_wavefunction(mo_vectors, ivector, rho, rho_gspace, atomic_kind_set, qs_kind_set, cell, dft_control, particle_set, pw_env, basis_type)
maps a given wavefunction on the grid
Utilities for broadened DOS and PDOS output.
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
pure real(kind=dp) function, public broadening_cutoff(broaden_type, broaden_width)
Broadening cutoff used for numerical accumulation.
real(kind=dp) function, public dos_density_scale(energy_unit)
Return the DOS-density conversion factor for the selected energy unit.
character(len=16) function, public dos_energy_zero_label(energy_zero)
Return the label for the selected DOS energy zero.
subroutine, public get_qs_env(qs_env, atomic_kind_set, qs_kind_set, cell, super_cell, cell_ref, use_ref_cell, kpoints, dft_control, mos, sab_orb, sab_all, qmmm, qmmm_periodic, mimic, sac_ae, sac_ppl, sac_lri, sap_ppnl, sab_vdw, sab_scp, sap_oce, sab_lrc, sab_se, sab_xtbe, sab_tbe, sab_core, sab_xb, sab_xtb_pp, sab_xtb_nonbond, sab_almo, sab_kp, sab_kp_nosym, sab_cneo, particle_set, energy, force, matrix_h, matrix_h_im, matrix_ks, matrix_ks_im, matrix_vxc, run_rtp, rtp, matrix_h_kp, matrix_h_im_kp, matrix_ks_kp, matrix_ks_im_kp, matrix_vxc_kp, kinetic_kp, matrix_s_kp, matrix_w_kp, matrix_s_ri_aux_kp, matrix_s, matrix_s_ri_aux, matrix_w, matrix_p_mp2, matrix_p_mp2_admm, rho, rho_xc, pw_env, ewald_env, ewald_pw, active_space, mpools, input, para_env, blacs_env, scf_control, rel_control, kinetic, qs_charges, vppl, xcint_weights, rho_core, rho_nlcc, rho_nlcc_g, ks_env, ks_qmmm_env, wf_history, scf_env, local_particles, local_molecules, distribution_2d, dbcsr_dist, molecule_kind_set, molecule_set, subsys, cp_subsys, oce, local_rho_set, rho_atom_set, task_list, task_list_soft, rho0_atom_set, rho0_mpole, rhoz_set, rhoz_cneo_set, ecoul_1c, rho0_s_rs, rho0_s_gs, rhoz_cneo_s_rs, rhoz_cneo_s_gs, do_kpoints, has_unit_metric, requires_mo_derivs, mo_derivs, mo_loc_history, nkind, natom, nelectron_total, nelectron_spin, efield, neighbor_list_id, linres_control, xas_env, virial, cp_ddapc_env, cp_ddapc_ewald, outer_scf_history, outer_scf_ihistory, x_data, et_coupling, dftb_potential, results, se_taper, se_store_int_env, se_nddo_mpole, se_nonbond_env, admm_env, lri_env, lri_density, exstate_env, ec_env, harris_env, dispersion_env, gcp_env, vee, rho_external, external_vxc, mask, mp2_env, bs_env, kg_env, wanniercentres, atprop, ls_scf_env, do_transport, transport_env, v_hartree_rspace, s_mstruct_changed, rho_changed, potential_changed, forces_up_to_date, mscfg_env, almo_scf_env, gradient_history, variable_history, embed_pot, spin_embed_pot, polar_env, mos_last_converged, eeq, rhs, do_rixs, tb_tblite)
Get the QUICKSTEP environment.
Define the quickstep kind type and their sub types.
subroutine, public get_qs_kind(qs_kind, basis_set, basis_type, ncgf, nsgf, all_potential, tnadd_potential, gth_potential, sgp_potential, upf_potential, cneo_potential, se_parameter, dftb_parameter, xtb_parameter, dftb3_param, zatom, zeff, elec_conf, mao, lmax_dftb, alpha_core_charge, ccore_charge, core_charge, core_charge_radius, paw_proj_set, paw_atom, hard_radius, hard0_radius, max_rad_local, covalent_radius, vdw_radius, gpw_type_forced, harmonics, max_iso_not0, max_s_harm, grid_atom, ngrid_ang, ngrid_rad, lmax_rho0, dft_plus_u_atom, l_of_dft_plus_u, n_of_dft_plus_u, u_minus_j, u_of_dft_plus_u, j_of_dft_plus_u, alpha_of_dft_plus_u, beta_of_dft_plus_u, j0_of_dft_plus_u, occupation_of_dft_plus_u, dispersion, bs_occupation, magnetization, no_optimize, addel, laddel, naddel, orbitals, max_scf, eps_scf, smear, u_ramping, u_minus_j_target, eps_u_ramping, init_u_ramping_each_scf, reltmat, ghost, monovalent, floating, name, element_symbol, pao_basis_size, pao_model_file, pao_potentials, pao_descriptors, nelec)
Get attributes of an atomic kind.
subroutine, public get_qs_kind_set(qs_kind_set, all_potential_present, tnadd_potential_present, gth_potential_present, sgp_potential_present, paw_atom_present, dft_plus_u_atom_present, maxcgf, maxsgf, maxco, maxco_proj, maxgtops, maxlgto, maxlprj, maxnset, maxsgf_set, ncgf, npgf, nset, nsgf, nshell, maxpol, maxlppl, maxlppnl, maxppnl, nelectron, maxder, max_ngrid_rad, max_sph_harm, maxg_iso_not0, lmax_rho0, basis_rcut, basis_type, total_zeff_corr, npgf_seg, cneo_potential_present, nkind_q, natom_q)
Get attributes of an atomic kind set.
Definition and initialisation of the mo data type.
Definition qs_mo_types.F:22
subroutine, public get_mo_set(mo_set, maxocc, homo, lfomo, nao, nelectron, n_el_f, nmo, eigenvalues, occupation_numbers, mo_coeff, mo_coeff_b, uniform_occupation, kts, mu, flexible_electron_count)
Get the components of a MO set data structure.
Calculation and writing of projected density of states The DOS is computed per angular momentum and p...
Definition qs_pdos.F:15
subroutine, public calculate_projected_dos_kp(qs_env, dft_section, pdos_print_key, write_pdos, write_pdos_raw)
Compute and write broadened projected density of states for k-point calculations.
Definition qs_pdos.F:1040
subroutine, public calculate_projected_dos(mo_set, atomic_kind_set, qs_kind_set, particle_set, qs_env, dft_section, ispin, xas_mittle, external_matrix_shalf, unoccupied_orbs, unoccupied_evals, pdos_print_key, write_pdos, write_pdos_raw)
Compute and write projected density of states.
Definition qs_pdos.F:155
Different diagonalization schemes that can be used for the iterative solution of the eigenvalue probl...
subroutine, public diag_kp_smat(matrix_s, kpoints, fmwork)
Kpoint diagonalization routine Transforms matrices to kpoint, distributes kpoint groups,...
module that contains the definitions of the scf types
Provides all information about an atomic kind.
Type defining parameters related to the simulation cell.
Definition cell_types.F:60
represent a pointer to a 1d array
represent a blacs multidimensional parallel environment (for the mpi corrispective see cp_paratypes/m...
Represent a complex full matrix.
keeps the information about the structure of a full matrix
represent a full matrix
type of a logger, at the moment it contains just a print level starting at which level it should be l...
Keeps information about a specific k-point.
Contains information about kpoints.
stores all the informations relevant to an mpi environment
contained for different pw related things
to create arrays of pools
Manages a pool of grids (to be used for example as tmp objects), but can also be used to instantiate ...
Provides all information about a quickstep kind.