(git:26ffdda)
Loading...
Searching...
No Matches
qs_scf_output.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
9 USE admm_types, ONLY: admm_type
14 USE cp_dbcsr_api, ONLY: dbcsr_p_type,&
24 USE cp_output_handling, ONLY: cp_p_file,&
29 USE input_constants, ONLY: &
42 USE kahan_sum, ONLY: accurate_sum
43 USE kinds, ONLY: default_string_length,&
44 dp
45 USE kpoint_types, ONLY: get_kpoint_info,&
47 USE machine, ONLY: m_flush
50 USE physcon, ONLY: evolt,&
53 USE ps_implicit_types, ONLY: mixed_bc,&
57 USE pw_env_types, ONLY: pw_env_type
72 USE qs_mo_types, ONLY: allocate_mo_set,&
78 USE qs_rho_types, ONLY: qs_rho_get,&
81 USE qs_scf_types, ONLY: ot_method_nr,&
85#include "./base/base_uses.f90"
86
87 IMPLICIT NONE
88
89 PRIVATE
90
91 CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'qs_scf_output'
92
93 PUBLIC :: qs_scf_loop_info, &
103
104CONTAINS
105
106! **************************************************************************************************
107!> \brief writes a summary of information after scf
108!> \param output_unit ...
109!> \param qs_env ...
110! **************************************************************************************************
111 SUBROUTINE qs_scf_print_summary(output_unit, qs_env)
112 INTEGER, INTENT(IN) :: output_unit
113 TYPE(qs_environment_type), POINTER :: qs_env
114
115 INTEGER :: nelectron_total
116 LOGICAL :: gapw, gapw_xc, qmmm
117 TYPE(dft_control_type), POINTER :: dft_control
118 TYPE(qs_charges_type), POINTER :: qs_charges
119 TYPE(qs_energy_type), POINTER :: energy
120 TYPE(qs_rho_type), POINTER :: rho
121 TYPE(qs_scf_env_type), POINTER :: scf_env
122
123 NULLIFY (rho, energy, dft_control, scf_env, qs_charges)
124 CALL get_qs_env(qs_env=qs_env, rho=rho, energy=energy, dft_control=dft_control, &
125 scf_env=scf_env, qs_charges=qs_charges)
126
127 gapw = dft_control%qs_control%gapw
128 gapw_xc = dft_control%qs_control%gapw_xc
129 qmmm = qs_env%qmmm
130 nelectron_total = scf_env%nelectron
131
132 CALL qs_scf_print_scf_summary(output_unit, rho, qs_charges, energy, nelectron_total, &
133 dft_control, qmmm, qs_env, gapw, gapw_xc)
134
135 END SUBROUTINE qs_scf_print_summary
136
137! **************************************************************************************************
138!> \brief writes basic information at the beginning of an scf run
139!> \param output_unit ...
140!> \param mos ...
141!> \param dft_control ...
142!> \param ndep ...
143! **************************************************************************************************
144 SUBROUTINE qs_scf_initial_info(output_unit, mos, dft_control, ndep)
145 INTEGER :: output_unit
146 TYPE(mo_set_type), DIMENSION(:), INTENT(IN) :: mos
147 TYPE(dft_control_type), POINTER :: dft_control
148 INTEGER, INTENT(IN) :: ndep
149
150 CHARACTER(LEN=*), PARAMETER :: routinen = 'qs_scf_initial_info'
151
152 INTEGER :: handle, homo, ispin, nao, &
153 nelectron_spin, nmo
154
155 CALL timeset(routinen, handle)
156
157 IF (output_unit > 0) THEN
158 DO ispin = 1, dft_control%nspins
159 CALL get_mo_set(mo_set=mos(ispin), &
160 homo=homo, &
161 nelectron=nelectron_spin, &
162 nao=nao, &
163 nmo=nmo)
164 IF (dft_control%nspins > 1) THEN
165 WRITE (unit=output_unit, fmt="(/,T2,A,I2)") "Spin", ispin
166 END IF
167 WRITE (unit=output_unit, fmt="(/,(T2,A,T71,I10))") &
168 "Number of electrons:", nelectron_spin, &
169 "Number of occupied orbitals:", homo, &
170 "Number of molecular orbitals:", nmo
171 END DO
172 WRITE (unit=output_unit, fmt="(/,(T2,A,T71,I10))") &
173 "Number of orbital functions:", nao, &
174 "Number of independent orbital functions:", nao - ndep
175 END IF
176
177 CALL timestop(handle)
178
179 END SUBROUTINE qs_scf_initial_info
180
181! **************************************************************************************************
182!> \brief Write the MO eigenvector, eigenvalues, and occupation numbers to the output unit
183!> \param qs_env ...
184!> \param scf_env ...
185!> \param final_mos ...
186!> \par History
187!> - Revise MO printout to enable eigenvalues with OT (05.05.2021, MK)
188! **************************************************************************************************
189 SUBROUTINE qs_scf_write_mos(qs_env, scf_env, final_mos)
190 TYPE(qs_environment_type), POINTER :: qs_env
191 TYPE(qs_scf_env_type), POINTER :: scf_env
192 LOGICAL, INTENT(IN) :: final_mos
193
194 CHARACTER(LEN=*), PARAMETER :: routinen = 'qs_scf_write_mos'
195
196 CHARACTER(LEN=2) :: solver_method
197 CHARACTER(LEN=3*default_string_length) :: message
198 CHARACTER(LEN=5) :: spin
199 CHARACTER(LEN=default_string_length), &
200 DIMENSION(:), POINTER :: tmpstringlist
201 INTEGER :: handle, homo, ikp, ikp_local, ispin, iw, &
202 nao, nelectron, nkp, nmo, nmo_occ, &
203 nspin, numo
204 INTEGER, DIMENSION(2) :: kp_range, nmos_occ
205 INTEGER, DIMENSION(:), POINTER :: mo_index_range
206 LOGICAL :: do_kpoints, do_printout, print_eigvals, &
207 print_eigvecs, print_mo_info, &
208 print_occup, print_occup_stats
209 REAL(kind=dp) :: flexible_electron_count, maxocc, n_el_f, &
210 occup_stats_occ_threshold
211 REAL(kind=dp), DIMENSION(:), POINTER :: mo_eigenvalues, umo_eigenvalues
212 TYPE(admm_type), POINTER :: admm_env
213 TYPE(cp_blacs_env_type), POINTER :: blacs_env
214 TYPE(cp_fm_struct_type), POINTER :: fm_struct_tmp
215 TYPE(cp_fm_type), POINTER :: mo_coeff, umo_coeff
216 TYPE(cp_logger_type), POINTER :: logger
217 TYPE(dbcsr_p_type), DIMENSION(:), POINTER :: ks, s
218 TYPE(dbcsr_type), POINTER :: matrix_ks, matrix_s, mo_coeff_deriv
219 TYPE(dft_control_type), POINTER :: dft_control
220 TYPE(kpoint_type), POINTER :: kpoints
221 TYPE(mo_set_type), DIMENSION(:), POINTER :: mos
222 TYPE(mo_set_type), POINTER :: mo_set, umo_set
223 TYPE(mp_para_env_type), POINTER :: para_env, para_env_inter_kp
224 TYPE(particle_type), DIMENSION(:), POINTER :: particle_set
225 TYPE(preconditioner_type), POINTER :: local_preconditioner
226 TYPE(qs_environment_type), POINTER :: cart_overlap_qs_env
227 TYPE(qs_kind_type), DIMENSION(:), POINTER :: qs_kind_set
228 TYPE(scf_control_type), POINTER :: scf_control
229 TYPE(section_vals_type), POINTER :: dft_section, input
230
231 CALL timeset(routinen, handle)
232
233 cpassert(ASSOCIATED(qs_env))
234
235 ! Retrieve the required information for the requested print output
236 CALL get_qs_env(qs_env, &
237 blacs_env=blacs_env, &
238 dft_control=dft_control, &
239 do_kpoints=do_kpoints, &
240 input=input, &
241 qs_kind_set=qs_kind_set, &
242 para_env=para_env, &
243 particle_set=particle_set, &
244 scf_control=scf_control)
245
246 ! Quick return, if no printout of MO information is requested
247 dft_section => section_vals_get_subs_vals(input, "DFT")
248 CALL section_vals_val_get(dft_section, "PRINT%MO%EIGENVALUES", l_val=print_eigvals)
249 CALL section_vals_val_get(dft_section, "PRINT%MO%EIGENVECTORS", l_val=print_eigvecs)
250 CALL section_vals_val_get(dft_section, "PRINT%MO%OCCUPATION_NUMBERS", l_val=print_occup)
251 CALL section_vals_val_get(dft_section, "PRINT%MO%OCCUPATION_NUMBERS_STATS", c_vals=tmpstringlist)
252
253 print_occup_stats = .false.
254 occup_stats_occ_threshold = 1e-6_dp
255 IF (SIZE(tmpstringlist) > 0) READ (tmpstringlist(1), *) print_occup_stats
256 IF (SIZE(tmpstringlist) > 1) THEN
257 READ (tmpstringlist(2), *) occup_stats_occ_threshold
258 END IF
259
260 logger => cp_get_default_logger()
261 print_mo_info = (cp_print_key_should_output(logger%iter_info, dft_section, "PRINT%MO") /= 0)
262
263 IF ((.NOT. print_mo_info) .OR. (.NOT. (print_eigvals .OR. print_eigvecs .OR. print_occup .OR. print_occup_stats))) THEN
264 CALL timestop(handle)
265 RETURN
266 END IF
267
268 do_printout = .true.
269 nspin = dft_control%nspins
270 nmos_occ = 0
271
272 IF (do_kpoints) THEN
273 CALL get_qs_env(qs_env, kpoints=kpoints)
274 CALL get_kpoint_info(kpoints, nkp=nkp, kp_range=kp_range, para_env_inter_kp=para_env_inter_kp)
275 cpassert(ASSOCIATED(para_env_inter_kp))
276 IF (scf_env%method == ot_method_nr) THEN
277 solver_method = "OT"
278 ELSE
279 solver_method = "TD"
280 END IF
281 DO ikp = 1, nkp
282 DO ispin = 1, nspin
283 ! Optional MO dummies are absent when their pointers are unassociated.
284 NULLIFY (mo_set, cart_overlap_qs_env)
285 nmo_occ = 0
286 IF ((ikp >= kp_range(1)) .AND. (ikp <= kp_range(2))) THEN
287 ikp_local = ikp - kp_range(1) + 1
288 mo_set => kpoints%kp_env(ikp_local)%kpoint_env%mos(1, ispin)
289 IF (print_occup_stats) THEN
290 nmo_occ = count(mo_set%occupation_numbers > occup_stats_occ_threshold)
291 END IF
292 END IF
293 IF (print_occup_stats) THEN
294 CALL para_env_inter_kp%max(nmo_occ)
295 nmos_occ(ispin) = max(nmos_occ(ispin), nmo_occ)
296 END IF
297 IF ((ikp == 1) .AND. (ikp >= kp_range(1)) .AND. &
298 (ikp <= kp_range(2)) .AND. (ispin == 1)) THEN
299 cart_overlap_qs_env => qs_env
300 END IF
301 IF (nspin > 1) THEN
302 SELECT CASE (ispin)
303 CASE (1)
304 spin = "ALPHA"
305 CASE (2)
306 spin = "BETA"
307 CASE DEFAULT
308 cpabort("Invalid spin")
309 END SELECT
310 CALL write_mo_set_to_output_unit(mo_set, qs_kind_set, particle_set, dft_section, 4, ikp, &
311 final_mos=final_mos, spin=trim(spin), &
312 solver_method=solver_method, qs_env=cart_overlap_qs_env, &
313 para_env_inter_kp=para_env_inter_kp)
314 ELSE
315 CALL write_mo_set_to_output_unit(mo_set, qs_kind_set, particle_set, dft_section, 4, ikp, &
316 final_mos=final_mos, solver_method=solver_method, &
317 qs_env=cart_overlap_qs_env, para_env_inter_kp=para_env_inter_kp)
318 END IF
319 END DO
320 END DO
321 ELSE
322
323 NULLIFY (fm_struct_tmp, mo_coeff, mo_coeff_deriv, mo_eigenvalues, &
324 mo_set, umo_coeff, umo_eigenvalues, umo_set)
325
326 CALL get_qs_env(qs_env, matrix_ks=ks, matrix_s=s, mos=mos)
327 cpassert(ASSOCIATED(ks))
328 cpassert(ASSOCIATED(s))
329 cpassert(ASSOCIATED(mos))
330
331 ! Prepare MO information for printout
332 DO ispin = 1, nspin
333
334 ! Calculate MO eigenvalues and eigenvector when OT is used
335 IF (scf_env%method == ot_method_nr) THEN
336
337 solver_method = "OT"
338
339 IF (final_mos) THEN
340
341 matrix_ks => ks(ispin)%matrix
342 matrix_s => s(1)%matrix
343
344 ! With ADMM, we have to modify the Kohn-Sham matrix
345 IF (dft_control%do_admm) THEN
346 CALL get_qs_env(qs_env, admm_env=admm_env)
347 CALL admm_correct_for_eigenvalues(ispin, admm_env, matrix_ks)
348 END IF
349
350 mo_set => mos(ispin)
351 CALL get_mo_set(mo_set=mo_set, &
352 mo_coeff=mo_coeff, &
353 eigenvalues=mo_eigenvalues, &
354 homo=homo, &
355 maxocc=maxocc, &
356 nelectron=nelectron, &
357 n_el_f=n_el_f, &
358 nao=nao, &
359 nmo=nmo, &
360 flexible_electron_count=flexible_electron_count)
361
362 IF (ASSOCIATED(qs_env%mo_derivs)) THEN
363 mo_coeff_deriv => qs_env%mo_derivs(ispin)%matrix
364 ELSE
365 mo_coeff_deriv => null()
366 END IF
367
368 ! Update the eigenvalues of the occupied orbitals
369 CALL calculate_subspace_eigenvalues(orbitals=mo_coeff, &
370 ks_matrix=matrix_ks, &
371 evals_arg=mo_eigenvalues, &
372 co_rotate_dbcsr=mo_coeff_deriv)
373 CALL set_mo_occupation(mo_set=mo_set)
374
375 ! Retrieve the index of the last MO for which a printout is requested
376 mo_index_range => section_get_ivals(dft_section, "PRINT%MO%MO_INDEX_RANGE")
377 cpassert(ASSOCIATED(mo_index_range))
378 IF (mo_index_range(2) < 0) THEN
379 numo = nao - homo
380 ELSE
381 numo = min(mo_index_range(2) - homo, nao - homo)
382 END IF
383
384 ! Calculate the unoccupied MO set (umo_set) with OT if needed
385 IF (numo > 0) THEN
386
387 ! Create temporary virtual MO set for printout
388 CALL cp_fm_struct_create(fm_struct_tmp, &
389 context=blacs_env, &
390 para_env=para_env, &
391 nrow_global=nao, &
392 ncol_global=numo)
393 ALLOCATE (umo_set)
394 CALL allocate_mo_set(mo_set=umo_set, &
395 nao=nao, &
396 nmo=numo, &
397 nelectron=0, &
398 n_el_f=n_el_f, &
399 maxocc=maxocc, &
400 flexible_electron_count=flexible_electron_count)
401 CALL init_mo_set(mo_set=umo_set, &
402 fm_struct=fm_struct_tmp, &
403 name="Temporary MO set (unoccupied MOs only) for printout")
404 CALL cp_fm_struct_release(fm_struct_tmp)
405 CALL get_mo_set(mo_set=umo_set, &
406 mo_coeff=umo_coeff, &
407 eigenvalues=umo_eigenvalues)
408
409 ! Prepare printout of the additional unoccupied MOs when OT is being employed
410 CALL cp_fm_init_random(umo_coeff)
411
412 ! FULL_ALL has column-dependent occupied-state weights and cannot be reused here.
413 NULLIFY (local_preconditioner)
414 IF (ASSOCIATED(scf_env%ot_preconditioner)) THEN
415 local_preconditioner => scf_env%ot_preconditioner(1)%preconditioner
416 IF (local_preconditioner%in_use == ot_precond_full_all .OR. &
417 local_preconditioner%in_use == ot_precond_full_all_covariant) THEN
418 NULLIFY (local_preconditioner)
419 END IF
420 END IF
421
422 ! Calculate the MO information for the request MO index range
423 CALL ot_eigensolver(matrix_h=matrix_ks, &
424 matrix_s=matrix_s, &
425 matrix_c_fm=umo_coeff, &
426 matrix_orthogonal_space_fm=mo_coeff, &
427 eps_gradient=scf_control%eps_lumos, &
428 preconditioner=local_preconditioner, &
429 iter_max=scf_control%max_iter_lumos, &
430 size_ortho_space=nmo)
431
432 CALL calculate_subspace_eigenvalues(orbitals=umo_coeff, &
433 ks_matrix=matrix_ks, &
434 evals_arg=umo_eigenvalues)
435 CALL set_mo_occupation(mo_set=umo_set)
436
437 END IF ! numo > 0
438
439 ! With ADMM, we have to undo the modification of the Kohn-Sham matrix
440 IF (dft_control%do_admm) THEN
441 CALL admm_uncorrect_for_eigenvalues(ispin, admm_env, matrix_ks)
442 END IF
443
444 ELSE
445
446 message = "The MO information is only calculated after SCF convergence "// &
447 "is achieved when the orbital transformation (OT) method is used"
448 cpwarn(trim(message))
449 do_printout = .false.
450 EXIT
451
452 END IF ! final MOs / gamma OT
453
454 ELSE
455
456 solver_method = "TD"
457 mo_set => mos(ispin)
458 NULLIFY (umo_set)
459
460 END IF ! OT is used
461
462 ! Print MO information
463 NULLIFY (cart_overlap_qs_env)
464 IF (ispin == 1) cart_overlap_qs_env => qs_env
465 IF (nspin > 1) THEN
466 SELECT CASE (ispin)
467 CASE (1)
468 spin = "ALPHA"
469 CASE (2)
470 spin = "BETA"
471 CASE DEFAULT
472 cpabort("Invalid spin")
473 END SELECT
474 CALL write_mo_set_to_output_unit(mo_set, qs_kind_set, particle_set, dft_section, 4, 0, &
475 final_mos=final_mos, spin=trim(spin), solver_method=solver_method, &
476 umo_set=umo_set, qs_env=cart_overlap_qs_env)
477 ELSE
478 CALL write_mo_set_to_output_unit(mo_set, qs_kind_set, particle_set, dft_section, 4, 0, &
479 final_mos=final_mos, solver_method=solver_method, &
480 umo_set=umo_set, qs_env=cart_overlap_qs_env)
481 END IF
482
483 IF (print_occup_stats) nmos_occ(ispin) = max(nmos_occ(ispin), &
484 count(mo_set%occupation_numbers > occup_stats_occ_threshold))
485
486 ! Deallocate temporary objects needed for OT
487 IF (scf_env%method == ot_method_nr) THEN
488 IF (ASSOCIATED(umo_set)) THEN
489 CALL deallocate_mo_set(umo_set)
490 DEALLOCATE (umo_set)
491 END IF
492 NULLIFY (matrix_ks)
493 NULLIFY (matrix_s)
494 END IF
495 NULLIFY (mo_set)
496
497 END DO ! ispin
498 END IF
499
500 IF (do_printout .AND. print_mo_info .AND. print_occup_stats) THEN
501 iw = cp_print_key_unit_nr(logger, dft_section, "PRINT%MO", &
502 ignore_should_output=print_mo_info, &
503 extension=".MOLog")
504 IF (iw > 0) THEN
505 IF (nspin > 1) THEN
506 WRITE (unit=iw, fmt="(A,I4)") " MO| Total occupied (ALPHA):", nmos_occ(1)
507 WRITE (unit=iw, fmt="(A,I4)") " MO| Total occupied (BETA): ", nmos_occ(2)
508 ELSE
509 WRITE (unit=iw, fmt="(A,I4)") " MO| Total occupied: ", nmos_occ(1)
510 END IF
511 WRITE (unit=iw, fmt="(A)") ""
512 END IF
513 CALL cp_print_key_finished_output(iw, logger, dft_section, "PRINT%MO", &
514 ignore_should_output=print_mo_info)
515 END IF
516
517 CALL timestop(handle)
518
519 END SUBROUTINE qs_scf_write_mos
520
521! **************************************************************************************************
522!> \brief writes basic information obtained in a scf outer loop step
523!> \param output_unit ...
524!> \param scf_control ...
525!> \param scf_env ...
526!> \param energy ...
527!> \param total_steps ...
528!> \param should_stop ...
529!> \param outer_loop_converged ...
530! **************************************************************************************************
531 SUBROUTINE qs_scf_outer_loop_info(output_unit, scf_control, scf_env, &
532 energy, total_steps, should_stop, outer_loop_converged)
533 INTEGER :: output_unit
534 TYPE(scf_control_type), POINTER :: scf_control
535 TYPE(qs_scf_env_type), POINTER :: scf_env
536 TYPE(qs_energy_type), POINTER :: energy
537 INTEGER :: total_steps
538 LOGICAL, INTENT(IN) :: should_stop, outer_loop_converged
539
540 REAL(kind=dp) :: outer_loop_eps
541
542 outer_loop_eps = sqrt(maxval(scf_env%outer_scf%gradient(:, scf_env%outer_scf%iter_count)**2))
543 IF (output_unit > 0) WRITE (output_unit, '(/,T3,A,I4,A,E10.2,A,F22.10)') &
544 "outer SCF iter = ", scf_env%outer_scf%iter_count, &
545 " RMS gradient = ", outer_loop_eps, " energy =", energy%total
546
547 IF (outer_loop_converged) THEN
548 IF (output_unit > 0) WRITE (output_unit, '(T3,A,I4,A,I4,A,/)') &
549 "outer SCF loop converged in", scf_env%outer_scf%iter_count, &
550 " iterations or ", total_steps, " steps"
551 ELSE IF (scf_env%outer_scf%iter_count > scf_control%outer_scf%max_scf &
552 .OR. should_stop) THEN
553 IF (output_unit > 0) WRITE (output_unit, '(T3,A,I4,A,I4,A,/)') &
554 "outer SCF loop FAILED to converge after ", &
555 scf_env%outer_scf%iter_count, " iterations or ", total_steps, " steps"
556 END IF
557
558 END SUBROUTINE qs_scf_outer_loop_info
559
560! **************************************************************************************************
561!> \brief writes basic information obtained in a scf step
562!> \param scf_env ...
563!> \param output_unit ...
564!> \param just_energy ...
565!> \param t1 ...
566!> \param t2 ...
567!> \param energy ...
568!> \param adiis_verbose whether to print per-iteration ADIIS diagnostics
569! **************************************************************************************************
570 SUBROUTINE qs_scf_loop_info(scf_env, output_unit, just_energy, t1, t2, energy, adiis_verbose)
571
572 TYPE(qs_scf_env_type), POINTER :: scf_env
573 INTEGER :: output_unit
574 LOGICAL, INTENT(IN) :: just_energy
575 REAL(kind=dp) :: t1, t2
576 TYPE(qs_energy_type), POINTER :: energy
577 LOGICAL, INTENT(IN) :: adiis_verbose
578
579 IF ((output_unit > 0) .AND. scf_env%print_iter_line) THEN
580 IF (just_energy) THEN
581 WRITE (unit=output_unit, &
582 fmt="(T2,A,1X,A,T20,E8.2,1X,F6.1,16X,F20.10)") &
583 " -", trim(scf_env%iter_method), scf_env%iter_param, t2 - t1, energy%total
584 ELSE
585 IF ((abs(scf_env%iter_delta) < 1.0e-8_dp) .OR. &
586 (abs(scf_env%iter_delta) >= 1.0e5_dp)) THEN
587 WRITE (unit=output_unit, &
588 fmt="(T2,I5,1X,A,T20,E8.2,1X,F6.1,1X,ES14.4,1X,F20.10,1X,ES9.2)") &
589 scf_env%iter_count, trim(scf_env%iter_method), scf_env%iter_param, &
590 t2 - t1, scf_env%iter_delta, energy%total, energy%total - energy%tot_old
591 ELSE
592 WRITE (unit=output_unit, &
593 fmt="(T2,I5,1X,A,T20,E8.2,1X,F6.1,1X,F14.8,1X,F20.10,1X,ES9.2)") &
594 scf_env%iter_count, trim(scf_env%iter_method), scf_env%iter_param, &
595 t2 - t1, scf_env%iter_delta, energy%total, energy%total - energy%tot_old
596 END IF
597 IF (adiis_verbose) THEN
598 IF (scf_env%adiis_shift > 0.0_dp) THEN
599 WRITE (unit=output_unit, fmt="(T4,A,ES11.3,A,F5.2,A,I3)") &
600 "ADIIS shift parameter [Ha]=", scf_env%adiis_shift, &
601 " CDIIS weight=", scf_env%scf_subspace_buffer%diis_weight, &
602 " history=", scf_env%scf_subspace_buffer%nstored
603 END IF
604 IF (scf_env%raw_map_delta_valid) THEN
605 WRITE (unit=output_unit, fmt="(T4,A,ES11.3,A,ES11.3)") &
606 "ADIIS metrics: step_norm=", scf_env%step_norm, &
607 " raw_map_delta=", scf_env%raw_map_delta
608 END IF
609
610 END IF
611 END IF
612 END IF
613
614 END SUBROUTINE qs_scf_loop_info
615
616! **************************************************************************************************
617!> \brief writes rather detailed summary of densities and energies
618!> after the SCF
619!> \param output_unit ...
620!> \param rho ...
621!> \param qs_charges ...
622!> \param energy ...
623!> \param nelectron_total ...
624!> \param dft_control ...
625!> \param qmmm ...
626!> \param qs_env ...
627!> \param gapw ...
628!> \param gapw_xc ...
629!> \par History
630!> 03.2006 created [Joost VandeVondele]
631!> 10.2019 print dipole moment [SGh]
632!> 11.2022 print SCCS results [MK]
633! **************************************************************************************************
634 SUBROUTINE qs_scf_print_scf_summary(output_unit, rho, qs_charges, energy, nelectron_total, &
635 dft_control, qmmm, qs_env, gapw, gapw_xc)
636 INTEGER, INTENT(IN) :: output_unit
637 TYPE(qs_rho_type), POINTER :: rho
638 TYPE(qs_charges_type), POINTER :: qs_charges
639 TYPE(qs_energy_type), POINTER :: energy
640 INTEGER, INTENT(IN) :: nelectron_total
641 TYPE(dft_control_type), POINTER :: dft_control
642 LOGICAL, INTENT(IN) :: qmmm
643 TYPE(qs_environment_type), POINTER :: qs_env
644 LOGICAL, INTENT(IN) :: gapw, gapw_xc
645
646 CHARACTER(LEN=*), PARAMETER :: routinen = 'qs_scf_print_scf_summary'
647
648 INTEGER :: bc, handle, ispin, psolver
649 REAL(kind=dp) :: e_extrapolated, exc1_energy, exc_energy, &
650 implicit_ps_ehartree, tot1_h, tot1_s
651 REAL(kind=dp), DIMENSION(:), POINTER :: tot_rho_r
652 TYPE(pw_env_type), POINTER :: pw_env
653 TYPE(scf_control_type), POINTER :: scf_control
654
655 NULLIFY (tot_rho_r, pw_env)
656 CALL timeset(routinen, handle)
657
658 CALL get_qs_env(qs_env=qs_env, pw_env=pw_env, scf_control=scf_control)
659 psolver = pw_env%poisson_env%parameters%solver
660
661 IF (output_unit > 0) THEN
662 CALL qs_rho_get(rho, tot_rho_r=tot_rho_r)
663 IF (.NOT. (dft_control%qs_control%semi_empirical .OR. &
664 dft_control%qs_control%xtb .OR. &
665 dft_control%qs_control%dftb)) THEN
666 WRITE (unit=output_unit, fmt="(/,(T3,A,T41,2F20.10))") &
667 "Electronic density on regular grids: ", &
668 accurate_sum(tot_rho_r), &
669 accurate_sum(tot_rho_r) + nelectron_total, &
670 "Core density on regular grids:", &
671 qs_charges%total_rho_core_rspace, &
672 qs_charges%total_rho_core_rspace + &
673 qs_charges%total_rho1_hard_nuc - &
674 REAL(nelectron_total + dft_control%charge, dp)
675
676 IF (dft_control%correct_surf_dip) THEN
677 WRITE (unit=output_unit, fmt="((T3,A,/,T3,A,T41,F20.10))") &
678 "Total dipole moment perpendicular to ", &
679 "the slab [electrons-Angstroem]: ", &
680 qs_env%surface_dipole_moment
681 WRITE (unit=output_unit, fmt="((T3,A,/,T3,A,T41,F20.10))") &
682 "Position of the dipole ", &
683 "correction plane [Angstroem]: ", &
684 qs_env%surface_dipole_ref_pos
685 WRITE (unit=output_unit, fmt="((T3,A,/,T3,A,T41,2F20.10))") &
686 "Vacuum level below/above the ", &
687 "dipole correction plane [eV]: ", &
688 qs_env%vacuum_level_below, qs_env%vacuum_level_above
689 END IF
690
691 IF (gapw) THEN
692 tot1_h = qs_charges%total_rho1_hard(1)
693 tot1_s = qs_charges%total_rho1_soft(1)
694 DO ispin = 2, dft_control%nspins
695 tot1_h = tot1_h + qs_charges%total_rho1_hard(ispin)
696 tot1_s = tot1_s + qs_charges%total_rho1_soft(ispin)
697 END DO
698 WRITE (unit=output_unit, fmt="((T3,A,T41,2F20.10))") &
699 "Hard and soft densities (Lebedev):", &
700 tot1_h, tot1_s
701 WRITE (unit=output_unit, fmt="(T3,A,T41,F20.10)") &
702 "Total Rho_soft + Rho1_hard - Rho1_soft (r-space): ", &
703 accurate_sum(tot_rho_r) + tot1_h - tot1_s, &
704 "Total charge density (r-space): ", &
705 accurate_sum(tot_rho_r) + tot1_h - tot1_s &
706 + qs_charges%total_rho_core_rspace &
707 + qs_charges%total_rho1_hard_nuc
708 IF (qs_charges%total_rho1_hard_nuc /= 0.0_dp) THEN
709 WRITE (unit=output_unit, fmt="(T3,A,T41,F20.10)") &
710 "Total CNEO nuc. char. den. (Lebedev): ", &
711 qs_charges%total_rho1_hard_nuc, &
712 "Total CNEO soft char. den. (Lebedev): ", &
713 qs_charges%total_rho1_soft_nuc_lebedev, &
714 "Total CNEO soft char. den. (r-space): ", &
715 qs_charges%total_rho1_soft_nuc_rspace, &
716 "Total soft Rho_e+n+0 (g-space):", &
717 qs_charges%total_rho_gspace
718 ELSE
719 WRITE (unit=output_unit, fmt="(T3,A,T41,F20.10)") &
720 "Total Rho_soft + Rho0_soft (g-space):", &
721 qs_charges%total_rho_gspace
722 END IF
723 ! only add total_rho1_hard_nuc for gapw as cneo requires gapw
724 ELSE
725 WRITE (unit=output_unit, fmt="(T3,A,T41,F20.10)") &
726 "Total charge density on r-space grids: ", &
727 accurate_sum(tot_rho_r) + &
728 qs_charges%total_rho_core_rspace, &
729 "Total charge density g-space grids: ", &
730 qs_charges%total_rho_gspace
731 END IF
732 END IF
733 IF (dft_control%qs_control%semi_empirical) THEN
734 WRITE (unit=output_unit, fmt="(/,(T3,A,T56,F25.14))") &
735 "Core-core repulsion energy [eV]: ", energy%core_overlap*evolt, &
736 "Core Hamiltonian energy [eV]: ", energy%core*evolt, &
737 "Two-electron integral energy [eV]: ", energy%hartree*evolt, &
738 "Electronic energy [eV]: ", &
739 (energy%core + 0.5_dp*energy%hartree)*evolt
740 IF (energy%dispersion /= 0.0_dp) THEN
741 WRITE (unit=output_unit, fmt="(T3,A,T56,F25.14)") &
742 "Dispersion energy [eV]: ", energy%dispersion*evolt
743 END IF
744 ELSE IF (dft_control%qs_control%dftb) THEN
745 WRITE (unit=output_unit, fmt="(/,(T3,A,T56,F25.14))") &
746 "Core Hamiltonian energy: ", energy%core, &
747 "Repulsive potential energy: ", energy%repulsive, &
748 "Electronic energy: ", energy%hartree, &
749 "Dispersion energy: ", energy%dispersion
750 IF (energy%dftb3 /= 0.0_dp) THEN
751 WRITE (unit=output_unit, fmt="(T3,A,T56,F25.14)") &
752 "DFTB3 3rd order energy: ", energy%dftb3
753 END IF
754 IF (energy%efield /= 0.0_dp) THEN
755 WRITE (unit=output_unit, fmt="(T3,A,T56,F25.14)") &
756 "Electric field interaction energy: ", energy%efield
757 END IF
758 ELSE IF (dft_control%qs_control%xtb) THEN
759 IF (dft_control%qs_control%xtb_control%do_tblite) THEN
760 WRITE (unit=output_unit, fmt="(/,(T3,A,T56,F25.14))") &
761 "Core Hamiltonian energy: ", energy%core, &
762 "Repulsive potential energy: ", energy%repulsive, &
763 "Electrostatic energy: ", energy%el_stat, &
764 "Self-consistent dispersion energy: ", energy%dispersion_sc, &
765 "Non-self consistent dispersion energy: ", energy%dispersion, &
766 "Correction for halogen bonding: ", energy%xtb_xb_inter
767 ELSE
768 IF (dft_control%qs_control%xtb_control%gfn_type == 0) THEN
769 WRITE (unit=output_unit, fmt="(/,(T3,A,T56,F25.14))") &
770 "Core Hamiltonian energy: ", energy%core, &
771 "Repulsive potential energy: ", energy%repulsive, &
772 "SRB Correction energy: ", energy%srb, &
773 "Charge equilibration energy: ", energy%eeq, &
774 "Dispersion energy: ", energy%dispersion
775 ELSE IF (dft_control%qs_control%xtb_control%gfn_type == 1) THEN
776 WRITE (unit=output_unit, fmt="(/,(T3,A,T56,F25.14))") &
777 "Core Hamiltonian energy: ", energy%core, &
778 "Repulsive potential energy: ", energy%repulsive, &
779 "Electronic energy: ", energy%hartree, &
780 "DFTB3 3rd order energy: ", energy%dftb3, &
781 "Dispersion energy: ", energy%dispersion
782 IF (dft_control%qs_control%xtb_control%xb_interaction) THEN
783 WRITE (unit=output_unit, fmt="(T3,A,T56,F25.14)") &
784 "Correction for halogen bonding: ", energy%xtb_xb_inter
785 END IF
786 ELSE IF (dft_control%qs_control%xtb_control%gfn_type == 2) THEN
787 cpabort("gfn_typ 2 NYA")
788 ELSE
789 cpabort("invalid gfn_typ")
790 END IF
791 END IF
792 IF (dft_control%qs_control%xtb_control%do_nonbonded) THEN
793 WRITE (unit=output_unit, fmt="(T3,A,T56,F25.14)") &
794 "Correction for nonbonded interactions: ", energy%xtb_nonbonded
795 END IF
796 IF (energy%efield /= 0.0_dp) THEN
797 WRITE (unit=output_unit, fmt="(T3,A,T56,F25.14)") &
798 "Electric field interaction energy: ", energy%efield
799 END IF
800 ELSE
801 IF (dft_control%do_admm) THEN
802 exc_energy = energy%exc + energy%exc_aux_fit
803 IF (gapw .OR. gapw_xc) exc1_energy = energy%exc1 + energy%exc1_aux_fit
804 ELSE
805 exc_energy = energy%exc
806 IF (gapw .OR. gapw_xc) exc1_energy = energy%exc1
807 END IF
808
809 IF (psolver == pw_poisson_implicit) THEN
810 implicit_ps_ehartree = pw_env%poisson_env%implicit_env%ehartree
811 bc = pw_env%poisson_env%parameters%ps_implicit_params%boundary_condition
812 SELECT CASE (bc)
814 WRITE (unit=output_unit, fmt="(/,(T3,A,T56,F25.14))") &
815 "Overlap energy of the core charge distribution:", energy%core_overlap, &
816 "Self energy of the core charge distribution: ", energy%core_self, &
817 "Core Hamiltonian energy: ", energy%core, &
818 "Hartree energy: ", implicit_ps_ehartree, &
819 "Electric enthalpy: ", energy%hartree, &
820 "Exchange-correlation energy: ", exc_energy
821 CASE (periodic_bc, neumann_bc)
822 WRITE (unit=output_unit, fmt="(/,(T3,A,T56,F25.14))") &
823 "Overlap energy of the core charge distribution:", energy%core_overlap, &
824 "Self energy of the core charge distribution: ", energy%core_self, &
825 "Core Hamiltonian energy: ", energy%core, &
826 "Hartree energy: ", energy%hartree, &
827 "Exchange-correlation energy: ", exc_energy
828 END SELECT
829 ELSE
830 WRITE (unit=output_unit, fmt="(/,(T3,A,T56,F25.14))") &
831 "Overlap energy of the core charge distribution:", energy%core_overlap, &
832 "Self energy of the core charge distribution: ", energy%core_self, &
833 "Core Hamiltonian energy: ", energy%core, &
834 "Hartree energy: ", energy%hartree, &
835 "Exchange-correlation energy: ", exc_energy
836 END IF
837 IF (energy%e_hartree /= 0.0_dp) THEN
838 WRITE (unit=output_unit, fmt="(T3,A,/,T3,A,T56,F25.14)") &
839 "Coulomb Electron-Electron Interaction Energy ", &
840 "- Already included in the total Hartree term ", energy%e_hartree
841 END IF
842 IF (energy%ex /= 0.0_dp) THEN
843 WRITE (unit=output_unit, fmt="(T3,A,T56,F25.14)") &
844 "Hartree-Fock Exchange energy: ", energy%ex
845 END IF
846 IF (energy%dispersion /= 0.0_dp) THEN
847 WRITE (unit=output_unit, fmt="(T3,A,T56,F25.14)") &
848 "Dispersion energy: ", energy%dispersion
849 END IF
850 IF (energy%gcp /= 0.0_dp) THEN
851 WRITE (unit=output_unit, fmt="(T3,A,T56,F25.14)") &
852 "gCP energy: ", energy%gcp
853 END IF
854 IF (energy%efield /= 0.0_dp) THEN
855 WRITE (unit=output_unit, fmt="(T3,A,T56,F25.14)") &
856 "Electric field interaction energy: ", energy%efield
857 END IF
858 IF (gapw) THEN
859 WRITE (unit=output_unit, fmt="(/,(T3,A,T56,F25.14))") &
860 "GAPW| Exc from hard and soft atomic rho1: ", exc1_energy, &
861 "GAPW| local Eh = 1 center integrals: ", energy%hartree_1c
862 END IF
863 IF (gapw_xc) THEN
864 WRITE (unit=output_unit, fmt="(/,(T3,A,T56,F25.14))") &
865 "GAPW_XC| Exc from hard and soft atomic rho1: ", exc1_energy
866 END IF
867 IF (energy%core_cneo /= 0.0_dp) THEN
868 WRITE (unit=output_unit, fmt="(T3,A,T56,F25.14)") &
869 "CNEO| quantum nuclear core energy: ", energy%core_cneo
870 END IF
871 END IF
872 IF (dft_control%hairy_probes .EQV. .true.) THEN
873 WRITE (unit=output_unit, fmt="((T3,A,T56,F25.14))") &
874 "Electronic entropic energy:", energy%kTS
875 WRITE (unit=output_unit, fmt="((T3,A,T56,F25.14))") &
876 "Fermi energy:", energy%efermi
877 END IF
878 IF (dft_control%smear) THEN
879 SELECT CASE (scf_control%smear%method)
881 ! kTS does not have physical meaning in these smearing methods
882 WRITE (unit=output_unit, fmt="((T3,A,T56,F25.14))") &
883 "Smearing free energy correction:", energy%kTS
884 CASE DEFAULT
885 WRITE (unit=output_unit, fmt="((T3,A,T56,F25.14))") &
886 "Electronic entropic energy:", energy%kTS
887 END SELECT
888 WRITE (unit=output_unit, fmt="((T3,A,T56,F25.14))") &
889 "Fermi energy:", energy%efermi
890 END IF
891 IF (dft_control%dft_plus_u) THEN
892 WRITE (unit=output_unit, fmt="(/,(T3,A,T56,F25.14))") &
893 "DFT+U energy:", energy%dft_plus_u
894 END IF
895 IF (dft_control%do_sccs) THEN
896 WRITE (unit=output_unit, fmt="(A)") ""
897 CALL print_sccs_results(energy, dft_control%sccs_control, output_unit)
898 END IF
899 IF (qmmm) THEN
900 WRITE (unit=output_unit, fmt="(T3,A,T56,F25.14)") &
901 "QM/MM Electrostatic energy: ", energy%qmmm_el
902 IF (qs_env%qmmm_env_qm%image_charge) THEN
903 WRITE (unit=output_unit, fmt="(T3,A,T56,F25.14)") &
904 "QM/MM image charge energy: ", energy%image_charge
905 END IF
906 END IF
907 IF (dft_control%qs_control%mulliken_restraint) THEN
908 WRITE (unit=output_unit, fmt="(T3,A,T56,F25.14)") &
909 "Mulliken restraint energy: ", energy%mulliken
910 END IF
911 IF (dft_control%qs_control%semi_empirical) THEN
912 WRITE (unit=output_unit, fmt="(/,(T3,A,T56,F25.14))") &
913 "Total energy [eV]: ", energy%total*evolt
914 WRITE (unit=output_unit, fmt="(/,(T3,A,T56,F25.14))") &
915 "Atomic reference energy [eV]: ", energy%core_self*evolt, &
916 "Heat of formation [kcal/mol]: ", &
917 (energy%total + energy%core_self)*kcalmol
918 ELSE
919 WRITE (unit=output_unit, fmt="(/,(T3,A,T56,F25.14))") &
920 "Total energy: ", energy%total
921 IF (dft_control%smear) THEN
922 SELECT CASE (scf_control%smear%method)
923 CASE (smear_fermi_dirac)
924 e_extrapolated = energy%total - 0.5_dp*energy%kTS
925 WRITE (unit=output_unit, fmt="((T3,A,T56,F25.14))") &
926 "Total energy (extrapolated to T->0): ", e_extrapolated
927 IF (scf_control%gce%do_gce) THEN
928 WRITE (unit=output_unit, fmt="(/,(T3,A,T56,F25.14))") &
929 "GCE work function [eV]: ", scf_control%gce%prev_workfunction*evolt
930 WRITE (unit=output_unit, fmt="((T3,A,T56,ES25.10))") &
931 "GCE WF-TWF [eV]: ", (scf_control%gce%prev_workfunction - &
932 scf_control%gce%target_workfunction)*evolt
933 WRITE (unit=output_unit, fmt="((T3,A,T56,F25.14))") &
934 "GCE charge [e]: ", dft_control%pcc_control%charge
935 WRITE (unit=output_unit, fmt="((T3,A,T56,F25.14))") &
936 "GCE free energy: ", (dft_control%pcc_control%charge + dft_control%charge) &
937 *scf_control%gce%prev_workfunction*evolt
938 END IF
939 CASE (smear_gaussian)
940 e_extrapolated = energy%total - 0.5_dp*energy%kTS
941 WRITE (unit=output_unit, fmt="((T3,A,T56,F25.14))") &
942 "Total energy (extrapolated to sigma->0): ", e_extrapolated
943 CASE (smear_mp, smear_mv)
944 ! Sigma->0 extrapolation does not apply to MP or MV method.
945 END SELECT
946 END IF
947 END IF
948 IF (qmmm) THEN
949 IF (qs_env%qmmm_env_qm%image_charge) THEN
950 CALL print_image_coefficients(qs_env%image_coeff, qs_env)
951 END IF
952 END IF
953 CALL m_flush(output_unit)
954 END IF
955
956 CALL timestop(handle)
957
958 END SUBROUTINE qs_scf_print_scf_summary
959
960! **************************************************************************************************
961!> \brief collects the 'heavy duty' printing tasks out of the SCF loop
962!> \param qs_env ...
963!> \param scf_env ...
964!> \param para_env ...
965!> \par History
966!> 03.2006 created [Joost VandeVondele]
967! **************************************************************************************************
968 SUBROUTINE qs_scf_loop_print(qs_env, scf_env, para_env)
969 TYPE(qs_environment_type), POINTER :: qs_env
970 TYPE(qs_scf_env_type), POINTER :: scf_env
971 TYPE(mp_para_env_type), POINTER :: para_env
972
973 CHARACTER(LEN=*), PARAMETER :: routinen = 'qs_scf_loop_print'
974
975 INTEGER :: after, handle, ic, ispin, iw
976 LOGICAL :: do_kpoints, omit_headers
977 REAL(kind=dp) :: mo_mag_max, mo_mag_min, orthonormality
978 TYPE(cp_logger_type), POINTER :: logger
979 TYPE(dbcsr_p_type), DIMENSION(:, :), POINTER :: matrix_ks, matrix_p, matrix_s
980 TYPE(dft_control_type), POINTER :: dft_control
981 TYPE(mo_set_type), DIMENSION(:), POINTER :: mos
982 TYPE(qs_rho_type), POINTER :: rho
983 TYPE(section_vals_type), POINTER :: dft_section, input, scf_section
984
985 logger => cp_get_default_logger()
986 CALL timeset(routinen, handle)
987
988 CALL get_qs_env(qs_env=qs_env, input=input, dft_control=dft_control, &
989 do_kpoints=do_kpoints)
990
991 dft_section => section_vals_get_subs_vals(input, "DFT")
992 scf_section => section_vals_get_subs_vals(dft_section, "SCF")
993
994 CALL section_vals_val_get(input, "DFT%PRINT%AO_MATRICES%OMIT_HEADERS", l_val=omit_headers)
995 DO ispin = 1, dft_control%nspins
996
997 IF (btest(cp_print_key_should_output(logger%iter_info, &
998 dft_section, "PRINT%AO_MATRICES/DENSITY"), cp_p_file)) THEN
999 CALL get_qs_env(qs_env, rho=rho)
1000 CALL qs_rho_get(rho, rho_ao_kp=matrix_p)
1001 iw = cp_print_key_unit_nr(logger, dft_section, "PRINT%AO_MATRICES/DENSITY", &
1002 extension=".Log")
1003 CALL section_vals_val_get(dft_section, "PRINT%AO_MATRICES%NDIGITS", i_val=after)
1004 after = min(max(after, 1), 16)
1005 DO ic = 1, SIZE(matrix_p, 2)
1006 CALL cp_dbcsr_write_sparse_matrix(matrix_p(ispin, ic)%matrix, 4, after, qs_env, para_env, &
1007 output_unit=iw, omit_headers=omit_headers)
1008 END DO
1009 CALL cp_print_key_finished_output(iw, logger, dft_section, &
1010 "PRINT%AO_MATRICES/DENSITY")
1011 END IF
1012
1013 IF (btest(cp_print_key_should_output(logger%iter_info, &
1014 dft_section, "PRINT%AO_MATRICES/KOHN_SHAM_MATRIX"), cp_p_file)) THEN
1015 iw = cp_print_key_unit_nr(logger, dft_section, "PRINT%AO_MATRICES/KOHN_SHAM_MATRIX", &
1016 extension=".Log")
1017 CALL section_vals_val_get(dft_section, "PRINT%AO_MATRICES%NDIGITS", i_val=after)
1018 after = min(max(after, 1), 16)
1019 CALL get_qs_env(qs_env=qs_env, matrix_ks_kp=matrix_ks)
1020 DO ic = 1, SIZE(matrix_ks, 2)
1021 IF (dft_control%qs_control%semi_empirical) THEN
1022 CALL cp_dbcsr_write_sparse_matrix(matrix_ks(ispin, ic)%matrix, 4, after, qs_env, para_env, &
1023 scale=evolt, output_unit=iw, omit_headers=omit_headers)
1024 ELSE
1025 CALL cp_dbcsr_write_sparse_matrix(matrix_ks(ispin, ic)%matrix, 4, after, qs_env, para_env, &
1026 output_unit=iw, omit_headers=omit_headers)
1027 END IF
1028 END DO
1029 CALL cp_print_key_finished_output(iw, logger, dft_section, &
1030 "PRINT%AO_MATRICES/KOHN_SHAM_MATRIX")
1031 END IF
1032
1033 END DO
1034
1035 IF (btest(cp_print_key_should_output(logger%iter_info, &
1036 scf_section, "PRINT%MO_ORTHONORMALITY"), cp_p_file)) THEN
1037 IF (do_kpoints) THEN
1038 iw = cp_print_key_unit_nr(logger, scf_section, "PRINT%MO_ORTHONORMALITY", &
1039 extension=".scfLog")
1040 IF (iw > 0) THEN
1041 WRITE (iw, '(T8,A)') &
1042 " K-points: Maximum deviation from MO S-orthonormality not determined"
1043 END IF
1044 CALL cp_print_key_finished_output(iw, logger, scf_section, &
1045 "PRINT%MO_ORTHONORMALITY")
1046 ELSE
1047 CALL get_qs_env(qs_env, mos=mos)
1048 IF (scf_env%method == special_diag_method_nr) THEN
1049 CALL calculate_orthonormality(orthonormality, mos)
1050 ELSE
1051 CALL get_qs_env(qs_env=qs_env, matrix_s_kp=matrix_s)
1052 CALL calculate_orthonormality(orthonormality, mos, matrix_s(1, 1)%matrix)
1053 END IF
1054 iw = cp_print_key_unit_nr(logger, scf_section, "PRINT%MO_ORTHONORMALITY", &
1055 extension=".scfLog")
1056 IF (iw > 0) THEN
1057 WRITE (iw, '(T8,A,T61,E20.4)') &
1058 " Maximum deviation from MO S-orthonormality", orthonormality
1059 END IF
1060 CALL cp_print_key_finished_output(iw, logger, scf_section, &
1061 "PRINT%MO_ORTHONORMALITY")
1062 END IF
1063 END IF
1064 IF (btest(cp_print_key_should_output(logger%iter_info, &
1065 scf_section, "PRINT%MO_MAGNITUDE"), cp_p_file)) THEN
1066 IF (do_kpoints) THEN
1067 iw = cp_print_key_unit_nr(logger, scf_section, "PRINT%MO_MAGNITUDE", &
1068 extension=".scfLog")
1069 IF (iw > 0) THEN
1070 WRITE (iw, '(T8,A)') &
1071 " K-points: Minimum/Maximum MO magnitude not determined"
1072 END IF
1073 CALL cp_print_key_finished_output(iw, logger, scf_section, &
1074 "PRINT%MO_MAGNITUDE")
1075 ELSE
1076 CALL get_qs_env(qs_env, mos=mos)
1077 CALL calculate_magnitude(mos, mo_mag_min, mo_mag_max)
1078 iw = cp_print_key_unit_nr(logger, scf_section, "PRINT%MO_MAGNITUDE", &
1079 extension=".scfLog")
1080 IF (iw > 0) THEN
1081 WRITE (iw, '(T8,A,T41,2E20.4)') &
1082 " Minimum/Maximum MO magnitude ", mo_mag_min, mo_mag_max
1083 END IF
1084 CALL cp_print_key_finished_output(iw, logger, scf_section, &
1085 "PRINT%MO_MAGNITUDE")
1086 END IF
1087 END IF
1088
1089 CALL timestop(handle)
1090
1091 END SUBROUTINE qs_scf_loop_print
1092
1093! **************************************************************************************************
1094!> \brief writes CDFT constraint information and optionally CDFT scf loop info
1095!> \param output_unit where to write the information
1096!> \param scf_control settings of the SCF loop
1097!> \param scf_env the env which holds convergence data
1098!> \param cdft_control the env which holds information about the constraint
1099!> \param energy the total energy
1100!> \param total_steps the total number of performed SCF iterations
1101!> \param should_stop if the calculation should stop
1102!> \param outer_loop_converged logical which determines if the CDFT SCF loop converged
1103!> \param cdft_loop logical which determines a CDFT SCF loop is active
1104!> \par History
1105!> 12.2015 created [Nico Holmberg]
1106! **************************************************************************************************
1107 SUBROUTINE qs_scf_cdft_info(output_unit, scf_control, scf_env, cdft_control, &
1108 energy, total_steps, should_stop, outer_loop_converged, &
1109 cdft_loop)
1110 INTEGER :: output_unit
1111 TYPE(scf_control_type), POINTER :: scf_control
1112 TYPE(qs_scf_env_type), POINTER :: scf_env
1113 TYPE(cdft_control_type), POINTER :: cdft_control
1114 TYPE(qs_energy_type), POINTER :: energy
1115 INTEGER :: total_steps
1116 LOGICAL, INTENT(IN) :: should_stop, outer_loop_converged, &
1117 cdft_loop
1118
1119 REAL(kind=dp) :: outer_loop_eps
1120
1121 IF (cdft_loop) THEN
1122 outer_loop_eps = sqrt(maxval(scf_env%outer_scf%gradient(:, scf_env%outer_scf%iter_count)**2))
1123 IF (output_unit > 0) WRITE (output_unit, '(/,T3,A,I4,A,E10.2,A,F22.10)') &
1124 "CDFT SCF iter = ", scf_env%outer_scf%iter_count, &
1125 " RMS gradient = ", outer_loop_eps, " energy =", energy%total
1126 IF (outer_loop_converged) THEN
1127 IF (output_unit > 0) WRITE (output_unit, '(T3,A,I4,A,I4,A,/)') &
1128 "CDFT SCF loop converged in", scf_env%outer_scf%iter_count, &
1129 " iterations or ", total_steps, " steps"
1130 END IF
1131 IF ((scf_env%outer_scf%iter_count > scf_control%outer_scf%max_scf .OR. should_stop) &
1132 .AND. .NOT. outer_loop_converged) THEN
1133 IF (output_unit > 0) WRITE (output_unit, '(T3,A,I4,A,I4,A,/)') &
1134 "CDFT SCF loop FAILED to converge after ", &
1135 scf_env%outer_scf%iter_count, " iterations or ", total_steps, " steps"
1136 END IF
1137 END IF
1138 CALL qs_scf_cdft_constraint_info(output_unit, cdft_control)
1139
1140 END SUBROUTINE qs_scf_cdft_info
1141
1142! **************************************************************************************************
1143!> \brief writes information about the CDFT env
1144!> \param output_unit where to write the information
1145!> \param cdft_control the CDFT env that stores information about the constraint calculation
1146!> \par History
1147!> 12.2015 created [Nico Holmberg]
1148! **************************************************************************************************
1149 SUBROUTINE qs_scf_cdft_initial_info(output_unit, cdft_control)
1150 INTEGER :: output_unit
1151 TYPE(cdft_control_type), POINTER :: cdft_control
1152
1153 IF (output_unit > 0) THEN
1154 WRITE (output_unit, '(/,A)') &
1155 " ---------------------------------- CDFT --------------------------------------"
1156 WRITE (output_unit, '(A)') &
1157 " Optimizing a density constraint in an external SCF loop "
1158 WRITE (output_unit, '(A)') " "
1159 SELECT CASE (cdft_control%type)
1161 WRITE (output_unit, '(A)') " Type of constraint: Hirshfeld"
1163 WRITE (output_unit, '(A)') " Type of constraint: Becke"
1164 END SELECT
1165 WRITE (output_unit, '(A,I8)') " Number of constraints: ", SIZE(cdft_control%group)
1166 WRITE (output_unit, '(A,L8)') " Using fragment densities:", cdft_control%fragment_density
1167 WRITE (output_unit, '(A)') " "
1168 IF (cdft_control%atomic_charges) WRITE (output_unit, '(A,/)') " Calculating atomic CDFT charges"
1169 SELECT CASE (cdft_control%constraint_control%optimizer)
1171 WRITE (output_unit, '(A)') &
1172 " Minimizer : SD : steepest descent"
1174 WRITE (output_unit, '(A)') &
1175 " Minimizer : DIIS : direct inversion"
1176 WRITE (output_unit, '(A)') &
1177 " in the iterative subspace"
1178 WRITE (output_unit, '(A,I3,A)') &
1179 " using ", &
1180 cdft_control%constraint_control%diis_buffer_length, " DIIS vectors"
1182 WRITE (output_unit, '(A)') &
1183 " Minimizer : BISECT : gradient bisection"
1184 WRITE (output_unit, '(A,I3)') &
1185 " using a trust count of", &
1186 cdft_control%constraint_control%bisect_trust_count
1189 CALL cdft_opt_type_write(cdft_control%constraint_control%cdft_opt_control, &
1190 cdft_control%constraint_control%optimizer, output_unit)
1192 WRITE (output_unit, '(A)') " Minimizer : Secant"
1193 CASE DEFAULT
1194 cpabort("Unknown CDFT outer_scf optimizer")
1195 END SELECT
1196 WRITE (output_unit, '(/,A,L7)') &
1197 " Reusing OT preconditioner: ", cdft_control%reuse_precond
1198 IF (cdft_control%reuse_precond) THEN
1199 WRITE (output_unit, '(A,I3,A,I3,A)') &
1200 " using old preconditioner for up to ", &
1201 cdft_control%max_reuse, " subsequent CDFT SCF"
1202 WRITE (output_unit, '(A,I3,A,I3,A)') &
1203 " iterations if the relevant loop converged in less than ", &
1204 cdft_control%precond_freq, " steps"
1205 END IF
1206 SELECT CASE (cdft_control%type)
1208 WRITE (output_unit, '(/,A)') " Hirshfeld constraint settings"
1209 WRITE (output_unit, '(A)') " "
1210 SELECT CASE (cdft_control%hirshfeld_control%shape_function)
1212 WRITE (output_unit, '(A, A8)') &
1213 " Shape function type: ", "Gaussian"
1214 WRITE (output_unit, '(A)', advance='NO') &
1215 " Type of Gaussian: "
1216 SELECT CASE (cdft_control%hirshfeld_control%gaussian_shape)
1217 CASE (radius_default)
1218 WRITE (output_unit, '(A13)') "Default"
1219 CASE (radius_covalent)
1220 WRITE (output_unit, '(A13)') "Covalent"
1221 CASE (radius_single)
1222 WRITE (output_unit, '(A13)') "Fixed radius"
1223 CASE (radius_vdw)
1224 WRITE (output_unit, '(A13)') "Van der Waals"
1225 CASE (radius_user)
1226 WRITE (output_unit, '(A13)') "User-defined"
1227
1228 END SELECT
1230 WRITE (output_unit, '(A, A8)') &
1231 " Shape function type: ", "Density"
1232 END SELECT
1234 WRITE (output_unit, '(/, A)') " Becke constraint settings"
1235 WRITE (output_unit, '(A)') " "
1236 SELECT CASE (cdft_control%becke_control%cutoff_type)
1237 CASE (becke_cutoff_global)
1238 WRITE (output_unit, '(A,F8.3,A)') &
1239 " Cutoff for partitioning :", cp_unit_from_cp2k(cdft_control%becke_control%rglobal, &
1240 "angstrom"), " angstrom"
1242 WRITE (output_unit, '(A)') &
1243 " Using element specific cutoffs for partitioning"
1244 END SELECT
1245 WRITE (output_unit, '(A,L7)') &
1246 " Skipping distant gpoints: ", cdft_control%becke_control%should_skip
1247 WRITE (output_unit, '(A,L7)') &
1248 " Precompute gradients : ", cdft_control%becke_control%in_memory
1249 WRITE (output_unit, '(A)') " "
1250 IF (cdft_control%becke_control%adjust) THEN
1251 WRITE (output_unit, '(A)') &
1252 " Using atomic radii to generate a heteronuclear charge partitioning"
1253 END IF
1254 WRITE (output_unit, '(A)') " "
1255 IF (.NOT. cdft_control%becke_control%cavity_confine) THEN
1256 WRITE (output_unit, '(A)') &
1257 " No confinement is active"
1258 ELSE
1259 WRITE (output_unit, '(A)') " Confinement using a Gaussian shaped cavity is active"
1260 SELECT CASE (cdft_control%becke_control%cavity_shape)
1261 CASE (radius_single)
1262 WRITE (output_unit, '(A,F8.4, A)') &
1263 " Type of Gaussian : Fixed radius: ", &
1264 cp_unit_from_cp2k(cdft_control%becke_control%rcavity, "angstrom"), " angstrom"
1265 CASE (radius_covalent)
1266 WRITE (output_unit, '(A)') &
1267 " Type of Gaussian : Covalent radius "
1268 CASE (radius_vdw)
1269 WRITE (output_unit, '(A)') &
1270 " Type of Gaussian : vdW radius "
1271 CASE (radius_user)
1272 WRITE (output_unit, '(A)') &
1273 " Type of Gaussian : User radius "
1274 END SELECT
1275 WRITE (output_unit, '(A,ES12.4)') &
1276 " Cavity threshold : ", cdft_control%becke_control%eps_cavity
1277 END IF
1278 END SELECT
1279 WRITE (output_unit, '(/,A)') &
1280 " ---------------------------------- CDFT --------------------------------------"
1281 END IF
1282
1283 END SUBROUTINE qs_scf_cdft_initial_info
1284
1285! **************************************************************************************************
1286!> \brief writes CDFT constraint information
1287!> \param output_unit where to write the information
1288!> \param cdft_control the env which holds information about the constraint
1289!> \par History
1290!> 08.2018 separated from qs_scf_cdft_info to make code callable elsewhere [Nico Holmberg]
1291! **************************************************************************************************
1292 SUBROUTINE qs_scf_cdft_constraint_info(output_unit, cdft_control)
1293 INTEGER :: output_unit
1294 TYPE(cdft_control_type), POINTER :: cdft_control
1295
1296 INTEGER :: igroup
1297
1298 IF (output_unit > 0) THEN
1299 SELECT CASE (cdft_control%type)
1301 WRITE (output_unit, '(/,T3,A,T60)') &
1302 '------------------- Hirshfeld constraint information -------------------'
1304 WRITE (output_unit, '(/,T3,A,T60)') &
1305 '--------------------- Becke constraint information ---------------------'
1306 CASE DEFAULT
1307 cpabort("Unknown CDFT constraint.")
1308 END SELECT
1309 DO igroup = 1, SIZE(cdft_control%target)
1310 IF (igroup > 1) WRITE (output_unit, '(T3,A)') ' '
1311 WRITE (output_unit, '(T3,A,T54,(3X,I18))') &
1312 'Atomic group :', igroup
1313 SELECT CASE (cdft_control%group(igroup)%constraint_type)
1315 IF (cdft_control%group(igroup)%is_fragment_constraint) THEN
1316 WRITE (output_unit, '(T3,A,T42,A)') &
1317 'Type of constraint :', adjustr('Charge density constraint (frag.)')
1318 ELSE
1319 WRITE (output_unit, '(T3,A,T50,A)') &
1320 'Type of constraint :', adjustr('Charge density constraint')
1321 END IF
1323 IF (cdft_control%group(igroup)%is_fragment_constraint) THEN
1324 WRITE (output_unit, '(T3,A,T35,A)') &
1325 'Type of constraint :', adjustr('Magnetization density constraint (frag.)')
1326 ELSE
1327 WRITE (output_unit, '(T3,A,T43,A)') &
1328 'Type of constraint :', adjustr('Magnetization density constraint')
1329 END IF
1331 IF (cdft_control%group(igroup)%is_fragment_constraint) THEN
1332 WRITE (output_unit, '(T3,A,T38,A)') &
1333 'Type of constraint :', adjustr('Alpha spin density constraint (frag.)')
1334 ELSE
1335 WRITE (output_unit, '(T3,A,T46,A)') &
1336 'Type of constraint :', adjustr('Alpha spin density constraint')
1337 END IF
1339 IF (cdft_control%group(igroup)%is_fragment_constraint) THEN
1340 WRITE (output_unit, '(T3,A,T39,A)') &
1341 'Type of constraint :', adjustr('Beta spin density constraint (frag.)')
1342 ELSE
1343 WRITE (output_unit, '(T3,A,T47,A)') &
1344 'Type of constraint :', adjustr('Beta spin density constraint')
1345 END IF
1346 CASE DEFAULT
1347 cpabort("Unknown constraint type.")
1348 END SELECT
1349 WRITE (output_unit, '(T3,A,T54,(3X,F18.12))') &
1350 'Target value of constraint :', cdft_control%target(igroup)
1351 WRITE (output_unit, '(T3,A,T54,(3X,F18.12))') &
1352 'Current value of constraint :', cdft_control%value(igroup)
1353 WRITE (output_unit, '(T3,A,T59,(3X,ES13.3))') &
1354 'Deviation from target :', cdft_control%value(igroup) - cdft_control%target(igroup)
1355 WRITE (output_unit, '(T3,A,T54,(3X,F18.12))') &
1356 'Strength of constraint :', cdft_control%strength(igroup)
1357 END DO
1358 WRITE (output_unit, '(T3,A)') &
1359 '------------------------------------------------------------------------'
1360 END IF
1361
1362 END SUBROUTINE qs_scf_cdft_constraint_info
1363
1364! **************************************************************************************************
1365!> \brief Print grand canonical SCF information for the current SCF iteration.
1366!> \param output_unit output unit used for SCF program run information
1367!> \param qs_env QS environment
1368!> \param just_energy whether this is an energy-only step
1369! **************************************************************************************************
1370 SUBROUTINE qs_scf_gce_info(output_unit, qs_env, just_energy)
1371
1372 INTEGER, INTENT(IN) :: output_unit
1373 TYPE(qs_environment_type), POINTER :: qs_env
1374 LOGICAL, INTENT(IN) :: just_energy
1375
1376 REAL(kind=dp) :: charge, current_wf_ev, delta_wf_ev, &
1377 free_ener, target_wf_ev
1378 TYPE(dft_control_type), POINTER :: dft_control
1379
1380 IF (output_unit <= 0) RETURN
1381 IF (just_energy) RETURN
1382
1383 current_wf_ev = qs_env%scf_control%gce%prev_workfunction*evolt
1384 target_wf_ev = qs_env%scf_control%gce%target_workfunction*evolt
1385 delta_wf_ev = current_wf_ev - target_wf_ev
1386
1387 CALL get_qs_env(qs_env, dft_control=dft_control)
1388 charge = dft_control%pcc_control%charge
1389 free_ener = (charge + dft_control%charge)*qs_env%scf_control%gce%prev_workfunction
1390
1391 WRITE (unit=output_unit, &
1392 fmt="(T8,A,T13,A,T24,A,T27,F6.1,A,T40,A,T56,A,T59,ES10.2,A)") &
1393 "GCE", "WF", "=", current_wf_ev, " eV", &
1394 "WF-TWF", "=", delta_wf_ev, " eV"
1395
1396 WRITE (unit=output_unit, &
1397 fmt="(T13,A,T24,A,T27,F7.3,A,T40,A,T56,A,T59,F14.10,A)") &
1398 "Charge", "=", charge, " e", &
1399 "GCE free energy", "=", free_ener, " a.u."
1400
1401 END SUBROUTINE qs_scf_gce_info
1402
1403END MODULE qs_scf_output
Types and set/get functions for auxiliary density matrix methods.
Definition admm_types.F:15
Contains methods used in the context of density fitting.
Definition admm_utils.F:15
subroutine, public admm_uncorrect_for_eigenvalues(ispin, admm_env, ks_matrix)
...
Definition admm_utils.F:127
subroutine, public admm_correct_for_eigenvalues(ispin, admm_env, ks_matrix)
...
Definition admm_utils.F:53
methods related to the blacs parallel environment
Defines control structures, which contain the parameters and the settings for the DFT-based calculati...
DBCSR output in CP2K.
subroutine, public cp_dbcsr_write_sparse_matrix(sparse_matrix, before, after, qs_env, para_env, first_row, last_row, first_col, last_col, scale, output_unit, omit_headers, cartesian_basis)
...
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_init_random(matrix, ncol, start_col)
fills a matrix with random numbers
various routines to log and control the output. The idea is that decisions about where to log should ...
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...
unit conversion facility
Definition cp_units.F:30
real(kind=dp) function, public cp_unit_from_cp2k(value, unit_str, defaults, power)
converts from the internal cp2k units to the given unit
Definition cp_units.F:1251
collects all constants needed in input so that they can be used without circular dependencies
integer, parameter, public smear_fermi_dirac
integer, parameter, public radius_vdw
integer, parameter, public outer_scf_optimizer_sd
integer, parameter, public cdft_beta_constraint
integer, parameter, public cdft_magnetization_constraint
integer, parameter, public outer_scf_optimizer_bisect
integer, parameter, public outer_scf_optimizer_secant
integer, parameter, public becke_cutoff_element
integer, parameter, public radius_default
integer, parameter, public outer_scf_optimizer_broyden
integer, parameter, public ot_precond_full_all_covariant
integer, parameter, public cdft_charge_constraint
integer, parameter, public outer_scf_becke_constraint
integer, parameter, public radius_user
integer, parameter, public smear_gaussian
integer, parameter, public shape_function_density
integer, parameter, public outer_scf_hirshfeld_constraint
integer, parameter, public radius_covalent
integer, parameter, public smear_mv
integer, parameter, public shape_function_gaussian
integer, parameter, public radius_single
integer, parameter, public outer_scf_optimizer_newton_ls
integer, parameter, public outer_scf_optimizer_newton
integer, parameter, public smear_mp
integer, parameter, public becke_cutoff_global
integer, parameter, public cdft_alpha_constraint
integer, parameter, public outer_scf_optimizer_diis
integer, parameter, public ot_precond_full_all
objects that represent the structure of input sections and the data contained in an input section
integer function, dimension(:), pointer, public section_get_ivals(section_vals, keyword_name)
...
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_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
sums arrays of real/complex numbers with much reduced round-off as compared to a naive implementation...
Definition kahan_sum.F:29
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
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, inversion_symmetry_only, symmetry_backend, symmetry_reduction_method, gamma_centered, lattice_fft)
Retrieve information from a kpoint environment.
Machine interface based on Fortran 2003 and POSIX.
Definition machine.F:17
subroutine, public m_flush(lunit)
flushes units if the &GLOBAL flag is set accordingly
Definition machine.F:124
Interface to the message passing library MPI.
Define the data structure for the particle information.
Definition of physical constants:
Definition physcon.F:68
real(kind=dp), parameter, public kcalmol
Definition physcon.F:171
real(kind=dp), parameter, public evolt
Definition physcon.F:183
types of preconditioners
computes preconditioners, and implements methods to apply them currently used in qs_ot
Types containing essential information for running implicit (iterative) Poisson solver.
integer, parameter, public neumann_bc
integer, parameter, public mixed_bc
integer, parameter, public mixed_periodic_bc
integer, parameter, public periodic_bc
container for various plainwaves related things
functions related to the poisson solver on regular grids
integer, parameter, public pw_poisson_implicit
Routines for image charge calculation within QM/MM.
subroutine, public print_image_coefficients(image_coeff, qs_env)
Print image coefficients.
Control parameters for optimizers that work with CDFT constraints.
subroutine, public cdft_opt_type_write(cdft_opt_control, optimizer, output_unit)
writes information about the CDFT optimizer object
Defines CDFT control structures.
container for information about total charges on the grids
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, matrix_vhxc, 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.
Definition and initialisation of the mo data type.
Definition qs_mo_io.F:21
subroutine, public write_mo_set_to_output_unit(mo_set, qs_kind_set, particle_set, dft_section, before, kpoint, final_mos, spin, solver_method, rtp, cpart, sim_step, umo_set, qs_env, para_env_inter_kp)
Write MO information to output file (eigenvalues, occupation numbers, coefficients).
Definition qs_mo_io.F:1025
collects routines that perform operations directly related to MOs
subroutine, public calculate_magnitude(mo_array, mo_mag_min, mo_mag_max)
...
subroutine, public calculate_orthonormality(orthonormality, mo_array, matrix_s)
...
Set occupation of molecular orbitals.
Definition and initialisation of the mo data type.
Definition qs_mo_types.F:22
subroutine, public init_mo_set(mo_set, fm_pool, fm_ref, fm_struct, name, counter)
initializes an allocated mo_set. eigenvalues, mo_coeff, occupation_numbers are valid only after this ...
subroutine, public allocate_mo_set(mo_set, nao, nmo, nelectron, n_el_f, maxocc, flexible_electron_count)
Allocates a mo set and partially initializes it (nao,nmo,nelectron, and flexible_electron_count are v...
subroutine, public deallocate_mo_set(mo_set)
Deallocate a wavefunction data structure.
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.
an eigen-space solver for the generalised symmetric eigenvalue problem for sparse matrices,...
subroutine, public ot_eigensolver(matrix_h, matrix_s, matrix_orthogonal_space_fm, matrix_c_fm, preconditioner, eps_gradient, iter_max, size_ortho_space, silent, ot_settings)
...
superstucture that hold various representations of the density and keeps track of which ones are vali...
subroutine, public qs_rho_get(rho_struct, rho_ao, rho_ao_im, rho_ao_kp, rho_ao_im_kp, rho_r, drho_r, rho_g, drho_g, tau_r, tau_g, rho_r_valid, drho_r_valid, rho_g_valid, drho_g_valid, tau_r_valid, tau_g_valid, tot_rho_r, tot_rho_g, rho_r_sccs, soft_valid, complex_rho_ao)
returns info about the density described by this object. If some representation is not available an e...
Self-consistent continuum solvation (SCCS) model implementation.
Definition qs_sccs.F:29
subroutine, public print_sccs_results(energy, sccs_control, output_unit)
Print SCCS results.
Definition qs_sccs.F:1501
subroutine, public qs_scf_print_summary(output_unit, qs_env)
writes a summary of information after scf
subroutine, public qs_scf_loop_info(scf_env, output_unit, just_energy, t1, t2, energy, adiis_verbose)
writes basic information obtained in a scf step
subroutine, public qs_scf_cdft_constraint_info(output_unit, cdft_control)
writes CDFT constraint information
subroutine, public qs_scf_loop_print(qs_env, scf_env, para_env)
collects the 'heavy duty' printing tasks out of the SCF loop
subroutine, public qs_scf_outer_loop_info(output_unit, scf_control, scf_env, energy, total_steps, should_stop, outer_loop_converged)
writes basic information obtained in a scf outer loop step
subroutine, public qs_scf_initial_info(output_unit, mos, dft_control, ndep)
writes basic information at the beginning of an scf run
subroutine, public qs_scf_write_mos(qs_env, scf_env, final_mos)
Write the MO eigenvector, eigenvalues, and occupation numbers to the output unit.
subroutine, public qs_scf_cdft_info(output_unit, scf_control, scf_env, cdft_control, energy, total_steps, should_stop, outer_loop_converged, cdft_loop)
writes CDFT constraint information and optionally CDFT scf loop info
subroutine, public qs_scf_cdft_initial_info(output_unit, cdft_control)
writes information about the CDFT env
subroutine, public qs_scf_gce_info(output_unit, qs_env, just_energy)
Print grand canonical SCF information for the current SCF iteration.
module that contains the definitions of the scf types
integer, parameter, public ot_method_nr
integer, parameter, public special_diag_method_nr
parameters that control an scf iteration
stores some data used in wavefunction fitting
Definition admm_types.F:120
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...
Contains information about kpoints.
stores all the informations relevant to an mpi environment
contained for different pw related things
Container for information about total charges on the grids.
Provides all information about a quickstep kind.
keeps the density in various representations, keeping track of which ones are valid.