(git:e8d1ac1)
Loading...
Searching...
No Matches
kpoint_mo_dump.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 K-point MO wavefunction dump to TEXT file for post-processing (PDOS, etc.)
10!> \par History
11!> 2026.02 created
12! **************************************************************************************************
13
15
19 USE cell_types, ONLY: cell_type
22 USE cp_dbcsr_api, ONLY: &
24 dbcsr_type, dbcsr_type_antisymmetric, dbcsr_type_no_symmetry, dbcsr_type_symmetric
30 USE cp_fm_types, ONLY: cp_fm_create,&
41 USE kinds, ONLY: dp
43 USE kpoint_types, ONLY: get_kpoint_info,&
46 USE mathconstants, ONLY: pi
50 USE physcon, ONLY: angstrom
53 USE qs_kind_types, ONLY: get_qs_kind,&
56 USE qs_mo_types, ONLY: get_mo_set,&
59#include "./base/base_uses.f90"
60
61 IMPLICIT NONE
62 PRIVATE
63
64 PUBLIC :: write_kpoint_mo_data
65
66 ! Enum values for OVERLAP_EXPORT_TYPE keyword
67 INTEGER, PARAMETER, PUBLIC :: mokp_overlap_gto = 1, &
69
70 CHARACTER(len=*), PARAMETER, PRIVATE :: modulen = 'kpoint_mo_dump'
71
72CONTAINS
73
74! **************************************************************************************************
75!> \brief Write k-point resolved MO data to formatted text file.
76!>
77!> The output file contains, for each k-point:
78!> - Eigenvalues and occupations
79!> - MO coefficient matrix C(k) (real and imaginary parts)
80!> - Overlap matrix S(k) (if OVERLAP_EXPORT_TYPE = MATRIX)
81!> Plus a header with cell, atom info, and either GTO basis set definition
82!> (OVERLAP_EXPORT_TYPE = GTO) or AO angular momentum map (OVERLAP_EXPORT_TYPE = MATRIX).
83!>
84!> Parallel strategy:
85!> MO coefficients: cp_fm_get_submatrix (collective on kp-group),
86!> then para_env_inter_kp%sum to collect across groups.
87!> S(k): Built on global communicator using rskp_transform,
88!> then copy_dbcsr_to_fm + cp_fm_get_submatrix.
89!> File write: Only on ionode (cp_print_key_unit_nr returns -1 elsewhere).
90!>
91!> \param qs_env the QS environment (after converged SCF with k-points)
92!> \param print_section the &MO_KP print key section (contains NDIGITS, OVERLAP_EXPORT_TYPE)
93! **************************************************************************************************
94 SUBROUTINE write_kpoint_mo_data(qs_env, print_section)
95 TYPE(qs_environment_type), POINTER :: qs_env
96 TYPE(section_vals_type), POINTER :: print_section
97
98 CHARACTER(len=*), PARAMETER :: routinen = 'write_kpoint_mo_data'
99 CHARACTER(LEN=6), PARAMETER :: angmom = "spdfgh"
100
101 CHARACTER(LEN=2) :: element_symbol
102 CHARACTER(LEN=20) :: fmtstr_gto, fmtstr_sparse, fmtstr_vec
103 INTEGER :: handle, i, iatom, ikind, ikp, ikp_loc, ipgf, iset, isgf_global, ishell, ispin, &
104 iw, j, lshell, n, nao, natom, ndigits, nkp, nmo, nset_atom, nspins, output_unit, &
105 overlap_data, unit_choice
106 INTEGER, ALLOCATABLE, DIMENSION(:) :: ao_l, first_sgf, last_sgf
107 INTEGER, DIMENSION(2) :: kp_range
108 INTEGER, DIMENSION(:), POINTER :: npgf_set, nshell_set
109 INTEGER, DIMENSION(:, :), POINTER :: first_sgf_set, l_set, last_sgf_set
110 INTEGER, DIMENSION(:, :, :), POINTER :: cell_to_index
111 LOGICAL :: use_real_wfn, write_overlap
112 REAL(kind=dp) :: expzet, prefac, scale_factor, thresh, &
113 zeff
114 REAL(kind=dp), ALLOCATABLE, DIMENSION(:) :: eval_buf, occ_buf
115 REAL(kind=dp), ALLOCATABLE, DIMENSION(:, :) :: cim_buf, cre_buf, sim_buf, sre_buf
116 REAL(kind=dp), DIMENSION(:), POINTER :: eigenvalues, occupation_numbers, wkp
117 REAL(kind=dp), DIMENSION(:, :), POINTER :: xkp, zet
118 REAL(kind=dp), DIMENSION(:, :, :), POINTER :: gcc
119 TYPE(cell_type), POINTER :: cell
120 TYPE(cp_blacs_env_type), POINTER :: blacs_env_global
121 TYPE(cp_fm_struct_type), POINTER :: fm_struct_s
122 TYPE(cp_fm_type) :: fm_s_global
123 TYPE(cp_fm_type), POINTER :: mo_coeff_im, mo_coeff_re
124 TYPE(cp_logger_type), POINTER :: logger
125 TYPE(dbcsr_p_type), DIMENSION(:, :), POINTER :: matrix_s
126 TYPE(dbcsr_type), POINTER :: cmatrix, rmatrix, tmpmat
127 TYPE(dft_control_type), POINTER :: dft_control
128 TYPE(gto_basis_set_type), POINTER :: orb_basis_set
129 TYPE(kpoint_env_type), POINTER :: kp
130 TYPE(kpoint_type), POINTER :: kpoints
131 TYPE(mo_set_type), DIMENSION(:, :), POINTER :: mos_kp
132 TYPE(mp_para_env_type), POINTER :: para_env_global, para_env_inter_kp
133 TYPE(neighbor_list_set_p_type), DIMENSION(:), &
134 POINTER :: sab_nl
135 TYPE(particle_type), DIMENSION(:), POINTER :: particle_set
136 TYPE(qs_kind_type), DIMENSION(:), POINTER :: qs_kind_set
137
138 CALL timeset(routinen, handle)
139
140 logger => cp_get_default_logger()
141 output_unit = cp_logger_get_default_io_unit(logger)
142
143 ! ================================================================
144 ! Gather all required data from qs_env
145 ! ================================================================
146 NULLIFY (cell, dft_control, kpoints, particle_set, qs_kind_set, matrix_s, &
147 sab_nl, para_env_global, blacs_env_global)
148
149 CALL get_qs_env(qs_env, &
150 cell=cell, &
151 dft_control=dft_control, &
152 kpoints=kpoints, &
153 particle_set=particle_set, &
154 qs_kind_set=qs_kind_set, &
155 matrix_s_kp=matrix_s, &
156 para_env=para_env_global, &
157 blacs_env=blacs_env_global)
158
159 nspins = dft_control%nspins
160 natom = SIZE(particle_set)
161
162 CALL get_kpoint_info(kpoints, nkp=nkp, xkp=xkp, wkp=wkp, &
163 use_real_wfn=use_real_wfn, kp_range=kp_range, &
164 sab_nl=sab_nl, cell_to_index=cell_to_index, &
165 para_env_inter_kp=para_env_inter_kp)
166 cpassert(ASSOCIATED(sab_nl))
167
168 ! Total number of AOs and MOs
169 CALL get_qs_kind_set(qs_kind_set, nsgf=nao)
170
171 nmo = 0
172 IF (SIZE(kpoints%kp_env) > 0) THEN
173 mos_kp => kpoints%kp_env(1)%kpoint_env%mos
174 CALL get_mo_set(mo_set=mos_kp(1, 1), nmo=nmo)
175 END IF
176 CALL para_env_inter_kp%max(nmo)
177
178 IF (output_unit > 0) THEN
179 WRITE (output_unit, '(/,T3,A)') "KPOINT_MO_DUMP| Writing k-point wavefunction data"
180 WRITE (output_unit, '(T3,A,I6,A,I6,A,I6,A,I4)') &
181 "KPOINT_MO_DUMP| nao=", nao, " nmo=", nmo, " nkp=", nkp, " nspins=", nspins
182 END IF
183
184 ! ================================================================
185 ! Read keywords
186 ! ================================================================
187 CALL section_vals_val_get(print_section, "UNIT", i_val=unit_choice)
188 IF (unit_choice == 2) THEN
189 scale_factor = angstrom
190 ELSE
191 scale_factor = 1.0_dp
192 END IF
193 CALL section_vals_val_get(print_section, "NDIGITS", i_val=ndigits)
194 ndigits = min(max(3, ndigits), 30)
195 CALL section_vals_val_get(print_section, "OVERLAP_EXPORT_TYPE", i_val=overlap_data)
196 write_overlap = (overlap_data == mokp_overlap_matrix)
197
198 ! Build format strings controlled by NDIGITS
199 WRITE (unit=fmtstr_sparse, fmt='("(2I6,1X,ES",I0,".",I0,")")') ndigits + 10, ndigits
200 WRITE (unit=fmtstr_vec, fmt='("(5ES",I0,".",I0,")")') ndigits + 10, ndigits
201 WRITE (unit=fmtstr_gto, fmt='("(2ES",I0,".",I0,")")') ndigits + 10, ndigits
202 thresh = 10.0_dp**(-ndigits)
203
204 ! ================================================================
205 ! Build atom-to-AO mapping
206 ! ================================================================
207 ALLOCATE (first_sgf(natom), last_sgf(natom))
208 CALL get_particle_set(particle_set, qs_kind_set, &
209 first_sgf=first_sgf, last_sgf=last_sgf)
210
211 ! AO angular momentum map: only needed when overlap is written explicitly,
212 ! since in GTO mode l info is derivable from the basis set definition.
213 IF (write_overlap) THEN
214 ALLOCATE (ao_l(nao))
215 ao_l(:) = -1
216 DO iatom = 1, natom
217 ikind = particle_set(iatom)%atomic_kind%kind_number
218 CALL get_qs_kind(qs_kind_set(ikind), basis_set=orb_basis_set)
219 CALL get_gto_basis_set(orb_basis_set, nset=nset_atom, &
220 nshell=nshell_set, l=l_set, &
221 first_sgf=first_sgf_set, last_sgf=last_sgf_set)
222 DO iset = 1, nset_atom
223 DO ishell = 1, nshell_set(iset)
224 lshell = l_set(ishell, iset)
225 DO i = first_sgf_set(ishell, iset), last_sgf_set(ishell, iset)
226 isgf_global = first_sgf(iatom) - 1 + i
227 ao_l(isgf_global) = lshell
228 END DO
229 END DO
230 END DO
231 END DO
232 END IF
233
234 ! ================================================================
235 ! Allocate work buffers
236 ! ================================================================
237 ALLOCATE (cre_buf(nao, nmo), cim_buf(nao, nmo))
238 ALLOCATE (eval_buf(nmo), occ_buf(nmo))
239
240 ! S(k) infrastructure: only needed in MATRIX mode
241 IF (write_overlap) THEN
242 ALLOCATE (sre_buf(nao, nao), sim_buf(nao, nao))
243
244 ALLOCATE (rmatrix, cmatrix, tmpmat)
245 CALL dbcsr_create(rmatrix, template=matrix_s(1, 1)%matrix, &
246 matrix_type=dbcsr_type_symmetric)
247 CALL dbcsr_create(cmatrix, template=matrix_s(1, 1)%matrix, &
248 matrix_type=dbcsr_type_antisymmetric)
249 CALL dbcsr_create(tmpmat, template=matrix_s(1, 1)%matrix, &
250 matrix_type=dbcsr_type_no_symmetry)
251 CALL cp_dbcsr_alloc_block_from_nbl(rmatrix, sab_nl)
252 CALL cp_dbcsr_alloc_block_from_nbl(cmatrix, sab_nl)
253
254 NULLIFY (fm_struct_s)
255 CALL cp_fm_struct_create(fm_struct_s, context=blacs_env_global, &
256 nrow_global=nao, ncol_global=nao, &
257 para_env=para_env_global)
258 CALL cp_fm_create(fm_s_global, fm_struct_s, name="S(k) work")
259 CALL cp_fm_struct_release(fm_struct_s)
260 END IF
261
262 ! ================================================================
263 ! Open output file via print key
264 ! ================================================================
265 iw = cp_print_key_unit_nr(logger, print_section, "", &
266 extension=".mokp", file_status="REPLACE")
267
268 ! ================================================================
269 ! WRITE HEADER
270 ! ================================================================
271 IF (iw > 0) THEN
272 WRITE (iw, '(A)') "# CP2K_KPOINT_MO_DUMP, Version 1.1"
273 IF (write_overlap) THEN
274 WRITE (iw, '(A)') "# EXPORT_MODE: Coefficients + Overlap matrices"
275 ELSE
276 WRITE (iw, '(A)') "# EXPORT_MODE: GTO + Coefficients"
277 END IF
278 IF (unit_choice == 2) THEN
279 WRITE (iw, '(A)') "# All energies in Hartree, lengths in Angstrom, k-points in fractional coords"
280 WRITE (iw, '(A)') "# CELL_VECTORS [Angstrom]"
281 ELSE
282 WRITE (iw, '(A)') "# All energies in Hartree, lengths in Bohr, k-points in fractional coords"
283 WRITE (iw, '(A)') "# CELL_VECTORS [Bohr]"
284 END IF
285 WRITE (iw, '(3(F12.6,3X))') &
286 cell%hmat(1, 1)*scale_factor, cell%hmat(2, 1)*scale_factor, cell%hmat(3, 1)*scale_factor
287 WRITE (iw, '(3(F12.6,3X))') &
288 cell%hmat(1, 2)*scale_factor, cell%hmat(2, 2)*scale_factor, cell%hmat(3, 2)*scale_factor
289 WRITE (iw, '(3(F12.6,3X))') &
290 cell%hmat(1, 3)*scale_factor, cell%hmat(2, 3)*scale_factor, cell%hmat(3, 3)*scale_factor
291
292 WRITE (iw, '(A,4I8)') "# DIMENSIONS: natom nspins nao nkp =", natom, nspins, nao, nkp
293 WRITE (iw, '(A,I8)') "# NMO =", nmo
294 WRITE (iw, '(A,L2)') "# USE_REAL_WFN =", use_real_wfn
295 IF (write_overlap) THEN
296 WRITE (iw, '(A)') "# OVERLAP_EXPORT_TYPE = MATRIX"
297 ELSE
298 WRITE (iw, '(A)') "# OVERLAP_EXPORT_TYPE = GTO"
299 END IF
300
301 ! Atom table
302 IF (unit_choice == 2) THEN
303 WRITE (iw, '(A)') &
304 "# ATOM_LIST: Atom_ID Element Z_eff X [Ang] Y [Ang] Z [Ang] First_AO Last_AO"
305 ELSE
306 WRITE (iw, '(A)') &
307 "# ATOM_LIST: Atom_ID Element Z_eff X [Bohr] Y [Bohr] Z [Bohr] First_AO Last_AO"
308 END IF
309 DO iatom = 1, natom
310 ikind = particle_set(iatom)%atomic_kind%kind_number
311 CALL get_atomic_kind(atomic_kind=particle_set(iatom)%atomic_kind, &
312 element_symbol=element_symbol)
313 CALL get_qs_kind(qs_kind_set(ikind), zeff=zeff)
314 WRITE (iw, '(I6,2X,A2,I6,3F15.6,2I10)') &
315 iatom, element_symbol, nint(zeff), particle_set(iatom)%r(:)*scale_factor, &
316 first_sgf(iatom), last_sgf(iatom)
317 END DO
318
319 ! K-point list
320 WRITE (iw, '(A)') "# KPOINT_LIST: ikp kx ky kz weight"
321 DO ikp = 1, nkp
322 WRITE (iw, '(I6,4ES18.8)') ikp, xkp(1:3, ikp), wkp(ikp)
323 END DO
324
325 IF (write_overlap) THEN
326 ! MATRIX mode: write AO angular momentum map (needed since no GTO info)
327 WRITE (iw, '(A)') "# AO_L_MAP: iao l (1-based)"
328 DO i = 1, nao
329 WRITE (iw, '(2I6)') i, ao_l(i)
330 END DO
331 ELSE
332 ! GTO mode: write basis set definition
333 ! Contraction coefficients denormalized to MOLDEN convention
334 ! (i.e. for raw unnormalized primitive Gaussians).
335 ! Shell angular momentum ordering: spherical harmonics,
336 ! CP2K convention m = -l, -l+1, ..., 0, ..., +l
337 WRITE (iw, '(A)') "# GTO_BASIS (spherical, MOLDEN convention for contraction coefficients)"
338 DO iatom = 1, natom
339 ikind = particle_set(iatom)%atomic_kind%kind_number
340 CALL get_qs_kind(qs_kind_set(ikind), basis_set=orb_basis_set)
341 IF (ASSOCIATED(orb_basis_set)) THEN
342 WRITE (iw, '(I6,I4)') iatom, 0
343 CALL get_gto_basis_set(gto_basis_set=orb_basis_set, &
344 nset=nset_atom, npgf=npgf_set, &
345 nshell=nshell_set, l=l_set, &
346 zet=zet, gcc=gcc)
347 DO iset = 1, nset_atom
348 DO ishell = 1, nshell_set(iset)
349 lshell = l_set(ishell, iset)
350 IF (lshell + 1 > len(angmom)) THEN
351 cpwarn("MOKP: Angular momentum l > 5 not supported in GTO output, skipping")
352 cycle
353 END IF
354 WRITE (iw, '(A2,I6,F8.2)') &
355 angmom(lshell + 1:lshell + 1)//" ", npgf_set(iset), 1.0_dp
356 ! Denormalize gcc: undo CP2K's internal normalization
357 ! (same formula as molden_utils.F, reverse of normalise_gcc_orb)
358 prefac = 2.0_dp**lshell*(2.0_dp/pi)**0.75_dp
359 expzet = 0.25_dp*(2*lshell + 3.0_dp)
360 DO ipgf = 1, npgf_set(iset)
361 WRITE (iw, fmtstr_gto) &
362 zet(ipgf, iset), &
363 gcc(ipgf, ishell, iset)/(prefac*zet(ipgf, iset)**expzet)
364 END DO
365 END DO
366 END DO
367 WRITE (iw, '(A)') ""
368 END IF
369 END DO
370 END IF
371 END IF
372
373 ! ================================================================
374 ! WRITE PER-KPOINT DATA
375 ! ================================================================
376 DO ikp = 1, nkp
377
378 ! ==============================================================
379 ! A) MO coefficients, eigenvalues, occupations (per spin)
380 ! ==============================================================
381 DO ispin = 1, nspins
382
383 cre_buf(:, :) = 0.0_dp
384 cim_buf(:, :) = 0.0_dp
385 eval_buf(:) = 0.0_dp
386 occ_buf(:) = 0.0_dp
387
388 IF (ikp >= kp_range(1) .AND. ikp <= kp_range(2)) THEN
389 ikp_loc = ikp - kp_range(1) + 1
390 kp => kpoints%kp_env(ikp_loc)%kpoint_env
391 mos_kp => kp%mos
392
393 CALL get_mo_set(mos_kp(1, ispin), &
394 eigenvalues=eigenvalues, &
395 occupation_numbers=occupation_numbers)
396 eval_buf(1:nmo) = eigenvalues(1:nmo)
397 occ_buf(1:nmo) = occupation_numbers(1:nmo)
398
399 CALL get_mo_set(mos_kp(1, ispin), mo_coeff=mo_coeff_re)
400 CALL cp_fm_get_submatrix(mo_coeff_re, cre_buf)
401
402 IF (.NOT. use_real_wfn) THEN
403 CALL get_mo_set(mos_kp(2, ispin), mo_coeff=mo_coeff_im)
404 CALL cp_fm_get_submatrix(mo_coeff_im, cim_buf)
405 END IF
406 END IF
407
408 CALL para_env_inter_kp%sum(eval_buf)
409 CALL para_env_inter_kp%sum(occ_buf)
410 CALL para_env_inter_kp%sum(cre_buf)
411 IF (.NOT. use_real_wfn) THEN
412 CALL para_env_inter_kp%sum(cim_buf)
413 END IF
414
415 IF (iw > 0) THEN
416 WRITE (iw, '(A,2I6)') "# BEGIN_KPOINT_SPIN ikp ispin =", ikp, ispin
417
418 WRITE (iw, '(A)') "# EIGENVALUES"
419 WRITE (iw, fmtstr_vec) (eval_buf(n), n=1, nmo)
420
421 WRITE (iw, '(A)') "# OCCUPATIONS"
422 WRITE (iw, fmtstr_vec) (occ_buf(n), n=1, nmo)
423
424 WRITE (iw, '(A)') "# MO_COEFF_RE (Sparse: i_mo j_ao value)"
425 DO i = 1, nmo
426 DO j = 1, nao
427 IF (abs(cre_buf(j, i)) >= thresh) THEN
428 WRITE (iw, fmtstr_sparse) i, j, cre_buf(j, i)
429 END IF
430 END DO
431 END DO
432
433 IF (.NOT. use_real_wfn) THEN
434 WRITE (iw, '(A)') "# MO_COEFF_IM (Sparse: i_mo j_ao value)"
435 DO i = 1, nmo
436 DO j = 1, nao
437 IF (abs(cim_buf(j, i)) >= thresh) THEN
438 WRITE (iw, fmtstr_sparse) i, j, cim_buf(j, i)
439 END IF
440 END DO
441 END DO
442 END IF
443 WRITE (iw, '(A,2I6)') "# END_KPOINT_SPIN ikp ispin =", ikp, ispin
444 END IF
445
446 END DO ! ispin
447
448 ! ==============================================================
449 ! B) Overlap matrix S(k) — only in MATRIX mode
450 ! ==============================================================
451 IF (write_overlap) THEN
452
453 CALL dbcsr_set(rmatrix, 0.0_dp)
454 IF (use_real_wfn) THEN
455 CALL rskp_transform(rmatrix=rmatrix, rsmat=matrix_s, ispin=1, &
456 xkp=xkp(1:3, ikp), cell_to_index=cell_to_index, &
457 sab_nl=sab_nl)
458 CALL dbcsr_desymmetrize(rmatrix, tmpmat)
459 CALL copy_dbcsr_to_fm(tmpmat, fm_s_global)
460 CALL cp_fm_get_submatrix(fm_s_global, sre_buf)
461 sim_buf(:, :) = 0.0_dp
462 ELSE
463 CALL dbcsr_set(cmatrix, 0.0_dp)
464 CALL rskp_transform(rmatrix=rmatrix, cmatrix=cmatrix, rsmat=matrix_s, &
465 ispin=1, xkp=xkp(1:3, ikp), &
466 cell_to_index=cell_to_index, sab_nl=sab_nl)
467 CALL dbcsr_desymmetrize(rmatrix, tmpmat)
468 CALL copy_dbcsr_to_fm(tmpmat, fm_s_global)
469 CALL cp_fm_get_submatrix(fm_s_global, sre_buf)
470 CALL dbcsr_desymmetrize(cmatrix, tmpmat)
471 CALL copy_dbcsr_to_fm(tmpmat, fm_s_global)
472 CALL cp_fm_get_submatrix(fm_s_global, sim_buf)
473 END IF
474
475 IF (iw > 0) THEN
476 WRITE (iw, '(A,I6)') "# BEGIN_OVERLAP ikp =", ikp
477
478 WRITE (iw, '(A)') "# OVERLAP_RE (Sparse: i_ao j_ao value)"
479 DO i = 1, nao
480 DO j = 1, nao
481 IF (abs(sre_buf(i, j)) >= thresh) THEN
482 WRITE (iw, fmtstr_sparse) i, j, sre_buf(i, j)
483 END IF
484 END DO
485 END DO
486 IF (.NOT. use_real_wfn) THEN
487 WRITE (iw, '(A)') "# OVERLAP_IM (Sparse: i_ao j_ao value)"
488 DO i = 1, nao
489 DO j = 1, nao
490 IF (abs(sim_buf(i, j)) >= thresh) THEN
491 WRITE (iw, fmtstr_sparse) i, j, sim_buf(i, j)
492 END IF
493 END DO
494 END DO
495 END IF
496 WRITE (iw, '(A,I6)') "# END_OVERLAP ikp =", ikp
497 END IF
498
499 END IF ! write_overlap
500
501 END DO ! ikp
502
503 ! ================================================================
504 ! Finalize
505 ! ================================================================
506 IF (iw > 0) THEN
507 WRITE (iw, '(A)') "# END_OF_FILE"
508 END IF
509
510 CALL cp_print_key_finished_output(iw, logger, print_section, "")
511
512 IF (output_unit > 0) THEN
513 WRITE (output_unit, '(T3,A)') &
514 "KPOINT_MO_DUMP| Data written to .mokp file"
515 END IF
516
517 ! Release work arrays
518 IF (write_overlap) THEN
519 CALL cp_fm_release(fm_s_global)
520 CALL dbcsr_deallocate_matrix(rmatrix)
521 CALL dbcsr_deallocate_matrix(cmatrix)
522 CALL dbcsr_deallocate_matrix(tmpmat)
523 DEALLOCATE (sre_buf, sim_buf)
524 DEALLOCATE (ao_l)
525 END IF
526 DEALLOCATE (cre_buf, cim_buf)
527 DEALLOCATE (eval_buf, occ_buf)
528 DEALLOCATE (first_sgf, last_sgf)
529
530 CALL timestop(handle)
531
532 END SUBROUTINE write_kpoint_mo_data
533
534END MODULE kpoint_mo_dump
Define the atomic kind types and their sub types.
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)
...
Handles all functions related to the CELL.
Definition cell_types.F:15
methods related to the blacs parallel environment
Defines control structures, which contain the parameters and the settings for the DFT-based calculati...
subroutine, public dbcsr_deallocate_matrix(matrix)
...
subroutine, public dbcsr_desymmetrize(matrix_a, matrix_b)
...
subroutine, public dbcsr_set(matrix, alpha)
...
DBCSR operations in CP2K.
subroutine, public copy_dbcsr_to_fm(matrix, fm)
Copy a DBCSR matrix to a BLACS matrix.
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_create(matrix, matrix_struct, name, use_sp, 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,...
objects that represent the structure of input sections and the data contained in an input section
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
Routines needed for kpoint calculation.
subroutine, public rskp_transform(rmatrix, cmatrix, rsmat, ispin, xkp, cell_to_index, sab_nl, is_complex, rs_sign)
Transformation of real space matrices to a kpoint.
K-point MO wavefunction dump to TEXT file for post-processing (PDOS, etc.)
integer, parameter, public mokp_overlap_gto
integer, parameter, public mokp_overlap_matrix
subroutine, public write_kpoint_mo_data(qs_env, print_section)
Write k-point resolved MO data to formatted text file.
Types and basic routines needed for a kpoint calculation.
subroutine, public get_kpoint_info(kpoint, kp_scheme, nkp_grid, kp_shift, symmetry, verbose, full_grid, use_real_wfn, eps_geo, parallel_group_size, kp_range, nkp, xkp, wkp, para_env, blacs_env_all, para_env_kp, para_env_inter_kp, blacs_env, kp_env, kp_aux_env, mpools, iogrp, nkp_groups, kp_dist, cell_to_index, index_to_cell, sab_nl, sab_nl_nosym)
Retrieve information from a kpoint environment.
Definition of mathematical constants and functions.
real(kind=dp), parameter, public pi
Interface to the message passing library MPI.
Define methods related to particle_type.
subroutine, public get_particle_set(particle_set, qs_kind_set, first_sgf, last_sgf, nsgf, nmao, basis)
Get the components of a particle set.
Define the data structure for the particle information.
Definition of physical constants:
Definition physcon.F:68
real(kind=dp), parameter, public angstrom
Definition physcon.F:144
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.
Define the neighbor list data types and the corresponding functionality.
Type defining parameters related to the simulation cell.
Definition cell_types.F:60
represent a blacs multidimensional parallel environment (for the mpi corrispective see cp_paratypes/m...
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
Provides all information about a quickstep kind.