22 dbcsr_type_no_symmetry,&
141#include "./base/base_uses.f90"
147 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'qs_scf_initialization'
176 CALL get_qs_env(qs_env, input=input, dft_control=dft_control)
179 IF (dft_control%hairy_probes .EQV. .true.)
THEN
182 atomic_kind_set=atomic_kind_set, &
183 qs_kind_set=qs_kind_set, &
184 particle_set=particle_set)
185 np =
SIZE(dft_control%probe)
187 CALL ao_boundaries(probe=dft_control%probe(ip), atomic_kind_set=atomic_kind_set, qs_kind_set=qs_kind_set, &
188 particle_set=particle_set, nao=mos(1)%nao)
192 IF (
PRESENT(scf_control))
THEN
193 my_scf_control => scf_control
195 CALL get_qs_env(qs_env, scf_control=my_scf_control)
199 IF (
PRESENT(scf_section))
THEN
200 my_scf_section => scf_section
205 CALL qs_scf_ensure_scf_env(qs_env, scf_env)
209 CALL qs_scf_ensure_mos(qs_env)
212 CALL qs_scf_ensure_diagonalization(scf_env, my_scf_section, qs_env, &
213 my_scf_control, qs_env%has_unit_metric)
215 CALL qs_scf_ensure_mixing(my_scf_control, my_scf_section, scf_env, dft_control)
217 CALL qs_scf_ensure_work_matrices(qs_env, scf_env)
219 CALL qs_scf_ensure_mixing_store(qs_env, scf_env, my_scf_control)
222 IF (dft_control%qs_control%cdft)
THEN
223 CALL qs_scf_ensure_cdft_loop_vars(qs_env, scf_env, dft_control, &
224 scf_control=my_scf_control)
226 CALL qs_scf_ensure_outer_loop_vars(scf_env, my_scf_control)
229 CALL init_scf_run(scf_env, qs_env, my_scf_section, my_scf_control)
246 CALL get_qs_env(qs_env, input=input, dft_control=dft_control)
248 CALL get_qs_env(qs_env, scf_control=scf_control)
252 CALL qs_scf_ensure_scf_env(qs_env, scf_env)
255 scf_control%use_diag = .true.
258 CALL qs_scf_ensure_mos(qs_env)
261 CALL qs_scf_ensure_diagonalization(scf_env, scf_section, qs_env, &
262 scf_control, qs_env%has_unit_metric)
263 CALL qs_scf_ensure_work_matrices(qs_env, scf_env)
265 CALL init_scf_run(scf_env, qs_env, scf_section, scf_control)
275 SUBROUTINE qs_scf_ensure_scf_env(qs_env, scf_env)
284 IF (.NOT.
ASSOCIATED(scf_env))
THEN
289 SELECT CASE (scf_env%mixing_method)
291 IF (
ASSOCIATED(scf_env%mixing_store))
THEN
297 IF (
ASSOCIATED(scf_env%mixing_store%rhoin))
THEN
298 IF (
SIZE(rho_g(1)%pw_grid%gsq) /=
SIZE(scf_env%mixing_store%rhoin(1)%cc))
THEN
300 DEALLOCATE (scf_env%mixing_store)
307 END SUBROUTINE qs_scf_ensure_scf_env
315 SUBROUTINE qs_scf_ensure_outer_loop_vars(scf_env, scf_control, nvar)
318 INTEGER,
OPTIONAL :: nvar
320 INTEGER :: nhistory, nvariables
322 IF (scf_control%outer_scf%have_scf)
THEN
323 nhistory = scf_control%outer_scf%max_scf + 1
324 IF (
PRESENT(nvar))
THEN
333 ALLOCATE (scf_env%outer_scf%variables(nvariables, nhistory))
334 ALLOCATE (scf_env%outer_scf%count(nhistory))
335 scf_env%outer_scf%count = 0
336 ALLOCATE (scf_env%outer_scf%gradient(nvariables, nhistory))
337 ALLOCATE (scf_env%outer_scf%energy(nhistory))
340 END SUBROUTINE qs_scf_ensure_outer_loop_vars
349 SUBROUTINE qs_scf_ensure_cdft_loop_vars(qs_env, scf_env, dft_control, scf_control)
355 INTEGER :: nhistory, nvariables
356 LOGICAL :: do_kpoints
357 REAL(kind=
dp),
DIMENSION(:, :),
POINTER :: gradient_history, outer_scf_history, &
360 NULLIFY (outer_scf_history, gradient_history, variable_history)
361 CALL get_qs_env(qs_env=qs_env, do_kpoints=do_kpoints)
364 cpabort(
"CDFT calculation not possible with kpoints")
369 IF (.NOT. scf_control%outer_scf%have_scf)
THEN
370 cpabort(
"Section SCF&OUTER_SCF must be active for CDFT calculations.")
373 IF (dft_control%qs_control%cdft_control%constraint_control%have_scf)
THEN
374 nhistory = dft_control%qs_control%cdft_control%constraint_control%max_scf + 1
377 dft_control%qs_control%cdft_control)
380 nvariables =
SIZE(dft_control%qs_control%cdft_control%target)
382 ALLOCATE (dft_control%qs_control%cdft_control%constraint%variables(nvariables, nhistory))
383 ALLOCATE (dft_control%qs_control%cdft_control%constraint%count(nhistory))
384 dft_control%qs_control%cdft_control%constraint%count = 0
385 ALLOCATE (dft_control%qs_control%cdft_control%constraint%gradient(nvariables, nhistory))
386 ALLOCATE (dft_control%qs_control%cdft_control%constraint%energy(nhistory))
387 CALL qs_scf_ensure_outer_loop_vars(scf_env, scf_control, nvariables)
392 IF (scf_control%outer_scf%have_scf)
THEN
394 dft_control%qs_control%cdft_control%ot_control%have_scf = .true.
395 dft_control%qs_control%cdft_control%ot_control%max_scf = scf_control%outer_scf%max_scf
396 dft_control%qs_control%cdft_control%ot_control%eps_scf = scf_control%outer_scf%eps_scf
397 dft_control%qs_control%cdft_control%ot_control%step_size = scf_control%outer_scf%step_size
398 dft_control%qs_control%cdft_control%ot_control%type = scf_control%outer_scf%type
399 dft_control%qs_control%cdft_control%ot_control%optimizer = scf_control%outer_scf%optimizer
400 dft_control%qs_control%cdft_control%ot_control%diis_buffer_length = scf_control%outer_scf%diis_buffer_length
401 dft_control%qs_control%cdft_control%ot_control%bisect_trust_count = scf_control%outer_scf%bisect_trust_count
402 CALL cdft_opt_type_copy(dft_control%qs_control%cdft_control%ot_control%cdft_opt_control, &
403 scf_control%outer_scf%cdft_opt_control)
405 nvariables =
SIZE(dft_control%qs_control%cdft_control%target)
406 IF (scf_control%outer_scf%extrapolation_order /= &
407 dft_control%qs_control%cdft_control%constraint_control%extrapolation_order &
408 .OR. nvariables /= 1)
THEN
409 DEALLOCATE (qs_env%outer_scf_history)
410 DEALLOCATE (qs_env%gradient_history)
411 DEALLOCATE (qs_env%variable_history)
412 nhistory = dft_control%qs_control%cdft_control%constraint_control%extrapolation_order
413 ALLOCATE (outer_scf_history(nvariables, nhistory))
414 ALLOCATE (gradient_history(nvariables, 2))
415 gradient_history = 0.0_dp
416 ALLOCATE (variable_history(nvariables, 2))
417 variable_history = 0.0_dp
418 CALL set_qs_env(qs_env, outer_scf_history=outer_scf_history, &
419 gradient_history=gradient_history, variable_history=variable_history)
425 END SUBROUTINE qs_scf_ensure_cdft_loop_vars
437 SUBROUTINE qs_scf_allocate_candidate_density(qs_env, candidate, nspins)
439 TYPE(
dbcsr_p_type),
DIMENSION(:, :),
POINTER :: candidate
440 INTEGER,
INTENT(IN) :: nspins
442 INTEGER :: ic, ispin, nimg
443 TYPE(
dbcsr_p_type),
DIMENSION(:, :),
POINTER :: matrix_s
449 NULLIFY (dft_control, matrix_s, refmatrix, sab_orb)
450 CALL get_qs_env(qs_env=qs_env, matrix_s_kp=matrix_s, sab_orb=sab_orb, dft_control=dft_control)
452 IF (
ASSOCIATED(candidate))
RETURN
454 refmatrix => matrix_s(1, 1)%matrix
455 nimg = dft_control%nimages
459 ALLOCATE (candidate(ispin, ic)%matrix)
460 CALL dbcsr_create(matrix=candidate(ispin, ic)%matrix, template=refmatrix, &
461 name=
"SCF DENSITY", matrix_type=dbcsr_type_symmetric)
463 CALL dbcsr_set(candidate(ispin, ic)%matrix, 0.0_dp)
467 END SUBROUTINE qs_scf_allocate_candidate_density
475 SUBROUTINE qs_scf_ensure_mixing_store(qs_env, scf_env, scf_control)
482 NULLIFY (dft_control)
483 CALL get_qs_env(qs_env=qs_env, dft_control=dft_control)
486 CALL qs_scf_allocate_candidate_density(qs_env, scf_env%p_mix_new, dft_control%nspins)
487 ELSE IF (scf_env%mixing_method > 0)
THEN
488 CALL mixing_allocate(qs_env, scf_env%mixing_method, scf_env%p_mix_new, &
489 scf_env%p_delta, dft_control%nspins, &
490 scf_env%mixing_store)
492 NULLIFY (scf_env%p_mix_new)
495 END SUBROUTINE qs_scf_ensure_mixing_store
504 SUBROUTINE qs_scf_ensure_work_matrices(qs_env, scf_env)
509 CHARACTER(LEN=*),
PARAMETER :: routinen =
'qs_scf_ensure_work_matrices'
511 INTEGER :: handle, is, nao, nrow_block, nw
512 LOGICAL :: do_kpoints
515 TYPE(
dbcsr_p_type),
DIMENSION(:, :),
POINTER :: matrix_s
521 CALL timeset(routinen, handle)
523 NULLIFY (ao_mo_fm_pools, ao_mo_fmstruct, ao_ao_fmstruct, dft_control, matrix_s, mos)
526 dft_control=dft_control, &
527 matrix_s_kp=matrix_s, &
529 scf_control=scf_control, &
530 do_kpoints=do_kpoints)
531 CALL mpools_get(qs_env%mpools, ao_mo_fm_pools=ao_mo_fm_pools)
538 nrow_block=nrow_block, &
539 ncol_block=nrow_block, &
542 template_fmstruct=ao_mo_fmstruct)
546 IF (.NOT.
ASSOCIATED(scf_env%scf_work1))
THEN
547 nw = dft_control%nspins
548 IF (do_kpoints) nw = 4
549 ALLOCATE (scf_env%scf_work1(nw))
550 DO is = 1,
SIZE(scf_env%scf_work1)
552 matrix_struct=ao_ao_fmstruct, &
553 name=
"SCF-WORK_MATRIX-1-"//trim(adjustl(
cp_to_string(is))))
556 IF ((.NOT.
ASSOCIATED(scf_env%ortho)) .AND. &
558 dft_control%qs_control%dftb .OR. dft_control%qs_control%xtb .OR. &
559 dft_control%qs_control%semi_empirical) .AND. &
562 ALLOCATE (scf_env%ortho)
564 matrix_struct=ao_ao_fmstruct, &
565 name=
"SCF-ORTHO_MATRIX")
568 ref_matrix => matrix_s(1, 1)%matrix
570 CALL dbcsr_create(scf_env%ortho_dbcsr, template=ref_matrix, &
571 matrix_type=dbcsr_type_no_symmetry)
573 CALL dbcsr_create(scf_env%buf1_dbcsr, template=ref_matrix, &
574 matrix_type=dbcsr_type_no_symmetry)
576 CALL dbcsr_create(scf_env%buf2_dbcsr, template=ref_matrix, &
577 matrix_type=dbcsr_type_no_symmetry)
579 (scf_control%level_shift /= 0.0_dp .AND. &
581 ALLOCATE (scf_env%ortho_m1)
583 matrix_struct=ao_ao_fmstruct, &
584 name=
"SCF-ORTHO_MATRIX-1")
587 IF (.NOT.
ASSOCIATED(scf_env%scf_work2))
THEN
588 ALLOCATE (scf_env%scf_work2)
590 matrix_struct=ao_ao_fmstruct, &
591 name=
"SCF-WORK_MATRIX-2")
595 IF (dft_control%dft_plus_u)
THEN
597 IF (.NOT.
ASSOCIATED(scf_env%s_half))
THEN
598 ALLOCATE (scf_env%s_half)
600 matrix_struct=ao_ao_fmstruct, &
601 name=
"S**(1/2) MATRIX")
607 IF (.NOT.
ASSOCIATED(scf_env%scf_work1))
THEN
609 ALLOCATE (scf_env%scf_work1(nw))
610 DO is = 1,
SIZE(scf_env%scf_work1)
612 matrix_struct=ao_ao_fmstruct, &
613 name=
"SCF-WORK_MATRIX-1-"//trim(adjustl(
cp_to_string(is))))
620 CALL timestop(handle)
622 END SUBROUTINE qs_scf_ensure_work_matrices
628 SUBROUTINE qs_scf_ensure_mos(qs_env)
631 CHARACTER(len=*),
PARAMETER :: routinen =
'qs_scf_ensure_mos'
633 INTEGER :: handle, ic, ik, ikk, ispin, nmo, nmo_mat
635 TYPE(
cp_fm_type),
POINTER :: mo_coeff, mo_coeff_last
637 TYPE(
dbcsr_p_type),
DIMENSION(:, :),
POINTER :: matrix_s
641 TYPE(
mo_set_type),
DIMENSION(:),
POINTER :: mos, mos_last_converged
642 TYPE(
mo_set_type),
DIMENSION(:, :),
POINTER :: mos_k
645 CALL timeset(routinen, handle)
647 NULLIFY (ao_mo_fm_pools, dft_control, mos, xas_env, matrix_s, mos_last_converged, mo_coeff_last)
650 dft_control=dft_control, &
652 matrix_s_kp=matrix_s, &
654 CALL mpools_get(qs_env%mpools, ao_mo_fm_pools=ao_mo_fm_pools)
655 IF (dft_control%switch_surf_dip)
THEN
656 CALL get_qs_env(qs_env, mos_last_converged=mos_last_converged)
659 nmo_mat = dft_control%nspins
660 IF (dft_control%restricted) nmo_mat = 1
663 cpassert(
ASSOCIATED(mos))
664 DO ispin = 1,
SIZE(mos)
665 CALL get_mo_set(mos(ispin), mo_coeff=mo_coeff, mo_coeff_b=mo_coeff_b)
666 IF (.NOT.
ASSOCIATED(mo_coeff))
THEN
668 fm_pool=ao_mo_fm_pools(ispin)%pool, &
671 IF (.NOT.
ASSOCIATED(mo_coeff_b))
THEN
675 sym=dbcsr_type_no_symmetry)
679 IF (qs_env%requires_mo_derivs)
THEN
681 IF (.NOT.
ASSOCIATED(mo_derivs))
THEN
682 ALLOCATE (mo_derivs(nmo_mat))
683 DO ispin = 1, nmo_mat
684 CALL get_mo_set(mos(ispin), mo_coeff_b=mo_coeff_b)
685 NULLIFY (mo_derivs(ispin)%matrix)
687 CALL dbcsr_create(mo_derivs(ispin)%matrix, template=mo_coeff_b, &
688 name=
"mo_derivs", matrix_type=dbcsr_type_no_symmetry)
698 IF (dft_control%do_admm)
THEN
699 IF (dft_control%restricted) cpabort(
"ROKS with ADMM is not implemented")
703 IF (dft_control%switch_surf_dip)
THEN
704 cpassert(
ASSOCIATED(mos_last_converged))
705 DO ispin = 1,
SIZE(mos_last_converged)
706 CALL get_mo_set(mos_last_converged(ispin), mo_coeff=mo_coeff_last)
707 IF (.NOT.
ASSOCIATED(mo_coeff_last))
THEN
709 fm_ref=mos(ispin)%mo_coeff, &
710 name=
"qs_env%mos_last_converged"//trim(adjustl(
cp_to_string(ispin))))
715 CALL get_qs_env(qs_env=qs_env, kpoints=kpoints)
716 IF (kpoints%nkp /= 0)
THEN
718 IF (qs_env%requires_mo_derivs)
THEN
719 cpwarn(
"MO derivative methods flag has been switched off for kpoint calculation")
722 qs_env%requires_mo_derivs = .false.
724 IF (dft_control%do_xas_calculation)
THEN
725 cpabort(
"No XAS implemented with kpoints")
727 IF (qs_env%do_rixs)
THEN
728 cpabort(
"RIXS not implemented with kpoints")
730 DO ik = 1,
SIZE(kpoints%kp_env)
731 CALL mpools_get(kpoints%mpools, ao_mo_fm_pools=ao_mo_fm_pools)
732 mos_k => kpoints%kp_env(ik)%kpoint_env%mos
733 ikk = kpoints%kp_range(1) + ik - 1
734 cpassert(
ASSOCIATED(mos_k))
735 DO ispin = 1,
SIZE(mos_k, 2)
736 DO ic = 1,
SIZE(mos_k, 1)
737 CALL get_mo_set(mos_k(ic, ispin), mo_coeff=mo_coeff, mo_coeff_b=mo_coeff_b)
738 IF (.NOT.
ASSOCIATED(mo_coeff))
THEN
740 fm_pool=ao_mo_fm_pools(ispin)%pool, &
745 cpassert(.NOT.
ASSOCIATED(mo_coeff_b))
751 CALL timestop(handle)
753 END SUBROUTINE qs_scf_ensure_mos
762 SUBROUTINE qs_scf_ensure_mixing(scf_control, scf_section, scf_env, dft_control)
771 CALL cite_reference(
hu2010)
775 scf_env%p_mix_alpha = 1.0_dp
776 scf_env%skip_diis = scf_control%max_diis < 2 .OR. &
777 scf_control%eps_diis < scf_control%eps_scf
778 IF (scf_control%eps_diis < scf_control%eps_scf)
THEN
779 cpwarn(
"the ADIIS to DIIS switch is disabled, since EPS_DIIS < EPS_SCF")
784 SELECT CASE (scf_control%mixing_method)
787 scf_env%p_mix_alpha = 1.0_dp
790 scf_env%mixing_method = scf_control%mixing_method
792 IF (.NOT.
ASSOCIATED(scf_env%mixing_store))
THEN
793 ALLOCATE (scf_env%mixing_store)
795 dft_control%qs_control%cutoff)
798 cpabort(
"Unknown mixing method")
805 scf_env%p_mix_alpha = 1.0_dp
806 scf_env%skip_diis = .true.
809 IF (scf_control%use_diag .AND. scf_env%mixing_method ==
no_mixing_nr)
THEN
810 cpabort(
"Diagonalization procedures without mixing are not recommendable")
814 scf_env%skip_diis = .true.
815 scf_env%p_mix_alpha = scf_env%mixing_store%alpha
816 IF (scf_env%mixing_store%beta == 0.0_dp)
THEN
817 cpabort(
"Mixing employing the Kerker damping factor needs BETA /= 0.0")
822 scf_env%p_mix_alpha = scf_env%mixing_store%alpha
823 IF (scf_control%eps_diis < scf_control%eps_scf)
THEN
824 scf_env%skip_diis = .true.
825 cpwarn(
"the DIIS scheme is disabled, since EPS_DIIS < EPS_SCF")
829 END SUBROUTINE qs_scf_ensure_mixing
840 SUBROUTINE qs_scf_ensure_diagonalization(scf_env, scf_section, qs_env, &
841 scf_control, has_unit_metric)
846 LOGICAL :: has_unit_metric
848 INTEGER :: ispin, kplocal, nao, nmo
849 INTEGER,
DIMENSION(2) :: kp_range
850 LOGICAL :: do_kpoints, need_coeff_b, not_se_or_tb, &
857 CALL get_qs_env(qs_env=qs_env, do_kpoints=do_kpoints, dft_control=dft_control, mos=mos)
858 not_se_or_tb = .NOT. (dft_control%qs_control%dftb .OR. dft_control%qs_control%xtb .OR. &
859 dft_control%qs_control%semi_empirical)
860 need_coeff_b = .false.
861 ot_energies = .false.
862 scf_env%needs_ortho = .false.
864 IF (dft_control%smeagol_control%smeagol_enabled .AND. &
867 scf_env%skip_diis = .true.
868 scf_control%use_diag = .false.
870 IF (.NOT. do_kpoints)
THEN
871 cpabort(
"SMEAGOL requires kpoint calculations")
873 cpwarn_if(scf_control%use_ot,
"OT is irrelevant to NEGF method")
876 IF (scf_control%use_diag)
THEN
878 IF (dft_control%restricted)
THEN
879 cpabort(
"OT only for restricted (ROKS)")
881 SELECT CASE (scf_control%diagonalization%method)
883 IF (.NOT. not_se_or_tb)
THEN
884 cpabort(
"TB and SE not possible with block iterative diagonalization")
887 SELECT CASE (scf_control%diagonalization%method)
891 scf_env%needs_ortho = (.NOT. has_unit_metric) .AND. (.NOT. do_kpoints)
894 scf_control%level_shift == 0.0_dp .AND. &
898 scf_env%needs_ortho = .false.
901 IF (has_unit_metric)
THEN
905 IF (dft_control%roks)
THEN
906 cpabort(
"ROKS with OT diagonalization not possible")
909 need_coeff_b = .true.
913 IF (dft_control%roks)
THEN
914 cpabort(
"ROKS with block PF diagonalization not possible")
917 cpabort(
"Block Krylov diagonalization not possible with kpoint calculations")
920 scf_env%needs_ortho = .true.
921 IF (.NOT.
ASSOCIATED(scf_env%krylov_space))
THEN
929 IF (dft_control%roks)
THEN
930 cpabort(
"Block Davidson not possible with ROKS")
934 IF (.NOT.
ASSOCIATED(scf_env%block_davidson_env))
THEN
935 CALL get_qs_env(qs_env=qs_env, kpoints=kpoints)
937 kplocal = kp_range(2) - kp_range(1) + 1
939 kplocal*dft_control%nspins, scf_section)
941 need_coeff_b = .false.
943 IF (.NOT.
ASSOCIATED(scf_env%block_davidson_env))
THEN
947 DO ispin = 1, dft_control%nspins
948 CALL get_mo_set(mo_set=mos(ispin), mo_coeff=mo_coeff, nao=nao, nmo=nmo)
951 need_coeff_b = .true.
965 cpabort(
"Unknown diagonalization method")
968 IF (scf_control%do_diag_sub)
THEN
969 scf_env%needs_ortho = .true.
970 IF (.NOT.
ASSOCIATED(scf_env%subspace_env))
THEN
972 dft_control%qs_control%cutoff)
976 cpabort(
"No subspace diagonlization with kpoint calculation")
980 ELSE IF (scf_control%use_ot)
THEN
982 need_coeff_b = .true.
984 IF (sum(abs(scf_control%added_mos)) > 0 .AND. &
985 (.NOT. do_kpoints .OR. .NOT. ot_energies))
THEN
986 cpabort(
"OT with ADDED_MOS currently requires complex K points and OT%ENERGIES.")
988 IF (dft_control%restricted .AND. dft_control%nspins /= 2)
THEN
989 cpabort(
"nspin must be 2 for restricted (ROKS)")
993 cpabort(
"OT or DIAGONALIZATION have to be set")
995 DO ispin = 1, dft_control%nspins
996 mos(ispin)%use_mo_coeff_b = need_coeff_b
999 END SUBROUTINE qs_scf_ensure_diagonalization
1012 SUBROUTINE init_scf_run(scf_env, qs_env, scf_section, scf_control)
1019 CHARACTER(LEN=*),
PARAMETER :: routinen =
'init_scf_run'
1021 INTEGER :: after, handle, homo, ii, ikind, ispin, &
1022 iw, nao, ndep, needed_evals, nmo, &
1024 LOGICAL :: dft_plus_u_atom, do_kpoints, &
1025 init_u_ramping_each_scf, omit_headers, &
1026 s_minus_half_available
1027 REAL(kind=
dp) :: u_ramping
1028 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:) :: evals
1029 REAL(kind=
dp),
DIMENSION(:),
POINTER :: eigenvalues
1036 TYPE(
dbcsr_p_type),
DIMENSION(:, :),
POINTER :: matrix_s_kp
1041 TYPE(
qs_kind_type),
DIMENSION(:),
POINTER :: qs_kind_set
1046 CALL timeset(routinen, handle)
1048 NULLIFY (qs_kind_set, matrix_s, dft_control, mos, qs_kind, rho, xas_env, mo_coeff)
1052 cpassert(
ASSOCIATED(scf_env))
1053 cpassert(
ASSOCIATED(qs_env))
1056 s_minus_half_available = .false.
1058 dft_control=dft_control, &
1059 qs_kind_set=qs_kind_set, &
1062 nelectron_total=scf_env%nelectron, &
1063 do_kpoints=do_kpoints, &
1064 para_env=para_env, &
1068 IF (dft_control%qs_control%xtb_control%do_tblite)
THEN
1070 CALL cp_warn(__location__, &
1071 "CP2K/tblite with OT updates the tblite SCC variables directly from the OT density; "// &
1072 "XTB/SCC_MIXER is ignored.")
1073 IF (scf_control%smear%do_smear .AND. &
1074 dft_control%qs_control%xtb_control%tblite_method ==
gfn2xtb)
THEN
1075 CALL cp_warn(__location__, &
1076 "Direct GFN2/tblite smearing has indefinite shell and multipole SCC modes. "// &
1077 "Use SCF/DIAGONALIZATION ALGORITHM OT with XTB/SCC_MIXER TBLITE or CP2K.")
1078 cpabort(
"Use fixed-H OT for GFN2 smearing")
1085 IF (scf_env%needs_ortho)
THEN
1101 ALLOCATE (evals(nao))
1113 IF (evals(ii) > scf_control%eps_eigval)
THEN
1118 needed_evals = nao - ndep
1121 evals(1:ndep) = 0.0_dp
1123 evals(ndep + 1:nao) = 1.0_dp/sqrt(evals(ndep + 1:nao))
1128 nrow_global=nao, ncol_global=needed_evals)
1130 ALLOCATE (scf_env%ortho_red, scf_env%scf_work2_red)
1135 IF (scf_control%level_shift /= 0.0_dp)
THEN
1137 nrow_global=needed_evals, ncol_global=nao)
1139 ALLOCATE (scf_env%ortho_m1_red)
1144 ALLOCATE (scf_env%scf_work1_red(
SIZE(scf_env%scf_work1)))
1145 DO ispin = 1,
SIZE(scf_env%scf_work1)
1147 nrow_global=needed_evals, ncol_global=needed_evals)
1148 CALL cp_fm_create(scf_env%scf_work1_red(ispin), fm_struct)
1153 CALL cp_fm_to_fm(evecs, scf_env%ortho_red, needed_evals, ndep + 1, 1)
1155 IF (scf_control%level_shift /= 0.0_dp)
THEN
1163 DO ispin = 1,
SIZE(mos)
1164 CALL get_mo_set(mos(ispin), nmo=nmo, mo_coeff=mo_coeff, homo=homo, eigenvalues=eigenvalues)
1165 IF (needed_evals < nmo)
THEN
1166 IF (needed_evals < homo)
THEN
1167 CALL cp_abort(__location__, &
1168 "The numerical rank of the overlap matrix is lower than the "// &
1169 "number of orbitals to be occupied! Check the geometry or increase "// &
1170 "EPS_DEFAULT or EPS_PGF_ORB!")
1172 CALL cp_warn(__location__, &
1173 "The numerical rank of the overlap matrix is lower than the number of requested MOs! "// &
1174 "Reduce the number of MOs to the number of available MOs. If necessary, "// &
1175 "request a lower number of MOs or increase EPS_DEFAULT or EPS_PGF_ORB.")
1176 CALL set_mo_set(mos(ispin), nmo=needed_evals)
1179 CALL cp_fm_to_fm(evecs, mo_coeff, min(ndep, max(0, nmo - needed_evals)), 1, needed_evals + 1)
1182 eigenvalues(needed_evals + 1:min(nao, nmo)) = 1.0_dp/scf_control%eps_eigval
1186 CALL parallel_gemm(
"N",
"T", nao, nao, needed_evals, 1.0_dp, scf_env%ortho_red, evecs, &
1187 0.0_dp, scf_env%ortho, b_first_col=ndep + 1)
1189 IF (scf_control%level_shift /= 0.0_dp)
THEN
1191 evals(ndep + 1:nao) = 1.0_dp/evals(ndep + 1:nao)
1194 CALL parallel_gemm(
"T",
"T", nao, nao, needed_evals, 1.0_dp, scf_env%ortho_m1_red, evecs, &
1195 0.0_dp, scf_env%ortho_m1, b_first_col=ndep + 1)
1200 s_minus_half_available = .true.
1204 qs_env%input,
"DFT%PRINT%AO_MATRICES/ORTHO"),
cp_p_file))
THEN
1208 CALL section_vals_val_get(qs_env%input,
"DFT%PRINT%AO_MATRICES%OMIT_HEADERS", l_val=omit_headers)
1209 after = min(max(after, 1), 16)
1211 para_env, output_unit=iw, omit_headers=omit_headers)
1213 "DFT%PRINT%AO_MATRICES/ORTHO")
1220 IF (dft_control%dft_plus_u)
THEN
1222 IF (do_kpoints)
THEN
1223 CALL get_qs_env(qs_env, kpoints=kpoints, matrix_s_kp=matrix_s_kp)
1224 CALL diag_kp_smat(matrix_s_kp, kpoints, scf_env%scf_work1)
1227 IF (s_minus_half_available)
THEN
1229 scf_env%s_half, nao)
1233 CALL cp_fm_power(scf_env%s_half, fm_w, 0.5_dp, scf_control%eps_eigval, ndep)
1238 DO ikind = 1,
SIZE(qs_kind_set)
1239 qs_kind => qs_kind_set(ikind)
1241 dft_plus_u_atom=dft_plus_u_atom, &
1242 u_ramping=u_ramping, &
1243 init_u_ramping_each_scf=init_u_ramping_each_scf)
1244 IF (dft_plus_u_atom .AND. (u_ramping /= 0.0_dp))
THEN
1245 IF (init_u_ramping_each_scf)
THEN
1246 CALL set_qs_kind(qs_kind=qs_kind, u_minus_j=0.0_dp)
1252 IF (dft_control%dft_plus_u)
THEN
1254 CALL get_qs_env(qs_env, atomic_kind_set=atomic_kind_set, qs_kind_set=qs_kind_set)
1255 DO ikind = 1,
SIZE(atomic_kind_set)
1256 qs_kind => qs_kind_set(ikind)
1257 CALL get_qs_kind(qs_kind=qs_kind, dft_plus_u_atom=dft_plus_u_atom)
1258 IF (.NOT. dft_plus_u_atom) cycle
1260 qs_kind=qs_kind_set(ikind), &
1261 which_l=qs_kind%dft_plus_u%l, &
1262 which_n=qs_kind%dft_plus_u%n, &
1263 proj_shell_charge=qs_kind%dft_plus_u%proj_shell_charge, &
1264 ao_coef=qs_kind%dft_plus_u%ao_coef)
1270 IF (scf_control%outer_scf%have_scf)
THEN
1275 IF (
ASSOCIATED(qs_env%xas_env))
THEN
1282 CALL scf_env_initial_rho_setup(scf_env, qs_env=qs_env, &
1283 scf_section=scf_section, scf_control=scf_control)
1287 IF (
ASSOCIATED(qs_env%wf_history))
THEN
1289 IF (.NOT.
ASSOCIATED(qs_env%wf_history%past_states(1)%snapshot))
THEN
1290 CALL wfi_update(qs_env%wf_history, qs_env=qs_env, dt=1.0_dp)
1291 ALLOCATE (qs_env%wf_history%past_states(1)%snapshot%rho_frozen)
1292 CALL qs_rho_create(qs_env%wf_history%past_states(1)%snapshot%rho_frozen)
1294 rho_output=qs_env%wf_history%past_states(1)%snapshot%rho_frozen, &
1301 IF (qs_env%qmmm)
THEN
1302 IF (qs_env%qmmm .AND. qs_env%qmmm_env_qm%image_charge)
THEN
1304 qmmm_env=qs_env%qmmm_env_qm)
1309 extension=
".scfLog")
1312 "PRINT%PROGRAM_RUN_INFO")
1314 CALL timestop(handle)
1316 END SUBROUTINE init_scf_run
1328 SUBROUTINE scf_env_initial_rho_setup(scf_env, qs_env, scf_section, scf_control)
1334 CHARACTER(len=*),
PARAMETER :: routinen =
'scf_env_initial_rho_setup'
1336 INTEGER :: extrapolation_method_nr, handle, ispin, &
1338 LOGICAL :: do_harris, do_kpoints, orthogonal_wf
1348 CALL timeset(routinen, handle)
1349 NULLIFY (mo_coeff, rho, dft_control, para_env, mos)
1351 cpassert(
ASSOCIATED(scf_env))
1352 cpassert(
ASSOCIATED(qs_env))
1357 dft_control=dft_control, &
1358 do_kpoints=do_kpoints, &
1361 do_harris = qs_env%harris_method
1363 cpabort(
"EXTERNAL_DENSITY SCF guess is incompatible with HARRIS_METHOD")
1367 IF (
ASSOCIATED(qs_env%wf_history))
THEN
1369 qs_env=qs_env, dt=1.0_dp, &
1370 extrapolation_method_nr=extrapolation_method_nr, &
1371 orthogonal_wf=orthogonal_wf)
1373 IF ((.NOT. orthogonal_wf) .AND. &
1375 (.NOT. do_kpoints) .AND. &
1377 DO ispin = 1,
SIZE(mos)
1378 CALL get_mo_set(mos(ispin), mo_coeff=mo_coeff, nmo=nmo)
1380 IF (dft_control%hairy_probes .EQV. .true.)
THEN
1381 scf_control%smear%do_smear = .false.
1383 smear=scf_control%smear, probe=dft_control%probe)
1386 smear=scf_control%smear)
1392 IF (.NOT. do_harris)
THEN
1394 extension=
".scfLog")
1395 IF (output_unit > 0)
THEN
1396 WRITE (unit=output_unit, fmt=
"(/,T2,A,I0)") &
1397 "Extrapolation method: "// &
1400 WRITE (unit=output_unit, fmt=
"(T2,A,I0,A)") &
1401 "Extrapolation order: ", &
1402 max((min(qs_env%wf_history%memory_depth, qs_env%wf_history%snapshot_count) - 1), 0)
1406 "PRINT%PROGRAM_RUN_INFO")
1410 CALL get_qs_env(qs_env, harris_env=harris_env)
1425 IF (scf_env%mixing_method > 1)
THEN
1426 IF (dft_control%qs_control%gapw)
THEN
1427 CALL get_qs_env(qs_env=qs_env, rho_atom_set=rho_atom)
1428 CALL mixing_init(scf_env%mixing_method, rho, scf_env%mixing_store, &
1429 para_env, rho_atom=rho_atom)
1430 ELSE IF (dft_control%qs_control%dftb .OR. dft_control%qs_control%xtb)
THEN
1432 ELSE IF (dft_control%qs_control%semi_empirical)
THEN
1433 cpabort(
'SE Code not possible')
1435 CALL mixing_init(scf_env%mixing_method, rho, scf_env%mixing_store, &
1440 DO ispin = 1,
SIZE(mos)
1441 IF (mos(ispin)%use_mo_coeff_b)
THEN
1443 mos(ispin)%mo_coeff_b)
1447 CALL timestop(handle)
1449 END SUBROUTINE scf_env_initial_rho_setup
calculate the orbitals for a given atomic kind type
subroutine, public calculate_atomic_orbitals(atomic_kind, qs_kind, agrid, iunit, pmat, fmat, density, wavefunction, wfninfo, confine, xc_section, nocc, which_l, which_n, proj_shell_charge, ao_coef)
...
Define the atomic kind types and their sub types.
collects all references to literature in CP2K as new algorithms / method are included from literature...
integer, save, public hu2010
Defines control structures, which contain the parameters and the settings for the DFT-based calculati...
subroutine, public dbcsr_init_p(matrix)
...
subroutine, public dbcsr_set(matrix, alpha)
...
Routines that link DBCSR and CP2K concepts together.
subroutine, public cp_dbcsr_alloc_block_from_nbl(matrix, sab_orb, desymmetrize)
allocate the blocks of a dbcsr based on the neighbor list
DBCSR operations in CP2K.
subroutine, public cp_dbcsr_sm_fm_multiply(matrix, fm_in, fm_out, ncol, alpha, beta)
multiply a dbcsr with a fm matrix
subroutine, public copy_dbcsr_to_fm(matrix, fm)
Copy a DBCSR matrix to a BLACS matrix.
subroutine, public cp_dbcsr_m_by_n_from_row_template(matrix, template, n, sym)
Utility function to create dbcsr matrix, m x n matrix (n arbitrary) with the same processor grid and ...
subroutine, public copy_fm_to_dbcsr(fm, matrix, keep_sparsity)
Copy a BLACS matrix to a dbcsr matrix.
subroutine, public write_fm_with_basis_info(blacs_matrix, before, after, qs_env, para_env, first_row, last_row, first_col, last_col, output_unit, omit_headers)
Print a spherical matrix of blacs type.
Basic linear algebra operations for full matrices.
subroutine, public cp_fm_row_scale(matrixa, scaling)
scales row i of matrix a with scaling(i)
subroutine, public cp_fm_column_scale(matrixa, scaling)
scales column i of matrix a with scaling(i)
subroutine, public cp_fm_transpose(matrix, matrixt)
transposes a matrix matrixt = matrix ^ T
subroutine, public cp_fm_triangular_invert(matrix_a, uplo_tr)
inverts a triangular matrix
various cholesky decomposition related routines
subroutine, public cp_fm_cholesky_decompose(matrix, n, info_out)
used to replace a symmetric positive def. matrix M with its cholesky decomposition U: M = U^T * U,...
used for collecting some of the diagonalization schemes available for cp_fm_type. cp_fm_power also mo...
subroutine, public cp_fm_power(matrix, work, exponent, threshold, n_dependent, verbose, eigvals)
...
integer, parameter, public fm_diag_type_cusolver
logical, save, public direct_generalized_diagonalization
subroutine, public choose_eigv_solver(matrix, eigenvectors, eigenvalues, info)
Choose the Eigensolver depending on which library is available ELPA seems to be unstable for small sy...
integer, save, public diag_type
integer, parameter, public cusolver_n_min
pool for for elements that are retained and released
type(cp_fm_struct_type) function, pointer, public fm_pool_get_el_struct(pool)
returns the structure of the elements in this pool
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_get(fmstruct, para_env, context, descriptor, ncol_block, nrow_block, nrow_global, ncol_global, first_p_pos, row_indices, col_indices, nrow_local, ncol_local, nrow_locals, ncol_locals, local_leading_dimension)
returns the values of various attributes of the matrix structure
subroutine, public cp_fm_struct_release(fmstruct)
releases a full matrix structure
represent a full matrix distributed on many processors
subroutine, public cp_fm_get_info(matrix, name, nrow_global, ncol_global, nrow_block, ncol_block, nrow_local, ncol_local, row_indices, col_indices, local_data, context, nrow_locals, ncol_locals, matrix_struct, para_env)
returns all kind of information about the full matrix
subroutine, public cp_fm_set_all(matrix, alpha, beta)
set all elements of a matrix to the same value, and optionally the diagonal to a different one
subroutine, public cp_fm_create(matrix, matrix_struct, name, nrow, ncol, set_zero)
creates a new full matrix with the given structure
subroutine, public cp_fm_to_fm_triangular(msource, mtarget, uplo)
copy just a triangular matrix
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...
subroutine, public ao_boundaries(probe, atomic_kind_set, qs_kind_set, particle_set, nao)
...
Defines the basic variable types.
integer, parameter, public dp
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.
Interface to the message passing library MPI.
basic linear algebra operations for full matrixes
Define the data structure for the particle information.
Routines for image charge calculation within QM/MM.
subroutine, public conditional_calc_image_matrix(qs_env, qmmm_env)
calculate image matrix T depending on constraints on image atoms in case coefficients are estimated n...
module that contains the algorithms to perform an iterative diagonalization by the block-Davidson app...
subroutine, public block_davidson_env_create(bdav_env, nchannels, scf_section)
creates one Davidson environment per solver channel: for Gamma-point runs a channel is a spin,...
subroutine, public block_davidson_allocate(bdav_env, mo_coeff, nao, nmo)
...
Control parameters for optimizers that work with CDFT constraints.
subroutine, public cdft_opt_type_copy(new, old)
copies settings between two CDFT optimizer control objects retaining both
module that contains the definitions of the scf types
subroutine, public mixing_storage_release(mixing_store)
releases a mixing_storage
integer, parameter, public no_mixing_nr
integer, parameter, public direct_mixing_nr
subroutine, public mixing_storage_create(mixing_store, mixing_section, mixing_method, ecut)
creates a mixing_storage
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.
subroutine, public set_qs_env(qs_env, super_cell, mos, qmmm, qmmm_periodic, mimic, ewald_env, ewald_pw, mpools, rho_external, external_vxc, mask, scf_control, rel_control, qs_charges, ks_env, ks_qmmm_env, wf_history, scf_env, active_space, input, oce, rho_atom_set, rho0_atom_set, rho0_mpole, run_rtp, rtp, rhoz_set, rhoz_tot, ecoul_1c, has_unit_metric, requires_mo_derivs, mo_derivs, mo_loc_history, efield, rhoz_cneo_set, linres_control, xas_env, cp_ddapc_env, cp_ddapc_ewald, outer_scf_history, outer_scf_ihistory, x_data, et_coupling, dftb_potential, se_taper, se_store_int_env, se_nddo_mpole, se_nonbond_env, admm_env, ls_scf_env, do_transport, transport_env, lri_env, lri_density, exstate_env, ec_env, dispersion_env, harris_env, gcp_env, mp2_env, bs_env, kg_env, force, kpoints, wanniercentres, almo_scf_env, gradient_history, variable_history, embed_pot, spin_embed_pot, polar_env, mos_last_converged, eeq, rhs, do_rixs, tb_tblite)
Set the QUICKSTEP environment.
Routines to handle an external density The external density can be generic and is provided by user in...
subroutine, public read_scf_guess_density(qs_env, filename)
Read a cube density for one-time use as the first SCF input density.
subroutine, public fb_distribution_build(fb_env, qs_env, scf_section)
Build local atoms associated to filter matrix algorithm for each MPI process, trying to balance the l...
subroutine, public fb_env_read_input(fb_env, scf_section)
Read input sections for filter matrix method.
subroutine, public fb_env_build_atomic_halos(fb_env, qs_env, scf_section)
Builds an fb_atomic_halo_list object using information from fb_env.
subroutine, public fb_env_write_info(fb_env, qs_env, scf_section)
Write out parameters used for the filter matrix method to output.
subroutine, public fb_env_build_rcut_auto(fb_env, qs_env)
Automatically generate the cutoff radii of atoms used for constructing the atomic halos,...
logical function, public fb_env_has_data(fb_env)
Checks if a fb_env object is associated with an actual data content or not.
subroutine, public fb_env_create(fb_env)
creates an empty fb_env object
Types needed for a for a Harris model calculation.
Harris method environment setup and handling.
subroutine, public harris_density_update(qs_env, harris_env)
...
Routines to somehow generate an initial guess.
subroutine, public calculate_first_density_matrix(scf_env, qs_env)
can use a variety of methods to come up with an initial density matrix and optionally an initial wave...
Define the quickstep kind type and their sub types.
subroutine, public get_qs_kind(qs_kind, basis_set, basis_type, ncgf, nsgf, all_potential, tnadd_potential, gth_potential, sgp_potential, upf_potential, cneo_potential, se_parameter, dftb_parameter, xtb_parameter, dftb3_param, zatom, zeff, elec_conf, mao, lmax_dftb, alpha_core_charge, ccore_charge, core_charge, core_charge_radius, paw_proj_set, paw_atom, hard_radius, hard0_radius, max_rad_local, covalent_radius, vdw_radius, gpw_type_forced, harmonics, max_iso_not0, max_s_harm, grid_atom, ngrid_ang, ngrid_rad, lmax_rho0, dft_plus_u_atom, l_of_dft_plus_u, n_of_dft_plus_u, u_minus_j, hund_j, u_of_dft_plus_u, j_of_dft_plus_u, alpha_of_dft_plus_u, beta_of_dft_plus_u, j0_of_dft_plus_u, occupation_of_dft_plus_u, dispersion, bs_occupation, magnetization, no_optimize, addel, laddel, naddel, orbitals, max_scf, eps_scf, smear, u_ramping, u_minus_j_target, eps_u_ramping, proj_shell_charge, lr_atom, do_mtlr, u_j_loop, ao_coef, init_u_ramping_each_scf, reltmat, ghost, monovalent, floating, name, element_symbol, pao_basis_size, pao_model_file, pao_potentials, pao_descriptors, nelec)
Get attributes of an atomic kind.
subroutine, public set_qs_kind(qs_kind, paw_atom, ghost, floating, hard_radius, hard0_radius, covalent_radius, vdw_radius, lmax_rho0, zeff, no_optimize, dispersion, u_minus_j, hund_j, reltmat, dftb_parameter, xtb_parameter, elec_conf, pao_basis_size)
Set the components of an atomic kind data set.
subroutine, public qs_ks_did_change(ks_env, s_mstruct_changed, rho_changed, potential_changed, full_reset)
tells that some of the things relevant to the ks calculation did change. has to be called when change...
wrapper for the pools of matrixes
subroutine, public mpools_get(mpools, ao_mo_fm_pools, ao_ao_fm_pools, mo_mo_fm_pools, ao_mosub_fm_pools, mosub_mosub_fm_pools, maxao_maxmo_fm_pool, maxao_maxao_fm_pool, maxmo_maxmo_fm_pool)
returns various attributes of the mpools (notably the pools contained in it)
elemental subroutine, public charge_mixing_init(mixing_store)
initialiation needed when charge mixing is used
subroutine, public mixing_init(mixing_method, rho, mixing_store, para_env, rho_atom)
initialiation needed when gspace mixing is used
subroutine, public mixing_allocate(qs_env, mixing_method, p_mix_new, p_delta, nspins, mixing_store)
allocation needed when density mixing is used
Set occupation of molecular orbitals.
Definition and initialisation of the mo data type.
subroutine, public set_mo_set(mo_set, maxocc, homo, lfomo, nao, nelectron, n_el_f, nmo, eigenvalues, occupation_numbers, uniform_occupation, kts, mu, flexible_electron_count)
Set the components of a MO set data structure.
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 get_mo_set(mo_set, maxocc, homo, lfomo, nao, nelectron, n_el_f, nmo, eigenvalues, occupation_numbers, mo_coeff, mo_coeff_b, uniform_occupation, kts, mu, flexible_electron_count)
Get the components of a MO set data structure.
Define the neighbor list data types and the corresponding functionality.
Routines for performing an outer scf loop.
subroutine, public outer_loop_switch(scf_env, scf_control, cdft_control, dir)
switch between two outer_scf envs stored in cdft_control
subroutine, public outer_loop_extrapolate(qs_env)
uses the outer_scf_history to extrapolate new values for the variables and updates their value in qs_...
integer function, public outer_loop_variables_count(scf_control, cdft_control)
returns the number of variables that is employed in the outer loop. with a CDFT constraint this value...
methods of the rho structure (defined in qs_rho_types)
subroutine, public qs_rho_update_rho(rho_struct, qs_env, rho_xc_external, local_rho_set, task_list_external, task_list_external_soft, pw_env_external, para_env_external)
updates rho_r and rho_g to the rhorho_ao. if use_kinetic_energy_density also computes tau_r and tau_g...
subroutine, public duplicate_rho_type(rho_input, rho_output, qs_env)
Duplicates a pointer physically.
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...
subroutine, public qs_rho_create(rho)
Allocates a new instance of rho.
Different diagonalization schemes that can be used for the iterative solution of the eigenvalue probl...
subroutine, public diag_subspace_allocate(subspace_env, qs_env, mos)
...
subroutine, public diag_kp_smat(matrix_s, kpoints, fmwork)
Kpoint diagonalization routine Transforms matrices to kpoint, distributes kpoint groups,...
Utility routines for qs_scf.
subroutine, public qs_scf_env_init_basic(qs_env, scf_env)
initializes input parameters if needed for non-scf calclulations using diagonalization
subroutine, public qs_scf_env_initialize(qs_env, scf_env, scf_control, scf_section)
initializes input parameters if needed or restores values from previous runs to fill scf_env with the...
module that contains the algorithms to perform an iterative diagonalization by the block-Lanczos appr...
subroutine, public krylov_space_allocate(krylov_space, scf_control, mos)
allocates matrices and vectors used in the construction of the krylov space and for the lanczos refin...
subroutine, public qs_scf_initial_info(output_unit, mos, dft_control, ndep)
writes basic information at the beginning of an scf run
module that contains the definitions of the scf types
integer, parameter, public ot_diag_method_nr
subroutine, public krylov_space_create(krylov_space, scf_section)
creates krylov space
subroutine, public diag_subspace_env_create(subspace_env, scf_section, ecut)
creates subspace-rotation environment
integer, parameter, public filter_matrix_diag_method_nr
integer, parameter, public block_davidson_diag_method_nr
integer, parameter, public smeagol_method_nr
integer, parameter, public ot_method_nr
subroutine, public scf_env_create(scf_env)
allocates and initialize an scf_env
integer, parameter, public special_diag_method_nr
integer, parameter, public block_krylov_diag_method_nr
integer, parameter, public general_diag_method_nr
Storage of past states of the qs_env. Methods to interpolate (or actually normally extrapolate) the n...
character(len=30) function, public wfi_get_method_label(method_nr)
returns a string describing the interpolation method
subroutine, public reorthogonalize_vectors(qs_env, v_matrix, n_col)
reorthogonalizes the mos
subroutine, public wfi_update(wf_history, qs_env, dt)
updates the snapshot buffer, taking a new snapshot
subroutine, public wfi_extrapolate(wf_history, qs_env, dt, extrapolation_method_nr, orthogonal_wf)
calculates the new starting state for the scf for the next wf optimization
parameters that control an scf iteration
define create destroy get and put information in xas_env to calculate the x-ray absorption spectra
Initialize the XAS orbitals for specific core excitations Either the GS orbitals are used as initial ...
subroutine, public xas_initialize_rho(qs_env, scf_env, scf_control)
Once the mos and the occupation numbers are initialized the electronic density of the excited state c...
Provides all information about an atomic kind.
to create arrays of pools
keeps the information about the structure of 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
Contains information on the Harris method.
Provides all information about a quickstep kind.
keeps the density in various representations, keeping track of which ones are valid.