25 dbcsr_type_no_symmetry
86#include "./base/base_uses.f90"
92 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'dm_ls_scf'
109 LOGICAL,
INTENT(IN),
OPTIONAL :: nonscf
111 CHARACTER(len=*),
PARAMETER :: routinen =
'ls_scf'
114 LOGICAL :: do_scf, pao_is_done
117 CALL timeset(routinen, handle)
119 IF (
PRESENT(nonscf)) do_scf = .NOT. nonscf
123 CALL get_qs_env(qs_env, ls_scf_env=ls_scf_env)
127 pao_is_done = .false.
128 DO WHILE (.NOT. pao_is_done)
129 CALL ls_scf_init_scf(qs_env, ls_scf_env, .false.)
130 CALL pao_update(qs_env, ls_scf_env, pao_is_done)
131 CALL ls_scf_main(qs_env, ls_scf_env, .false.)
133 CALL ls_scf_post(qs_env, ls_scf_env)
137 CALL ls_scf_init_scf(qs_env, ls_scf_env, .true.)
138 CALL ls_scf_main(qs_env, ls_scf_env, .true.)
139 CALL ls_scf_post(qs_env, ls_scf_env)
142 CALL timestop(handle)
155 SUBROUTINE ls_scf_init_scf(qs_env, ls_scf_env, nonscf)
158 LOGICAL,
INTENT(IN) :: nonscf
160 CHARACTER(len=*),
PARAMETER :: routinen =
'ls_scf_init_scf'
162 INTEGER :: handle, ispin, nspin, unit_nr
164 TYPE(
dbcsr_p_type),
DIMENSION(:),
POINTER :: matrix_s, matrix_w
170 CALL timeset(routinen, handle)
174 IF (logger%para_env%is_source())
THEN
181 CALL get_qs_env(qs_env, nelectron_total=ls_scf_env%nelectron_total, &
185 dft_control=dft_control, &
186 molecule_set=molecule_set, &
188 has_unit_metric=ls_scf_env%has_unit_metric, &
189 para_env=ls_scf_env%para_env, &
190 nelectron_spin=ls_scf_env%nelectron_spin)
193 ls_scf_env%calculate_forces =
ASSOCIATED(matrix_w)
199 CALL matrix_ls_create(matrix_ls=ls_scf_env%matrix_s, matrix_qs=matrix_s(1)%matrix, &
200 ls_mstruct=ls_scf_env%ls_mstruct)
202 nspin = ls_scf_env%nspins
203 IF (
ALLOCATED(ls_scf_env%matrix_p))
THEN
204 DO ispin = 1,
SIZE(ls_scf_env%matrix_p)
208 ALLOCATE (ls_scf_env%matrix_p(nspin))
212 CALL dbcsr_create(ls_scf_env%matrix_p(ispin), template=ls_scf_env%matrix_s, &
213 matrix_type=dbcsr_type_no_symmetry)
216 ALLOCATE (ls_scf_env%matrix_ks(nspin))
218 CALL dbcsr_create(ls_scf_env%matrix_ks(ispin), template=ls_scf_env%matrix_s, &
219 matrix_type=dbcsr_type_no_symmetry)
226 CALL ls_scf_initial_guess(qs_env, ls_scf_env, nonscf)
228 IF (ls_scf_env%do_rho_mixing)
THEN
232 IF (ls_scf_env%do_pexsi)
THEN
236 IF (qs_env%do_transport)
THEN
240 CALL timestop(handle)
242 END SUBROUTINE ls_scf_init_scf
253 SUBROUTINE ls_scf_initial_guess(qs_env, ls_scf_env, nonscf)
256 LOGICAL,
INTENT(IN) :: nonscf
258 CHARACTER(len=*),
PARAMETER :: routinen =
'ls_scf_initial_guess'
259 INTEGER,
PARAMETER :: aspc_guess = 2,
atomic_guess = 1, &
262 CHARACTER(LEN=default_path_length) :: file_name, project_name
263 INTEGER :: handle, iaspc, initial_guess_type, &
264 ispin, istore, naspc, unit_nr
265 REAL(kind=
dp) :: alpha, cs_pos
270 IF (ls_scf_env%do_pao)
RETURN
272 CALL timeset(routinen, handle)
276 IF (logger%para_env%is_source())
THEN
282 IF (unit_nr > 0)
WRITE (unit_nr,
'()')
284 IF (ls_scf_env%scf_history%istore == 0)
THEN
285 IF (ls_scf_env%restart_read)
THEN
291 initial_guess_type = aspc_guess
295 SELECT CASE (initial_guess_type)
298 IF (unit_nr > 0)
WRITE (unit_nr,
'()')
300 project_name = logger%iter_info%project_name
301 DO ispin = 1,
SIZE(ls_scf_env%matrix_p)
302 WRITE (file_name,
'(A,I0,A)') trim(project_name)//
"_LS_DM_SPIN_", ispin,
"_RESTART.dm"
304 CALL dbcsr_binary_read(file_name, distribution=dist, matrix_new=ls_scf_env%matrix_p(ispin))
306 IF (unit_nr > 0)
THEN
307 WRITE (unit_nr,
'(T2,A,E20.8)')
"Read restart DM "//trim(file_name)//
" with checksum: ", cs_pos
313 CALL ls_nonscf_ks(qs_env, ls_scf_env, ls_scf_env%energy_init)
315 CALL ls_scf_dm_to_ks(qs_env, ls_scf_env, ls_scf_env%energy_init, iscf=0)
320 naspc = min(ls_scf_env%scf_history%istore, ls_scf_env%scf_history%nstore)
321 DO ispin = 1,
SIZE(ls_scf_env%matrix_p)
323 CALL dbcsr_set(ls_scf_env%matrix_p(ispin), 0.0_dp)
325 alpha = (-1.0_dp)**(iaspc + 1)*real(iaspc, kind=
dp)* &
327 istore = mod(ls_scf_env%scf_history%istore - iaspc, ls_scf_env%scf_history%nstore) + 1
328 CALL dbcsr_add(ls_scf_env%matrix_p(ispin), ls_scf_env%scf_history%matrix(ispin, istore), 1.0_dp, alpha)
334 SELECT CASE (initial_guess_type)
340 IF (.NOT. (ls_scf_env%do_pexsi))
THEN
341 DO ispin = 1,
SIZE(ls_scf_env%matrix_p)
343 IF (
SIZE(ls_scf_env%matrix_p) == 1)
CALL dbcsr_scale(ls_scf_env%matrix_p(ispin), 0.5_dp)
345 CALL dbcsr_filter(ls_scf_env%matrix_p(ispin), ls_scf_env%eps_filter**(2.0_dp/3.0_dp))
346 CALL purify_mcweeny(ls_scf_env%matrix_p(ispin:ispin), ls_scf_env%eps_filter, 3)
347 IF (
SIZE(ls_scf_env%matrix_p) == 1)
CALL dbcsr_scale(ls_scf_env%matrix_p(ispin), 2.0_dp)
349 IF (ls_scf_env%use_s_sqrt)
THEN
351 CALL dbcsr_create(matrix_tmp1, template=ls_scf_env%matrix_s, &
352 matrix_type=dbcsr_type_no_symmetry)
353 CALL dbcsr_multiply(
"N",
"N", 1.0_dp, ls_scf_env%matrix_s_sqrt_inv, ls_scf_env%matrix_p(ispin), &
354 0.0_dp, matrix_tmp1, filter_eps=ls_scf_env%eps_filter)
355 CALL dbcsr_multiply(
"N",
"N", 1.0_dp, matrix_tmp1, ls_scf_env%matrix_s_sqrt_inv, &
356 0.0_dp, ls_scf_env%matrix_p(ispin), &
357 filter_eps=ls_scf_env%eps_filter)
360 IF (ls_scf_env%has_s_preconditioner)
THEN
362 ls_scf_env%matrix_bs_sqrt, ls_scf_env%matrix_bs_sqrt_inv)
370 CALL ls_nonscf_ks(qs_env, ls_scf_env, ls_scf_env%energy_init)
372 CALL ls_scf_dm_to_ks(qs_env, ls_scf_env, ls_scf_env%energy_init, iscf=0)
376 IF (unit_nr > 0)
THEN
377 WRITE (unit_nr,
'(T2,A,F20.9)')
"Energy with the initial guess:", ls_scf_env%energy_init
378 WRITE (unit_nr,
'()')
381 CALL timestop(handle)
383 END SUBROUTINE ls_scf_initial_guess
392 SUBROUTINE ls_scf_store_result(ls_scf_env)
395 CHARACTER(len=*),
PARAMETER :: routinen =
'ls_scf_store_result'
397 CHARACTER(LEN=default_path_length) :: file_name, project_name
398 INTEGER :: handle, ispin, istore, unit_nr
399 REAL(kind=
dp) :: cs_pos
403 CALL timeset(routinen, handle)
407 IF (logger%para_env%is_source())
THEN
413 IF (ls_scf_env%restart_write)
THEN
414 DO ispin = 1,
SIZE(ls_scf_env%matrix_p)
415 project_name = logger%iter_info%project_name
416 WRITE (file_name,
'(A,I0,A)') trim(project_name)//
"_LS_DM_SPIN_", ispin,
"_RESTART.dm"
418 IF (unit_nr > 0)
THEN
419 WRITE (unit_nr,
'(T2,A,E20.8)')
"Writing restart DM "//trim(file_name)//
" with checksum: ", cs_pos
421 IF (ls_scf_env%do_transport .OR. ls_scf_env%do_pexsi)
THEN
422 IF (unit_nr > 0)
THEN
423 WRITE (unit_nr,
'(T6,A)')
"The restart DM "//trim(file_name)//
" has the sparsity of S, therefore,"
424 WRITE (unit_nr,
'(T6,A)')
"not compatible with methods that require a full DM! "
431 IF (ls_scf_env%scf_history%nstore > 0)
THEN
432 ls_scf_env%scf_history%istore = ls_scf_env%scf_history%istore + 1
433 DO ispin = 1,
SIZE(ls_scf_env%matrix_p)
434 istore = mod(ls_scf_env%scf_history%istore - 1, ls_scf_env%scf_history%nstore) + 1
435 CALL dbcsr_copy(ls_scf_env%scf_history%matrix(ispin, istore), ls_scf_env%matrix_p(ispin))
438 IF (ls_scf_env%use_s_sqrt)
THEN
441 CALL dbcsr_create(matrix_tmp1, template=ls_scf_env%matrix_s, &
442 matrix_type=dbcsr_type_no_symmetry)
444 IF (ls_scf_env%has_s_preconditioner)
THEN
446 ls_scf_env%matrix_bs_sqrt, ls_scf_env%matrix_bs_sqrt_inv)
448 CALL dbcsr_multiply(
"N",
"N", 1.0_dp, ls_scf_env%matrix_s_sqrt, ls_scf_env%scf_history%matrix(ispin, istore), &
449 0.0_dp, matrix_tmp1, filter_eps=ls_scf_env%eps_filter)
450 CALL dbcsr_multiply(
"N",
"N", 1.0_dp, matrix_tmp1, ls_scf_env%matrix_s_sqrt, &
451 0.0_dp, ls_scf_env%scf_history%matrix(ispin, istore), &
452 filter_eps=ls_scf_env%eps_filter)
459 CALL timestop(handle)
461 END SUBROUTINE ls_scf_store_result
472 SUBROUTINE ls_scf_main(qs_env, ls_scf_env, nonscf)
475 LOGICAL,
INTENT(IN),
OPTIONAL :: nonscf
477 CHARACTER(len=*),
PARAMETER :: routinen =
'ls_scf_main'
479 INTEGER :: handle, iscf, ispin, &
480 nelectron_spin_real, nmixing, nspin, &
482 LOGICAL :: check_convergence, diis_step, do_transport, extra_scf, maxscf_reached, &
483 scf_converged, should_stop, transm_maxscf_reached, transm_scf_converged
484 REAL(kind=
dp) :: energy_diff, energy_new, energy_old, &
485 eps_diis, t1, t2, tdiag
487 TYPE(
dbcsr_p_type),
DIMENSION(:),
POINTER :: matrix_ks, matrix_s
488 TYPE(
dbcsr_type),
ALLOCATABLE,
DIMENSION(:) :: matrix_ks_deviation, matrix_mixing_old
493 CALL timeset(routinen, handle)
497 IF (logger%para_env%is_source())
THEN
503 nspin = ls_scf_env%nspins
506 ALLOCATE (matrix_mixing_old(nspin), matrix_ks_deviation(nspin))
508 CALL dbcsr_create(matrix_mixing_old(ispin), template=ls_scf_env%matrix_ks(ispin))
510 CALL dbcsr_create(matrix_ks_deviation(ispin), template=ls_scf_env%matrix_ks(ispin))
511 CALL dbcsr_set(matrix_ks_deviation(ispin), 0.0_dp)
513 ls_scf_env%homo_spin(:) = 0.0_dp
514 ls_scf_env%lumo_spin(:) = 0.0_dp
516 transm_scf_converged = .false.
517 transm_maxscf_reached = .false.
520 IF (ls_scf_env%scf_history%istore > 0) energy_old = ls_scf_env%energy_init
521 check_convergence = .true.
523 IF (ls_scf_env%ls_diis)
THEN
525 eps_diis = ls_scf_env%eps_diis
526 nmixing = ls_scf_env%nmixing
527 NULLIFY (diis_buffer)
528 ALLOCATE (diis_buffer)
530 nbuffer=ls_scf_env%max_diis)
535 CALL get_qs_env(qs_env, transport_env=transport_env, do_transport=do_transport)
541 CALL external_control(should_stop,
"SCF", start_time=qs_env%start_time, target_time=qs_env%target_time)
542 IF (do_transport)
THEN
543 maxscf_reached = should_stop .OR. iscf >= ls_scf_env%max_scf
546 IF (transm_maxscf_reached)
THEN
547 IF (unit_nr > 0)
WRITE (unit_nr,
'(T2,A)')
"SCF not converged! "
550 transm_maxscf_reached = maxscf_reached
552 IF (maxscf_reached)
THEN
553 IF (unit_nr > 0)
WRITE (unit_nr,
'(T2,A)')
"SCF not converged! "
558 IF (should_stop .OR. iscf >= ls_scf_env%max_scf)
THEN
559 IF (unit_nr > 0)
WRITE (unit_nr,
'(T2,A)')
"SCF not converged! "
561 IF (qs_env%energy_correction)
THEN
563 IF (ec_env%skip_ec) ec_env%do_skip = .true.
575 CALL matrix_qs_to_ls(ls_scf_env%matrix_ks(ispin), matrix_ks(ispin)%matrix, &
576 ls_scf_env%ls_mstruct, covariant=.true.)
577 IF (ls_scf_env%has_s_preconditioner)
THEN
579 ls_scf_env%matrix_bs_sqrt, ls_scf_env%matrix_bs_sqrt_inv)
581 CALL dbcsr_filter(ls_scf_env%matrix_ks(ispin), ls_scf_env%eps_filter)
584 IF ((iscf > 1 .OR. ls_scf_env%scf_history%istore > 0) .AND. ls_scf_env%curvy_steps)
THEN
590 CALL dbcsr_copy(matrix_mixing_old(ispin), ls_scf_env%matrix_ks(ispin))
591 ELSEIF (ls_scf_env%do_rho_mixing)
THEN
592 CALL dbcsr_copy(matrix_mixing_old(ispin), ls_scf_env%matrix_ks(ispin))
596 CALL dbcsr_copy(matrix_mixing_old(ispin), ls_scf_env%matrix_ks(ispin))
598 IF (ls_scf_env%ls_diis)
THEN
599 IF (diis_step .AND. (iscf - 1) .GE. ls_scf_env%iter_ini_diis)
THEN
600 IF (unit_nr > 0)
THEN
601 WRITE (unit_nr,
'(A61)') &
602 '*************************************************************'
603 WRITE (unit_nr,
'(A50,2(I3,A1),L1,A1)') &
604 " Using DIIS mixed KS: (iscf,INI_DIIS,DIIS_STEP)=(", &
605 iscf,
",", ls_scf_env%iter_ini_diis,
",", diis_step,
")"
606 WRITE (unit_nr,
'(A52)') &
607 " KS_nw= DIIS-Linear-Combination-Previous KS matrices"
608 WRITE (unit_nr,
'(61A)') &
609 "*************************************************************"
612 ls_scf_env%matrix_ks(ispin))
614 IF (unit_nr > 0)
THEN
615 WRITE (unit_nr,
'(A57)') &
616 "*********************************************************"
617 WRITE (unit_nr,
'(A23,F5.3,A25,I3)') &
618 " Using MIXING_FRACTION=", ls_scf_env%mixing_fraction, &
619 " to mix KS matrix: iscf=", iscf
620 WRITE (unit_nr,
'(A7,F5.3,A6,F5.3,A7)') &
621 " KS_nw=", ls_scf_env%mixing_fraction,
"*KS + ", &
622 1.0_dp - ls_scf_env%mixing_fraction,
"*KS_old"
623 WRITE (unit_nr,
'(A57)') &
624 "*********************************************************"
627 CALL dbcsr_add(matrix_mixing_old(ispin), &
628 ls_scf_env%matrix_ks(ispin), &
629 1.0_dp - ls_scf_env%mixing_fraction, &
630 ls_scf_env%mixing_fraction)
633 IF (unit_nr > 0)
THEN
634 WRITE (unit_nr,
'(A57)') &
635 "*********************************************************"
636 WRITE (unit_nr,
'(A23,F5.3,A25,I3)') &
637 " Using MIXING_FRACTION=", ls_scf_env%mixing_fraction, &
638 " to mix KS matrix: iscf=", iscf
639 WRITE (unit_nr,
'(A7,F5.3,A6,F5.3,A7)') &
640 " KS_nw=", ls_scf_env%mixing_fraction,
"*KS + ", &
641 1.0_dp - ls_scf_env%mixing_fraction,
"*KS_old"
642 WRITE (unit_nr,
'(A57)') &
643 "*********************************************************"
646 CALL dbcsr_add(matrix_mixing_old(ispin), &
647 ls_scf_env%matrix_ks(ispin), &
648 1.0_dp - ls_scf_env%mixing_fraction, &
649 ls_scf_env%mixing_fraction)
656 nelectron_spin_real = ls_scf_env%nelectron_spin(ispin)
657 IF (ls_scf_env%nspins == 1) nelectron_spin_real = nelectron_spin_real/2
659 IF (do_transport)
THEN
660 IF (ls_scf_env%has_s_preconditioner) &
661 cpabort(
"NOT YET IMPLEMENTED with S preconditioner. ")
663 cpabort(
"NOT YET IMPLEMENTED with molecular clustering. ")
665 extra_scf = maxscf_reached .OR. scf_converged
668 ls_scf_env%matrix_p(ispin), nelectron_spin_real, ls_scf_env%natoms, &
669 energy_diff, iscf, extra_scf)
672 SELECT CASE (ls_scf_env%purification_method)
674 CALL density_matrix_sign(ls_scf_env%matrix_p(ispin), ls_scf_env%mu_spin(ispin), ls_scf_env%fixed_mu, &
675 ls_scf_env%sign_method, ls_scf_env%sign_order, matrix_mixing_old(ispin), &
676 ls_scf_env%matrix_s, ls_scf_env%matrix_s_inv, nelectron_spin_real, &
677 ls_scf_env%eps_filter, ls_scf_env%sign_symmetric, ls_scf_env%submatrix_sign_method, &
678 ls_scf_env%matrix_s_sqrt_inv)
680 CALL density_matrix_tc2(ls_scf_env%matrix_p(ispin), matrix_mixing_old(ispin), ls_scf_env%matrix_s_sqrt_inv, &
681 nelectron_spin_real, ls_scf_env%eps_filter, ls_scf_env%homo_spin(ispin), &
682 ls_scf_env%lumo_spin(ispin), non_monotonic=ls_scf_env%non_monotonic, &
683 eps_lanczos=ls_scf_env%eps_lanczos, max_iter_lanczos=ls_scf_env%max_iter_lanczos, &
686 CALL density_matrix_trs4(ls_scf_env%matrix_p(ispin), matrix_mixing_old(ispin), ls_scf_env%matrix_s_sqrt_inv, &
687 nelectron_spin_real, ls_scf_env%eps_filter, ls_scf_env%homo_spin(ispin), &
688 ls_scf_env%lumo_spin(ispin), ls_scf_env%mu_spin(ispin), &
689 dynamic_threshold=ls_scf_env%dynamic_threshold, &
690 matrix_ks_deviation=matrix_ks_deviation(ispin), &
691 eps_lanczos=ls_scf_env%eps_lanczos, max_iter_lanczos=ls_scf_env%max_iter_lanczos, &
694 IF (ls_scf_env%has_s_preconditioner) &
695 cpabort(
"S preconditioning not implemented in combination with the PEXSI library. ")
697 CALL cp_abort(__location__, &
698 "Molecular clustering not implemented in combination with the PEXSI library. ")
699 CALL density_matrix_pexsi(ls_scf_env%pexsi, ls_scf_env%matrix_p(ispin), ls_scf_env%pexsi%matrix_w(ispin), &
700 ls_scf_env%pexsi%kTS(ispin), matrix_mixing_old(ispin), ls_scf_env%matrix_s, &
701 nelectron_spin_real, ls_scf_env%mu_spin(ispin), iscf, ispin)
705 IF (ls_scf_env%has_s_preconditioner)
THEN
707 ls_scf_env%matrix_bs_sqrt, ls_scf_env%matrix_bs_sqrt_inv)
709 CALL dbcsr_filter(ls_scf_env%matrix_p(ispin), ls_scf_env%eps_filter)
711 IF (ls_scf_env%nspins == 1)
CALL dbcsr_scale(ls_scf_env%matrix_p(ispin), 2.0_dp)
723 IF (ls_scf_env%do_pexsi)
THEN
724 CALL pexsi_to_qs(ls_scf_env, qs_env, kts=ls_scf_env%pexsi%kTS)
734 energy_diff = energy_new - energy_old
735 energy_old = energy_new
736 IF (unit_nr > 0)
THEN
738 WRITE (unit_nr,
'(T2,A,I6,F20.9,F20.9,F12.6)')
"SCF", iscf, energy_new, energy_diff, t2 - t1
744 IF (do_transport)
THEN
745 scf_converged = check_convergence .AND. abs(energy_diff) < ls_scf_env%eps_scf*ls_scf_env%nelectron_total
748 IF (transm_scf_converged)
EXIT
749 transm_scf_converged = scf_converged
751 IF (scf_converged)
THEN
752 IF (unit_nr > 0)
WRITE (unit_nr,
'(/,T2,A,I5,A/)')
"SCF run converged in ", iscf,
" steps."
758 IF (check_convergence .AND. abs(energy_diff) < ls_scf_env%eps_scf*ls_scf_env%nelectron_total)
THEN
759 IF (unit_nr > 0)
WRITE (unit_nr,
'(/,T2,A,I5,A/)')
"SCF run converged in ", iscf,
" steps."
761 IF (qs_env%energy_correction)
THEN
763 IF (ec_env%skip_ec) ec_env%do_skip = .false.
769 IF (ls_scf_env%ls_diis)
THEN
774 iscf, diis_step, eps_diis, nmixing, matrix_s(1)%matrix, &
775 ls_scf_env%eps_filter)
778 IF (ls_scf_env%do_pexsi)
THEN
780 ls_scf_env%eps_scf*ls_scf_env%nelectron_total, &
782 (iscf .EQ. 2) .AND. (ls_scf_env%scf_history%istore .EQ. 0), &
789 IF (ls_scf_env%ls_diis)
THEN
791 DEALLOCATE (diis_buffer)
797 DEALLOCATE (matrix_mixing_old, matrix_ks_deviation)
799 CALL timestop(handle)
801 END SUBROUTINE ls_scf_main
812 SUBROUTINE ls_scf_post(qs_env, ls_scf_env)
816 CHARACTER(len=*),
PARAMETER :: routinen =
'ls_scf_post'
818 INTEGER :: handle, ispin, unit_nr
824 CALL timeset(routinen, handle)
826 CALL get_qs_env(qs_env, dft_control=dft_control)
830 IF (logger%para_env%is_source())
THEN
837 IF (.NOT. ls_scf_env%do_pao) &
838 CALL ls_scf_store_result(ls_scf_env)
841 IF (ls_scf_env%curvy_steps)
THEN
842 CALL post_scf_homo_lumo(ls_scf_env)
845 IF (unit_nr > 0)
WRITE (unit_nr, *)
""
846 DO ispin = 1, ls_scf_env%nspins
848 IF (unit_nr > 0)
WRITE (unit_nr,
'(T2,A,F20.12)')
"Density matrix (P) occupation ", occ
853 IF (ls_scf_env%calculate_forces)
THEN
855 cpassert(
ASSOCIATED(matrix_w))
856 IF (ls_scf_env%do_pexsi)
THEN
857 CALL pexsi_to_qs(ls_scf_env, qs_env, matrix_w=ls_scf_env%pexsi%matrix_w)
865 IF (ls_scf_env%perform_mu_scan)
CALL post_scf_mu_scan(ls_scf_env)
869 IF (dft_control%qs_control%dftb)
THEN
871 ELSE IF (dft_control%qs_control%xtb)
THEN
877 IF (ls_scf_env%chebyshev%compute_chebyshev)
CALL compute_chebyshev(qs_env, ls_scf_env)
879 IF (.true.)
CALL post_scf_experiment()
881 IF (dft_control%qs_control%dftb .OR. dft_control%qs_control%xtb)
THEN
892 IF (ls_scf_env%has_s_preconditioner)
THEN
897 IF (ls_scf_env%needs_s_inv)
THEN
901 IF (ls_scf_env%use_s_sqrt)
THEN
906 DO ispin = 1,
SIZE(ls_scf_env%matrix_ks)
909 DEALLOCATE (ls_scf_env%matrix_ks)
911 IF (ls_scf_env%do_pexsi) &
914 CALL timestop(handle)
916 END SUBROUTINE ls_scf_post
925 SUBROUTINE post_scf_homo_lumo(ls_scf_env)
928 CHARACTER(len=*),
PARAMETER :: routinen =
'post_scf_homo_lumo'
930 INTEGER :: handle, ispin, nspin, unit_nr
932 REAL(kind=
dp) :: eps_max, eps_min, homo, lumo
934 TYPE(
dbcsr_type) :: matrix_k, matrix_p, matrix_tmp
936 CALL timeset(routinen, handle)
940 IF (logger%para_env%is_source())
THEN
946 IF (unit_nr > 0)
WRITE (unit_nr,
'(T2,A)')
""
949 cpassert(.NOT. ls_scf_env%has_s_preconditioner)
950 cpassert(ls_scf_env%use_s_sqrt)
952 nspin = ls_scf_env%nspins
954 CALL dbcsr_create(matrix_p, template=ls_scf_env%matrix_p(1), matrix_type=dbcsr_type_no_symmetry)
956 CALL dbcsr_create(matrix_k, template=ls_scf_env%matrix_p(1), matrix_type=dbcsr_type_no_symmetry)
958 CALL dbcsr_create(matrix_tmp, template=ls_scf_env%matrix_p(1), matrix_type=dbcsr_type_no_symmetry)
962 CALL dbcsr_multiply(
"N",
"N", 1.0_dp, ls_scf_env%matrix_s_sqrt_inv, ls_scf_env%matrix_ks(ispin), &
963 0.0_dp, matrix_tmp, filter_eps=ls_scf_env%eps_filter)
964 CALL dbcsr_multiply(
"N",
"N", 1.0_dp, matrix_tmp, ls_scf_env%matrix_s_sqrt_inv, &
965 0.0_dp, matrix_k, filter_eps=ls_scf_env%eps_filter)
968 CALL arnoldi_extremal(matrix_k, eps_max, eps_min, max_iter=ls_scf_env%max_iter_lanczos, &
969 threshold=ls_scf_env%eps_lanczos, converged=converged)
972 CALL dbcsr_multiply(
"N",
"N", 1.0_dp, ls_scf_env%matrix_s_sqrt, ls_scf_env%matrix_p(ispin), &
973 0.0_dp, matrix_tmp, filter_eps=ls_scf_env%eps_filter)
974 CALL dbcsr_multiply(
"N",
"N", 1.0_dp, matrix_tmp, ls_scf_env%matrix_s_sqrt, &
975 0.0_dp, matrix_p, filter_eps=ls_scf_env%eps_filter)
979 CALL compute_homo_lumo(matrix_k, matrix_p, eps_min, eps_max, ls_scf_env%eps_filter, &
980 ls_scf_env%max_iter_lanczos, ls_scf_env%eps_lanczos, homo, lumo, unit_nr)
988 CALL timestop(handle)
990 END SUBROUTINE post_scf_homo_lumo
999 SUBROUTINE post_scf_mu_scan(ls_scf_env)
1002 CHARACTER(len=*),
PARAMETER :: routinen =
'post_scf_mu_scan'
1004 INTEGER :: handle, imu, ispin, nelectron_spin_real, &
1006 REAL(kind=
dp) :: mu, t1, t2, trace
1010 CALL timeset(routinen, handle)
1014 IF (logger%para_env%is_source())
THEN
1020 nspin = ls_scf_env%nspins
1022 CALL dbcsr_create(matrix_p, template=ls_scf_env%matrix_p(1))
1029 mu = -0.4_dp + imu*(0.1_dp + 0.4_dp)/nmu
1031 IF (unit_nr > 0)
WRITE (unit_nr, *)
"------- starting with mu ", mu
1035 nelectron_spin_real = ls_scf_env%nelectron_spin(ispin)
1036 IF (ls_scf_env%nspins == 1) nelectron_spin_real = nelectron_spin_real/2
1039 ls_scf_env%sign_order, ls_scf_env%matrix_ks(ispin), &
1040 ls_scf_env%matrix_s, ls_scf_env%matrix_s_inv, &
1041 ls_scf_env%eps_filter, ls_scf_env%sign_symmetric, &
1042 ls_scf_env%submatrix_sign_method, ls_scf_env%matrix_s_sqrt_inv)
1047 IF (unit_nr > 0)
WRITE (unit_nr, *)
" obtained ", mu, trace, t2 - t1
1053 CALL timestop(handle)
1055 END SUBROUTINE post_scf_mu_scan
1068 CHARACTER(len=*),
PARAMETER :: routinen =
'post_scf_sparsities'
1070 CHARACTER(LEN=default_string_length) :: title
1071 INTEGER :: handle, ispin, nspin, unit_nr
1075 CALL timeset(routinen, handle)
1079 IF (logger%para_env%is_source())
THEN
1085 nspin = ls_scf_env%nspins
1087 IF (unit_nr > 0)
THEN
1088 WRITE (unit_nr,
'()')
1089 WRITE (unit_nr,
'(T2,A,E17.3)')
"Sparsity reports for eps_filter: ", ls_scf_env%eps_filter
1090 WRITE (unit_nr,
'()')
1093 CALL report_matrix_sparsity(ls_scf_env%matrix_s, unit_nr,
"overlap matrix (S)", &
1094 ls_scf_env%eps_filter)
1097 WRITE (title,
'(A,I3)')
"Kohn-Sham matrix (H) for spin ", ispin
1098 CALL report_matrix_sparsity(ls_scf_env%matrix_ks(ispin), unit_nr, title, &
1099 ls_scf_env%eps_filter)
1102 CALL dbcsr_create(matrix_tmp1, template=ls_scf_env%matrix_s, matrix_type=dbcsr_type_no_symmetry)
1103 CALL dbcsr_create(matrix_tmp2, template=ls_scf_env%matrix_s, matrix_type=dbcsr_type_no_symmetry)
1106 WRITE (title,
'(A,I3)')
"Density matrix (P) for spin ", ispin
1107 CALL report_matrix_sparsity(ls_scf_env%matrix_p(ispin), unit_nr, title, &
1108 ls_scf_env%eps_filter)
1110 CALL dbcsr_multiply(
"N",
"N", 1.0_dp, ls_scf_env%matrix_s, ls_scf_env%matrix_p(ispin), &
1111 0.0_dp, matrix_tmp1, filter_eps=ls_scf_env%eps_filter)
1113 WRITE (title,
'(A,I3,A)')
"S * P(", ispin,
")"
1114 CALL report_matrix_sparsity(matrix_tmp1, unit_nr, title, ls_scf_env%eps_filter)
1116 CALL dbcsr_multiply(
"N",
"N", 1.0_dp, matrix_tmp1, ls_scf_env%matrix_s, &
1117 0.0_dp, matrix_tmp2, filter_eps=ls_scf_env%eps_filter)
1118 WRITE (title,
'(A,I3,A)')
"S * P(", ispin,
") * S"
1119 CALL report_matrix_sparsity(matrix_tmp2, unit_nr, title, ls_scf_env%eps_filter)
1122 IF (ls_scf_env%needs_s_inv)
THEN
1123 CALL report_matrix_sparsity(ls_scf_env%matrix_s_inv, unit_nr,
"inv(S)", &
1124 ls_scf_env%eps_filter)
1126 CALL dbcsr_multiply(
"N",
"N", 1.0_dp, ls_scf_env%matrix_s_inv, ls_scf_env%matrix_ks(ispin), &
1127 0.0_dp, matrix_tmp1, filter_eps=ls_scf_env%eps_filter)
1129 WRITE (title,
'(A,I3,A)')
"inv(S) * H(", ispin,
")"
1130 CALL report_matrix_sparsity(matrix_tmp1, unit_nr, title, ls_scf_env%eps_filter)
1134 IF (ls_scf_env%use_s_sqrt)
THEN
1136 CALL report_matrix_sparsity(ls_scf_env%matrix_s_sqrt, unit_nr,
"sqrt(S)", &
1137 ls_scf_env%eps_filter)
1138 CALL report_matrix_sparsity(ls_scf_env%matrix_s_sqrt_inv, unit_nr,
"inv(sqrt(S))", &
1139 ls_scf_env%eps_filter)
1142 CALL dbcsr_multiply(
"N",
"N", 1.0_dp, ls_scf_env%matrix_s_sqrt_inv, ls_scf_env%matrix_ks(ispin), &
1143 0.0_dp, matrix_tmp1, filter_eps=ls_scf_env%eps_filter)
1144 CALL dbcsr_multiply(
"N",
"N", 1.0_dp, matrix_tmp1, ls_scf_env%matrix_s_sqrt_inv, &
1145 0.0_dp, matrix_tmp2, filter_eps=ls_scf_env%eps_filter)
1146 WRITE (title,
'(A,I3,A)')
"inv(sqrt(S)) * H(", ispin,
") * inv(sqrt(S))"
1147 CALL report_matrix_sparsity(matrix_tmp2, unit_nr, title, ls_scf_env%eps_filter)
1151 CALL dbcsr_multiply(
"N",
"N", 1.0_dp, ls_scf_env%matrix_s_sqrt, ls_scf_env%matrix_p(ispin), &
1152 0.0_dp, matrix_tmp1, filter_eps=ls_scf_env%eps_filter)
1153 CALL dbcsr_multiply(
"N",
"N", 1.0_dp, matrix_tmp1, ls_scf_env%matrix_s_sqrt, &
1154 0.0_dp, matrix_tmp2, filter_eps=ls_scf_env%eps_filter)
1155 WRITE (title,
'(A,I3,A)')
"sqrt(S) * P(", ispin,
") * sqrt(S)"
1156 CALL report_matrix_sparsity(matrix_tmp2, unit_nr, title, ls_scf_env%eps_filter)
1164 CALL timestop(handle)
1179 SUBROUTINE report_matrix_sparsity(matrix, unit_nr, title, eps)
1182 CHARACTER(LEN=*) :: title
1183 REAL(kind=
dp) :: eps
1185 CHARACTER(len=*),
PARAMETER :: routinen =
'report_matrix_sparsity'
1188 REAL(kind=
dp) :: eps_local, occ
1191 CALL timeset(routinen, handle)
1192 CALL dbcsr_create(matrix_tmp, template=matrix, name=trim(title))
1193 CALL dbcsr_copy(matrix_tmp, matrix, name=trim(title))
1195 IF (unit_nr > 0)
THEN
1196 WRITE (unit_nr,
'(T2,A)')
"Sparsity for : "//trim(title)
1199 eps_local = max(eps, 10e-14_dp)
1201 IF (eps_local > 1.1_dp)
EXIT
1204 IF (unit_nr > 0)
WRITE (unit_nr,
'(T2,F16.12,A3,F16.12)') eps_local,
" : ", occ
1205 eps_local = eps_local*10
1210 CALL timestop(handle)
1212 END SUBROUTINE report_matrix_sparsity
1226 CHARACTER(len=*),
PARAMETER :: routinen =
'calculate_w_matrix_ls'
1228 INTEGER :: handle, ispin
1229 REAL(kind=
dp) :: scaling
1230 TYPE(
dbcsr_type) :: matrix_tmp1, matrix_tmp2, matrix_tmp3
1232 CALL timeset(routinen, handle)
1234 CALL dbcsr_create(matrix_tmp1, template=ls_scf_env%matrix_s, matrix_type=dbcsr_type_no_symmetry)
1235 CALL dbcsr_create(matrix_tmp2, template=ls_scf_env%matrix_s, matrix_type=dbcsr_type_no_symmetry)
1236 CALL dbcsr_create(matrix_tmp3, template=ls_scf_env%matrix_s, matrix_type=dbcsr_type_no_symmetry)
1238 IF (ls_scf_env%nspins == 1)
THEN
1244 DO ispin = 1, ls_scf_env%nspins
1246 CALL dbcsr_copy(matrix_tmp3, ls_scf_env%matrix_ks(ispin))
1247 IF (ls_scf_env%has_s_preconditioner)
THEN
1249 ls_scf_env%matrix_bs_sqrt, ls_scf_env%matrix_bs_sqrt_inv)
1253 CALL dbcsr_multiply(
"N",
"N", scaling, ls_scf_env%matrix_p(ispin), matrix_tmp3, &
1254 0.0_dp, matrix_tmp1, filter_eps=ls_scf_env%eps_filter)
1255 CALL dbcsr_multiply(
"N",
"N", 1.0_dp, matrix_tmp1, ls_scf_env%matrix_p(ispin), &
1256 0.0_dp, matrix_tmp2, filter_eps=ls_scf_env%eps_filter)
1257 CALL matrix_ls_to_qs(matrix_w(ispin)%matrix, matrix_tmp2, ls_scf_env%ls_mstruct, covariant=.false.)
1264 CALL timestop(handle)
1274 SUBROUTINE post_scf_experiment()
1276 CHARACTER(len=*),
PARAMETER :: routinen =
'post_scf_experiment'
1278 INTEGER :: handle, unit_nr
1281 CALL timeset(routinen, handle)
1285 IF (logger%para_env%is_source())
THEN
1291 CALL timestop(handle)
1292 END SUBROUTINE post_scf_experiment
arnoldi iteration using dbcsr
subroutine, public arnoldi_extremal(matrix_a, max_ev, min_ev, converged, threshold, max_iter)
simple wrapper to estimate extremal eigenvalues with arnoldi, using the old lanczos interface this hi...
collects all references to literature in CP2K as new algorithms / method are included from literature...
integer, save, public kuhne2007
integer, save, public kolafa2004
Defines control structures, which contain the parameters and the settings for the DFT-based calculati...
subroutine, public dbcsr_scale(matrix, alpha_scalar)
...
subroutine, public dbcsr_copy(matrix_b, matrix_a, name, keep_sparsity, keep_imaginary)
...
subroutine, public dbcsr_multiply(transa, transb, alpha, matrix_a, matrix_b, beta, matrix_c, first_row, last_row, first_column, last_column, first_k, last_k, retain_sparsity, filter_eps, flop)
...
subroutine, public dbcsr_get_info(matrix, nblkrows_total, nblkcols_total, nfullrows_total, nfullcols_total, nblkrows_local, nblkcols_local, nfullrows_local, nfullcols_local, my_prow, my_pcol, local_rows, local_cols, proc_row_dist, proc_col_dist, row_blk_size, col_blk_size, row_blk_offset, col_blk_offset, distribution, name, matrix_type, group)
...
subroutine, public dbcsr_filter(matrix, eps)
...
subroutine, public dbcsr_binary_write(matrix, filepath)
...
real(kind=dp) function, public dbcsr_get_occupation(matrix)
...
subroutine, public dbcsr_set(matrix, alpha)
...
subroutine, public dbcsr_release(matrix)
...
subroutine, public dbcsr_binary_read(filepath, distribution, matrix_new)
...
subroutine, public dbcsr_add(matrix_a, matrix_b, alpha_scalar, beta_scalar)
...
real(kind=dp) function, public dbcsr_checksum(matrix, pos)
Calculates the checksum of a DBCSR matrix.
Routines to handle the external control of CP2K.
subroutine, public external_control(should_stop, flag, globenv, target_time, start_time, force_check)
External manipulations during a run : when the <PROJECT_NAME>.EXIT_$runtype command is sent the progr...
various routines to log and control the output. The idea is that decisions about where to log should ...
recursive integer function, public cp_logger_get_default_unit_nr(logger, local, skip_not_ionode)
asks the default unit number of the given logger. try to use cp_logger_get_unit_nr
type(cp_logger_type) function, pointer, public cp_get_default_logger()
returns the default logger
Routines using linear scaling chebyshev methods.
subroutine, public compute_chebyshev(qs_env, ls_scf_env)
compute properties based on chebyshev expansion
Routines for a linear scaling quickstep SCF run based on the density matrix.
subroutine, public ls_scf_create(qs_env)
Creation and basic initialization of the LS type.
density matrix optimization using exponential transformations
subroutine, public dm_ls_curvy_optimization(ls_scf_env, energy, check_conv)
driver routine for Head-Gordon curvy step approach
subroutine, public deallocate_curvy_data(curvy_data)
...
lower level routines for linear scaling SCF
subroutine, public density_matrix_trs4(matrix_p, matrix_ks, matrix_s_sqrt_inv, nelectron, threshold, e_homo, e_lumo, e_mu, dynamic_threshold, matrix_ks_deviation, max_iter_lanczos, eps_lanczos, converged, iounit)
compute the density matrix using a trace-resetting algorithm
subroutine, public ls_scf_init_matrix_s(matrix_s, ls_scf_env)
initialize S matrix related properties (sqrt, inverse...) Might be factored-out since this seems comm...
subroutine, public density_matrix_sign_fixed_mu(matrix_p, trace, mu, sign_method, sign_order, matrix_ks, matrix_s, matrix_s_inv, threshold, sign_symmetric, submatrix_sign_method, matrix_s_sqrt_inv)
for a fixed mu, compute the corresponding density matrix and its trace
subroutine, public apply_matrix_preconditioner(matrix, direction, matrix_bs_sqrt, matrix_bs_sqrt_inv)
apply a preconditioner either forward (precondition) inv(sqrt(bs)) * A * inv(sqrt(bs)) backward (rest...
subroutine, public density_matrix_sign(matrix_p, mu, fixed_mu, sign_method, sign_order, matrix_ks, matrix_s, matrix_s_inv, nelectron, threshold, sign_symmetric, submatrix_sign_method, matrix_s_sqrt_inv)
compute the density matrix with a trace that is close to nelectron. take a mu as input,...
subroutine, public density_matrix_tc2(matrix_p, matrix_ks, matrix_s_sqrt_inv, nelectron, threshold, e_homo, e_lumo, non_monotonic, eps_lanczos, max_iter_lanczos, iounit)
compute the density matrix using a non monotonic trace conserving algorithm based on SIAM DOI....
subroutine, public compute_homo_lumo(matrix_k, matrix_p, eps_min, eps_max, threshold, max_iter_lanczos, eps_lanczos, homo, lumo, unit_nr)
compute the homo and lumo given a KS matrix and a density matrix in the orthonormalized basis and the...
Routines for a linear scaling quickstep SCF run based on the density matrix, with a focus on the inte...
subroutine, public ls_scf_qs_atomic_guess(qs_env, ls_scf_env, energy, nonscf)
get an atomic initial guess
subroutine, public ls_nonscf_ks(qs_env, ls_scf_env, energy_new)
use the external density in ls_scf_env to compute the new KS matrix
subroutine, public matrix_ls_to_qs(matrix_qs, matrix_ls, ls_mstruct, covariant, keep_sparsity)
second link to QS, copy a LS matrix to QS matrix used to isolate QS style matrices from LS style will...
subroutine, public ls_scf_dm_to_ks(qs_env, ls_scf_env, energy_new, iscf)
use the density matrix in ls_scf_env to compute the new energy and KS matrix
subroutine, public rho_mixing_ls_init(qs_env, ls_scf_env)
Initialize g-space density mixing.
subroutine, public ls_nonscf_energy(qs_env, ls_scf_env)
use the new density matrix in ls_scf_env to compute the new energy
subroutine, public matrix_ls_create(matrix_ls, matrix_qs, ls_mstruct)
create a matrix for use (and as a template) in ls based on a qs template
subroutine, public matrix_qs_to_ls(matrix_ls, matrix_qs, ls_mstruct, covariant)
first link to QS, copy a QS matrix to LS matrix used to isolate QS style matrices from LS style will ...
subroutine, public ls_scf_init_qs(qs_env)
further required initialization of QS. Might be factored-out since this seems common code with the ot...
Types needed for a linear scaling quickstep SCF run based on the density matrix.
Routines for a linear scaling quickstep SCF run based on the density matrix.
subroutine, public post_scf_sparsities(ls_scf_env)
Report on the sparsities of various interesting matrices.
subroutine, public calculate_w_matrix_ls(matrix_w, ls_scf_env)
Compute matrix_w as needed for the forces.
subroutine, public ls_scf(qs_env, nonscf)
perform an linear scaling scf procedure: entry point
Types needed for a for a Energy Correction.
Routines useful for iterative matrix calculations.
Defines the basic variable types.
integer, parameter, public dp
integer, parameter, public default_string_length
integer, parameter, public default_path_length
Machine interface based on Fortran 2003 and POSIX.
subroutine, public m_flush(lunit)
flushes units if the &GLOBAL flag is set accordingly
real(kind=dp) function, public m_walltime()
returns time from a real-time clock, protected against rolling early/easily
Collection of simple mathematical functions and subroutines.
elemental real(kind=dp) function, public binomial(n, k)
The binomial coefficient n over k for 0 <= k <= n is calculated, otherwise zero is returned.
Define the data structure for the molecule information.
Main module for the PAO method.
subroutine, public pao_post_scf(qs_env, ls_scf_env, pao_is_done)
Calculate PAO forces and store density matrix for future ASPC extrapolations.
subroutine, public pao_update(qs_env, ls_scf_env, pao_is_done)
Called after the SCF optimization, updates the PAO basis.
subroutine, public pao_optimization_end(ls_scf_env)
Finish a PAO optimization run.
subroutine, public pao_optimization_start(qs_env, ls_scf_env)
Start a PAO optimization run.
Methods using the PEXSI library to calculate the density matrix and related quantities using the Kohn...
subroutine, public pexsi_to_qs(ls_scf_env, qs_env, kts, matrix_w)
Pass energy weighted density matrix and entropic energy contribution to QS environment.
subroutine, public density_matrix_pexsi(pexsi_env, matrix_p, matrix_w, kts, matrix_ks, matrix_s, nelectron_exact, mu, iscf, ispin)
Calculate density matrix, energy-weighted density matrix and entropic energy contribution with the DF...
subroutine, public pexsi_finalize_scf(pexsi_env, mu_spin)
Deallocations and post-processing after SCF.
subroutine, public pexsi_init_scf(ks_env, pexsi_env, template_matrix)
Initializations needed before SCF.
subroutine, public pexsi_set_convergence_tolerance(pexsi_env, delta_scf, eps_scf, initialize, check_convergence)
Set PEXSI convergence tolerance (numElectronPEXSITolerance), adapted to the convergence error of the ...
buffer for the diis of the scf
subroutine, public qs_diis_b_release_sparse(diis_buffer)
releases the given diis buffer (see doc/ReferenceCounting.html)
Apply the direct inversion in the iterative subspace (DIIS) of Pulay in the framework of an SCF itera...
pure subroutine, public qs_diis_b_create_sparse(diis_buffer, nbuffer)
Allocates an SCF DIIS buffer for LS-SCF calculation.
subroutine, public qs_diis_b_step_4lscf(diis_buffer, qs_env, ls_scf_env, unit_nr, iscf, diis_step, eps_diis, nmixing, s_matrix, threshold)
Update the SCF DIIS buffer in linear scaling SCF (LS-SCF), and if appropriate does a diis step.
pure subroutine, public qs_diis_b_clear_sparse(diis_buffer)
clears the DIIS buffer in LS-SCF calculation
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, 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, 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, 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, ecoul_1c, rho0_s_rs, rho0_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)
Get the QUICKSTEP environment.
Routines for Quickstep NON-SCF run.
subroutine, public qs_nonscf_print_summary(qs_env, tdiag, nelectron_total, iounit)
writes a summary of information after diagonalization
Does all kind of post scf calculations for GPW/GAPW.
subroutine, public write_mo_free_results(qs_env)
Write QS results always available (if switched on through the print_keys) Can be called from ls_scf.
subroutine, public qs_scf_post_moments(input, logger, qs_env, output_unit)
Computes and prints electric moments.
Does all kind of post scf calculations for DFTB.
subroutine, public scf_post_calculation_tb(qs_env, tb_type, no_mos)
collects possible post - scf calculations and prints info / computes properties.
CP2K transport environment and related C-interoperable types.
routines for DFT+NEGF calculations (coupling with the quantum transport code OMEN)
subroutine, public external_scf_method(transport_env, matrix_s, matrix_ks, matrix_p, nelectron_spin, natoms, energy_diff, iscf, extra_scf)
SCF calcualtion with an externally evaluated density matrix.
subroutine, public transport_initialize(ks_env, transport_env, template_matrix)
initializes the transport environment
type of a logger, at the moment it contains just a print level starting at which level it should be l...
Contains information on the energy correction functional for KG.
build array of pointers to diis buffers for sparse matrix case
calculation environment to calculate the ks matrix, holds all the needed vars. assumes that the core ...