102#include "./base/base_uses.f90"
108 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'qs_initial_guess'
113 TYPE atom_matrix_type
114 REAL(KIND=
dp),
DIMENSION(:, :, :),
POINTER :: mat => null()
115 END TYPE atom_matrix_type
138 CHARACTER(LEN=*),
PARAMETER :: routinen =
'calculate_first_density_matrix'
140 CHARACTER(LEN=default_path_length) :: file_name, filename
141 INTEGER :: atom_a, density_guess, handle, homo, i, iatom, ic, icol, id_nr, ikind, irow, &
142 iseed(4), ispin, istart_col, istart_row, j, last_read, n, n_cols, n_rows, nao, natom, &
143 natoms, natoms_tmp, nblocks, nelectron, nmo, nmo_tmp, not_read, nsgf, nspin, nvec, ounit, &
144 safe_density_guess, size_atomic_kind_set, z
145 INTEGER,
ALLOCATABLE,
DIMENSION(:) :: first_sgf, kind_of, last_sgf
146 INTEGER,
DIMENSION(2) :: nelectron_spin
147 INTEGER,
DIMENSION(:),
POINTER :: atom_list, elec_conf, nelec_kind, &
149 LOGICAL :: cneo_potential_present, did_guess, do_hfx_ri_mo, do_kpoints, do_std_diag, exist, &
150 has_unit_metric, natom_mismatch, need_mos, need_wm, ofgpw, owns_ortho, print_history_log, &
152 REAL(
dp),
ALLOCATABLE,
DIMENSION(:, :) :: buff, buff2
153 REAL(
dp),
DIMENSION(:, :),
POINTER :: pdata
154 REAL(kind=
dp) :: checksum, eps, length, maxocc, occ, &
155 rscale, tot_corr_zeff, trps1, zeff
156 REAL(kind=
dp),
DIMENSION(0:3) :: edftb
157 TYPE(atom_matrix_type),
DIMENSION(:),
POINTER :: pmat
162 TYPE(
cp_fm_type),
DIMENSION(:),
POINTER :: work1
163 TYPE(
cp_fm_type),
POINTER :: mo_coeff, moa, mob, ortho, work2
166 TYPE(
dbcsr_p_type),
DIMENSION(:),
POINTER :: h_core_sparse, matrix_ks, p_rmpv, &
168 TYPE(
dbcsr_p_type),
DIMENSION(:, :),
POINTER :: matrix_h_kp, matrix_ks_kp, matrix_s_kp, &
173 TYPE(
hfx_type),
DIMENSION(:, :),
POINTER :: x_data
175 TYPE(
mo_set_type),
DIMENSION(:),
POINTER :: mo_array, mos_last_converged
178 TYPE(
qs_kind_type),
DIMENSION(:),
POINTER :: qs_kind_set
185 NULLIFY (atomic_kind, qs_kind, mo_coeff, orb_basis_set, atomic_kind_set, &
186 qs_kind_set, particle_set, ortho, work2, work1, mo_array, s_sparse, &
187 scf_control, dft_control, p_rmpv, para_env, h_core_sparse, matrix_ks, rho, &
189 NULLIFY (dft_section, input, subsys_section)
190 NULLIFY (matrix_s_kp, matrix_h_kp, matrix_ks_kp, rho_ao_kp)
192 NULLIFY (atom_list, elec_conf, kpoints)
194 tot_corr_zeff = 0.0_dp
196 CALL timeset(routinen, handle)
199 atomic_kind_set=atomic_kind_set, &
200 qs_kind_set=qs_kind_set, &
201 particle_set=particle_set, &
203 matrix_s_kp=matrix_s_kp, &
204 matrix_h_kp=matrix_h_kp, &
205 matrix_ks_kp=matrix_ks_kp, &
207 scf_control=scf_control, &
208 dft_control=dft_control, &
209 has_unit_metric=has_unit_metric, &
210 do_kpoints=do_kpoints, &
213 nelectron_spin=nelectron_spin, &
219 IF (dft_control%switch_surf_dip)
THEN
220 CALL get_qs_env(qs_env, mos_last_converged=mos_last_converged)
224 DO ispin = 1, dft_control%nspins
225 DO ic = 1,
SIZE(rho_ao_kp, 2)
226 CALL dbcsr_set(rho_ao_kp(ispin, ic)%matrix, 0.0_dp)
229 s_sparse => matrix_s_kp(:, 1)
230 h_core_sparse => matrix_h_kp(:, 1)
231 matrix_ks => matrix_ks_kp(:, 1)
232 p_rmpv => rho_ao_kp(:, 1)
234 work1 => scf_env%scf_work1
235 work2 => scf_env%scf_work2
236 ortho => scf_env%ortho
240 nspin = dft_control%nspins
241 ofgpw = dft_control%qs_control%ofgpw
242 density_guess = scf_control%density_guess
247 do_std_diag = .false.
249 do_hfx_ri_mo = .false.
250 IF (
ASSOCIATED(x_data))
THEN
251 IF (x_data(1, 1)%do_hfx_ri)
THEN
252 IF (x_data(1, 1)%ri_data%flavor ==
ri_mo) do_hfx_ri_mo = .true.
256 IF (
ASSOCIATED(scf_env%krylov_space)) do_std_diag = (scf_env%krylov_space%eps_std_diag > 0.0_dp)
260 .OR. dft_control%do_admm .OR. do_hfx_ri_mo .OR. &
264 IF (dft_control%qs_control%semi_empirical .OR. dft_control%qs_control%dftb)
THEN
268 IF (dft_control%qs_control%xtb)
THEN
278 IF (scf_control%use_ot .AND. &
287 (scf_control%level_shift == 0.0_dp)))))
THEN
288 CALL cp_abort(__location__, &
289 "OT needs GUESS ATOMIC / CORE / RANDOM / SPARSE / RESTART / HISTORY RESTART: other options NYI")
301 IF (para_env%is_source())
THEN
305 IF (para_env%is_source())
THEN
309 CALL para_env%bcast(exist)
310 CALL para_env%bcast(file_name)
311 IF (.NOT. exist)
THEN
312 CALL cp_warn(__location__, &
313 "User requested to restart the wavefunction from the file named: "// &
314 trim(file_name)//
". This file does not exist. Please check the existence of"// &
315 " the file or change properly the value of the keyword WFN_RESTART_FILE_NAME."// &
316 " Calculation continues using ATOMIC GUESS. ")
317 density_guess = safe_density_guess
321 cpabort(
"calculate_first_density_matrix: history_guess not implemented for k-points")
323 IF (para_env%is_source())
THEN
326 CALL para_env%bcast(exist)
327 CALL para_env%bcast(file_name)
328 nvec = qs_env%wf_history%memory_depth
333 filename = trim(file_name)
335 filename = trim(file_name)//
".bak-"//adjustl(
cp_to_string(j))
337 IF (para_env%is_source())
THEN
338 INQUIRE (file=filename, exist=exist)
340 CALL para_env%bcast(exist)
341 IF ((.NOT. exist) .AND. (i < not_read))
THEN
345 IF (not_read == 1)
THEN
347 filename = trim(file_name)
348 IF (para_env%is_source())
INQUIRE (file=filename, exist=exist)
349 CALL para_env%bcast(exist)
350 IF (.NOT. exist)
THEN
351 CALL cp_warn(__location__, &
352 "User requested to restart the wavefunction from a series of restart files named: "// &
353 trim(file_name)//
" with extensions (.bak-n). These files do not exist."// &
354 " Even trying to switch to a plain restart wave-function failes because the"// &
355 " file named: "//trim(file_name)//
" does not exist. Please check the existence of"// &
356 " the file or change properly the value of the keyword WFN_RESTART_FILE_NAME."// &
357 " Calculation continues using ATOMIC GUESS. ")
358 density_guess = safe_density_guess
361 last_read = not_read - 1
366 IF (dft_control%correct_el_density_dip)
THEN
367 tot_corr_zeff = qs_env%total_zeff_corr
368 IF ((abs(tot_corr_zeff) > 0.0_dp) .AND. (density_guess /=
restart_guess))
THEN
369 CALL cp_warn(__location__, &
370 "Use SCF_GUESS RESTART in conjunction with "// &
371 "CORE_CORRECTION /= 0.0 and SURFACE_DIPOLE_CORRECTION TRUE. "// &
372 "It is always advisable to perform SURFACE_DIPOLE_CORRECTION "// &
373 "after a simulation without the surface dipole correction "// &
374 "and using the ensuing wavefunction restart file. ")
380 print_history_log = .false.
381 IF (para_env%is_source())
THEN
383 "SCF%PRINT%RESTART%LOG_PRINT_KEY", &
386 "SCF%PRINT%RESTART_HISTORY%LOG_PRINT_KEY", &
387 l_val=print_history_log)
388 IF (print_log .OR. print_history_log)
THEN
395 WRITE (unit=ounit, fmt=
"(/,T2,A)") &
396 "WFN_RESTART| Reading restart file"
399 natoms =
SIZE(particle_set)
401 natoms, para_env, id_nr, dft_section, natom_mismatch)
402 IF (natom_mismatch) density_guess = safe_density_guess
405 id_nr=id_nr, multiplicity=dft_control%multiplicity, &
406 dft_section=dft_section, &
407 natom_mismatch=natom_mismatch, &
410 IF (natom_mismatch)
THEN
411 density_guess = safe_density_guess
414 IF (scf_control%level_shift /= 0.0_dp)
THEN
415 CALL get_mo_set(mo_set=mo_array(ispin), mo_coeff=mo_coeff)
421 mo_coeff=mo_coeff, nmo=nmo, homo=homo)
423 IF (has_unit_metric)
THEN
425 ELSE IF (dft_control%smear)
THEN
427 matrix_s=s_sparse(1)%matrix)
433 IF (dft_control%restricted)
EXIT
437 IF (.NOT. scf_control%diagonalization%mom)
THEN
438 IF (dft_control%correct_surf_dip)
THEN
439 IF (abs(tot_corr_zeff) > 0.0_dp)
THEN
441 tot_zeff_corr=tot_corr_zeff)
454 mo_array(ispin)%mo_coeff_b)
458 p_rmpv(ispin)%matrix)
465 IF (scf_control%diagonalization%mom)
THEN
473 IF (not_read > 1)
THEN
475 WRITE (unit=ounit, fmt=
"(/,T2,A)") &
476 "WFN_RESTART| Reading restart file history"
481 id_nr=j, multiplicity=dft_control%multiplicity, &
482 dft_section=dft_section, out_unit=ounit)
485 IF (scf_control%level_shift /= 0.0_dp)
THEN
486 CALL get_mo_set(mo_set=mo_array(ispin), mo_coeff=mo_coeff)
491 CALL get_mo_set(mo_set=mo_array(ispin), mo_coeff=mo_coeff, nmo=nmo, homo=homo)
493 IF (has_unit_metric)
THEN
500 IF (dft_control%restricted)
EXIT
506 smear=qs_env%scf_control%smear)
512 mo_array(ispin)%mo_coeff_b)
518 CALL wfi_update(wf_history=qs_env%wf_history, qs_env=qs_env, dt=1.0_dp)
529 mo_coeff=mo_coeff, nmo=nmo)
531 IF (has_unit_metric)
THEN
537 IF (dft_control%restricted)
EXIT
543 smear=qs_env%scf_control%smear)
550 mo_array(ispin)%mo_coeff_b)
562 cpabort(
"calculate_first_density_matrix: core_guess not implemented for k-points")
565 CALL get_qs_kind_set(qs_kind_set, cneo_potential_present=cneo_potential_present)
566 IF (cneo_potential_present)
THEN
567 cpabort(
"calculate_first_density_matrix: core_guess not implemented for CNEO")
571 IF (.NOT.
ASSOCIATED(work1))
THEN
573 cpassert(.NOT.
ASSOCIATED(work2))
574 cpassert(.NOT.
ASSOCIATED(ortho))
577 cpassert(
ASSOCIATED(work2))
578 IF (.NOT.
ASSOCIATED(ortho))
THEN
585 CALL get_mo_set(mo_set=mo_array(1), mo_coeff=moa)
589 nrow_block=nblocks, &
590 ncol_block=nblocks, &
593 template_fmstruct=ao_mo_struct)
595 ALLOCATE (work2, ortho)
610 IF (has_unit_metric)
THEN
612 mo_set=mo_array(ispin), &
614 do_level_shift=.false., &
615 level_shift=0.0_dp, &
616 use_jacobi=.false., jacobi_threshold=0._dp)
619 mo_set=mo_array(ispin), &
622 cholesky_method=scf_env%cholesky_method, &
623 do_level_shift=.false., &
624 level_shift=0.0_dp, &
630 CALL get_mo_set(mo_set=mo_array(1), mo_coeff=moa)
631 CALL get_mo_set(mo_set=mo_array(2), mo_coeff=mob, nmo=nmo)
647 DEALLOCATE (ortho, work2)
649 NULLIFY (work1, work2, ortho)
650 ELSE IF (owns_ortho)
THEN
662 WRITE (unit=ounit, fmt=
"(/,(T2,A))") &
663 "Atomic guess: The first density matrix is obtained in terms of atomic orbitals", &
664 " and electronic configurations assigned to each atomic kind"
668 nspin, nelectron_spin, ounit, para_env)
674 IF (ofgpw .AND. (scf_control%use_ot .OR. scf_env%method ==
ot_diag_method_nr))
THEN
679 IF (dft_control%restricted .AND. (ispin == 2))
THEN
684 nmo=nmo, nao=nao, homo=homo)
691 IF (has_unit_metric)
THEN
701 IF (has_unit_metric)
THEN
709 smear=qs_env%scf_control%smear)
712 mo_array(ispin)%mo_coeff_b)
715 p_rmpv(ispin)%matrix)
720 IF (dft_control%correct_surf_dip)
THEN
721 IF (abs(tot_corr_zeff) > 0.0_dp)
THEN
724 nmo=nmo, nao=nao, homo=homo)
731 IF (has_unit_metric)
THEN
741 IF (has_unit_metric)
THEN
748 tot_zeff_corr=tot_corr_zeff)
751 p_rmpv(ispin)%matrix)
760 IF (ofgpw .AND. (scf_control%use_ot .OR. scf_env%method ==
ot_diag_method_nr))
THEN
775 IF (scf_control%diagonalization%mom)
THEN
788 cpabort(
"calculate_first_density_matrix: sparse_guess not implemented for OFGPW")
790 IF (.NOT. scf_control%use_ot)
THEN
791 cpabort(
"calculate_first_density_matrix: sparse_guess implemented for OT only")
794 cpabort(
"calculate_first_density_matrix: sparse_guess not implemented for k-points")
800 natoms =
SIZE(particle_set)
801 ALLOCATE (kind_of(natoms))
802 ALLOCATE (first_sgf(natoms), last_sgf(natoms))
806 IF (ounit > 0)
WRITE (ounit, *)
'S nblks', i,
' checksum', checksum
810 IF (ounit > 0)
WRITE (ounit, *)
'S nblks', i,
' checksum', checksum
816 ALLOCATE (pmat(
SIZE(atomic_kind_set)))
819 IF (nspin == 2) rscale = 0.5_dp
820 DO ikind = 1,
SIZE(atomic_kind_set)
821 atomic_kind => atomic_kind_set(ikind)
822 qs_kind => qs_kind_set(ikind)
823 NULLIFY (pmat(ikind)%mat)
825 NULLIFY (atomic_kind)
836 ikind = kind_of(irow)
837 IF (icol == irow)
THEN
839 pdata(:, :) = pmat(ikind)%mat(:, :, 1)*rscale + &
840 pmat(ikind)%mat(:, :, 2)*rscale
842 pdata(:, :) = pmat(ikind)%mat(:, :, 1)*rscale - &
843 pmat(ikind)%mat(:, :, 2)*rscale
852 IF (ounit > 0)
WRITE (ounit, *)
'P_init occ', occ,
' checksum', checksum
858 IF (ounit > 0)
WRITE (ounit, *)
'P_init occ', occ,
' checksum', checksum
860 CALL dbcsr_dot(p_rmpv(ispin)%matrix, s_sparse(1)%matrix, trps1)
861 rscale = real(nelectron,
dp)/trps1
867 IF (ounit > 0)
WRITE (ounit, *)
'P occ', occ,
' checksum', checksum
871 IF (dft_control%restricted .AND. (ispin == 2))
THEN
876 nmo=nmo, nao=nao, homo=homo)
879 n = maxval(last_sgf - first_sgf) + 1
880 size_atomic_kind_set =
SIZE(atomic_kind_set)
882 ALLOCATE (buff(n, n), sort_kind(size_atomic_kind_set), &
883 nelec_kind(size_atomic_kind_set))
886 DO ikind = 1, size_atomic_kind_set
887 atomic_kind => atomic_kind_set(ikind)
888 qs_kind => qs_kind_set(ikind)
891 atom_list=atom_list, &
893 CALL get_qs_kind(qs_kind, nsgf=nsgf, elec_conf=elec_conf, &
894 basis_set=orb_basis_set, zeff=zeff)
895 nelec_kind(ikind) = sum(elec_conf)
897 CALL sort(nelec_kind, size_atomic_kind_set, sort_kind)
903 iseed(1) = 4; iseed(2) = 3; iseed(3) = 2; iseed(4) = 1
904 DO i = 1, size_atomic_kind_set
906 atomic_kind => atomic_kind_set(ikind)
908 natom=natom, atom_list=atom_list)
911 atom_a = atom_list(iatom)
912 istart_row = first_sgf(atom_a)
913 n_rows = last_sgf(atom_a) - first_sgf(atom_a) + 1
916 n_cols = max(int(real(nmo_tmp,
dp)/real(natoms_tmp,
dp)), 1)
917 IF (n_cols > n_rows) n_cols = n_rows
919 nmo_tmp = nmo_tmp - n_cols
920 natoms_tmp = natoms_tmp - 1
921 cpassert(nmo_tmp >= 0)
922 cpassert(natoms_tmp >= 0)
924 CALL dlarnv(1, iseed, n_rows, buff(1, j))
928 istart_col = istart_col + n_cols
932 cpassert(istart_col > nmo)
934 DEALLOCATE (buff, nelec_kind, sort_kind)
937 ALLOCATE (buff(nao, 1), buff2(nao, 1))
940 IF (sum(buff**2) < 1e-10_dp)
THEN
942 WRITE (ounit, *)
'wrong', i, sum(buff**2)
945 length = norm2(buff(:, 1))
946 buff(:, :) = buff(:, :)/length
949 length = norm2(buff2(:, 1))
950 buff2(:, :) = buff2(:, :)/length
951 IF (abs(dot_product(buff(:, 1), buff2(:, 1)) - 1.0_dp) < 1e-10_dp)
THEN
953 WRITE (ounit, *)
'wrong2', i, j, dot_product(buff(:, 1), buff2(:, 1))
955 IF (abs(mo_coeff%local_data(ikind, i)) > 1e-10_dp)
THEN
956 WRITE (ounit, *)
'c1', ikind, mo_coeff%local_data(ikind, i)
958 IF (abs(mo_coeff%local_data(ikind, j)) > 1e-10_dp)
THEN
959 WRITE (ounit, *)
'c2', ikind, mo_coeff%local_data(ikind, j)
963 cpabort(
"Something went wrong with sparse_guess!")
967 DEALLOCATE (buff, buff2)
976 IF (ounit > 0)
WRITE (ounit, *)
'C occ', occ,
' checksum', checksum
981 IF (ounit > 0)
WRITE (ounit, *)
'C occ', occ,
' checksum', checksum
984 IF (has_unit_metric)
THEN
985 cpabort(
"has_unit_metric will be removed soon")
989 CALL dbcsr_copy(mo_tmp_dbcsr, mo_dbcsr, name=
"mo_tmp")
990 CALL dbcsr_multiply(
"N",
"N", 1.0_dp, s_sparse(1)%matrix, mo_dbcsr, &
991 0.0_dp, mo_tmp_dbcsr, &
992 retain_sparsity=.true.)
996 IF (ounit > 0)
WRITE (ounit, *)
'S*C occ', occ,
' checksum', checksum
1001 IF (ounit > 0)
WRITE (ounit, *)
'S*C occ', occ,
' checksum', checksum
1007 mo_tmp_dbcsr, 0.0_dp, mo_dbcsr)
1011 IF (ounit > 0)
WRITE (ounit, *)
'P*SC occ', occ,
' checksum', checksum
1016 IF (ounit > 0)
WRITE (ounit, *)
'P*SC occ', occ,
' checksum', checksum
1028 smear=qs_env%scf_control%smear)
1031 mo_array(ispin)%mo_coeff_b)
1034 p_rmpv(ispin)%matrix)
1035 DO ikind = 1,
SIZE(atomic_kind_set)
1036 IF (
ASSOCIATED(pmat(ikind)%mat))
THEN
1037 DEALLOCATE (pmat(ikind)%mat)
1044 DEALLOCATE (kind_of)
1046 DEALLOCATE (first_sgf, last_sgf)
1053 particle_set, atomic_kind_set, qs_kind_set, &
1054 nspin, nelectron_spin, para_env)
1060 IF (dft_control%restricted .AND. (ispin == 2))
THEN
1064 mo_coeff=mo_coeff, &
1069 IF (has_unit_metric)
THEN
1078 IF (has_unit_metric)
THEN
1086 smear=qs_env%scf_control%smear)
1088 mo_array(ispin)%mo_coeff_b)
1091 p_rmpv(ispin)%matrix)
1107 IF (dft_control%switch_surf_dip)
THEN
1114 IF (density_guess ==
no_guess)
THEN
1118 IF (.NOT. did_guess)
THEN
1119 cpabort(
"An invalid keyword for the initial density guess was specified")
1122 CALL timestop(handle)
1136 TYPE(
qs_kind_type),
DIMENSION(:),
POINTER :: qs_kind_set
1137 INTEGER,
INTENT(IN) :: ounit
1139 CHARACTER(LEN=*),
PARAMETER :: routinen =
'calculate_atomic_fock_matrix'
1141 INTEGER :: handle, icol, ikind, irow
1142 INTEGER,
ALLOCATABLE,
DIMENSION(:) :: kind_of
1143 REAL(
dp),
DIMENSION(:, :),
POINTER :: block
1144 TYPE(atom_matrix_type),
ALLOCATABLE,
DIMENSION(:) :: fmat
1149 CALL timeset(routinen, handle)
1152 ALLOCATE (fmat(
SIZE(atomic_kind_set)))
1155 DO ikind = 1,
SIZE(atomic_kind_set)
1156 atomic_kind => atomic_kind_set(ikind)
1157 qs_kind => qs_kind_set(ikind)
1158 NULLIFY (fmat(ikind)%mat)
1159 IF (ounit > 0)
WRITE (unit=ounit, fmt=
"(/,T2,A)") &
1160 "Calculating atomic Fock matrix for atomic kind: "//trim(atomic_kind%name)
1164 fmat=fmat(ikind)%mat)
1174 ikind = kind_of(irow)
1175 IF (icol == irow) block(:, :) = fmat(ikind)%mat(:, :, 1)
1180 DO ikind = 1,
SIZE(atomic_kind_set)
1181 DEALLOCATE (fmat(ikind)%mat)
1185 CALL timestop(handle)
1203 dft_control, particle_set, atomic_kind_set, qs_kind_set, &
1204 nspin, nelectron_spin, para_env)
1205 TYPE(
dbcsr_p_type),
DIMENSION(:),
INTENT(INOUT) :: pmat
1207 LOGICAL :: has_unit_metric
1211 TYPE(
qs_kind_type),
DIMENSION(:),
POINTER :: qs_kind_set
1212 INTEGER,
INTENT(IN) :: nspin
1213 INTEGER,
DIMENSION(:),
INTENT(IN) :: nelectron_spin
1216 CHARACTER(LEN=*),
PARAMETER :: routinen =
'calculate_mopac_dm'
1218 INTEGER :: atom_a, handle, iatom, ikind, iset, &
1219 isgf, isgfa, ishell, ispin, la, maxl, &
1220 maxll, na, nao, natom, ncount, nset, &
1222 INTEGER,
ALLOCATABLE,
DIMENSION(:) :: first_sgf
1223 INTEGER,
DIMENSION(25) :: laox, naox
1224 INTEGER,
DIMENSION(5) :: occupation
1225 INTEGER,
DIMENSION(:),
POINTER :: atom_list, elec_conf, nshell
1226 INTEGER,
DIMENSION(:, :),
POINTER :: first_sgfa, l, last_sgfa
1228 REAL(kind=
dp) :: maxocc, my_sum, nelec, occ, paa, rscale, &
1229 trps1, trps2, yy, zeff
1230 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:) :: econf, pdiag, sdiag
1231 REAL(kind=
dp),
DIMENSION(0:3) :: edftb
1240 CALL timeset(routinen, handle)
1243 matrix_p => pmat(ispin)%matrix
1247 natom =
SIZE(particle_set)
1249 IF (nspin == 1)
THEN
1255 ALLOCATE (first_sgf(natom))
1260 ALLOCATE (econf(0:maxl))
1262 ALLOCATE (pdiag(nao))
1265 ALLOCATE (sdiag(nao))
1267 IF (has_unit_metric)
THEN
1271 CALL para_env%sum(sdiag)
1279 IF (sum(nelectron_spin) /= 0)
THEN
1280 DO ikind = 1,
SIZE(atomic_kind_set)
1282 CALL get_atomic_kind(atomic_kind_set(ikind), natom=natom, atom_list=atom_list)
1283 CALL get_qs_kind(qs_kind_set(ikind), basis_set=orb_basis_set, &
1284 all_potential=all_potential, &
1285 gth_potential=gth_potential, &
1286 sgp_potential=sgp_potential, &
1287 cneo_potential=cneo_potential)
1288 has_pot =
ASSOCIATED(all_potential) .OR.
ASSOCIATED(gth_potential) .OR. &
1289 ASSOCIATED(sgp_potential) .OR.
ASSOCIATED(cneo_potential)
1291 IF (dft_control%qs_control%dftb)
THEN
1293 lmax=maxll, occupation=edftb)
1294 maxll = min(maxll, maxl)
1295 econf(0:maxl) = edftb(0:maxl)
1296 ELSE IF (dft_control%qs_control%xtb)
THEN
1297 CALL get_qs_kind(qs_kind_set(ikind), xtb_parameter=xtb_kind)
1298 CALL get_xtb_atom_param(xtb_kind, z=z, natorb=nsgf, nao=naox, lao=laox, occupation=occupation)
1299 ELSE IF (has_pot)
THEN
1301 CALL get_qs_kind(qs_kind_set(ikind), nsgf=nsgf, elec_conf=elec_conf, zeff=zeff)
1302 maxll = min(
SIZE(elec_conf) - 1, maxl)
1304 econf(0:maxll) = 0.5_dp*maxocc*real(elec_conf(0:maxll),
dp)
1310 IF (dft_control%qs_control%dftb)
THEN
1312 atom_a = atom_list(iatom)
1313 isgfa = first_sgf(atom_a)
1317 pdiag(isgfa) = econf(0)
1319 pdiag(isgfa + 1) = econf(1)/3._dp
1320 pdiag(isgfa + 2) = econf(1)/3._dp
1321 pdiag(isgfa + 3) = econf(1)/3._dp
1323 pdiag(isgfa + 4) = econf(2)/5._dp
1324 pdiag(isgfa + 5) = econf(2)/5._dp
1325 pdiag(isgfa + 6) = econf(2)/5._dp
1326 pdiag(isgfa + 7) = econf(2)/5._dp
1327 pdiag(isgfa + 8) = econf(2)/5._dp
1329 pdiag(isgfa + 9) = econf(3)/7._dp
1330 pdiag(isgfa + 10) = econf(3)/7._dp
1331 pdiag(isgfa + 11) = econf(3)/7._dp
1332 pdiag(isgfa + 12) = econf(3)/7._dp
1333 pdiag(isgfa + 13) = econf(3)/7._dp
1334 pdiag(isgfa + 14) = econf(3)/7._dp
1335 pdiag(isgfa + 15) = econf(3)/7._dp
1337 cpabort(
"Only 0, 1, 2, 3 are supported as the value of la")
1341 ELSE IF (dft_control%qs_control%xtb)
THEN
1343 atom_a = atom_list(iatom)
1344 isgfa = first_sgf(atom_a)
1345 IF (z == 1 .AND. nsgf == 2)
THEN
1347 pdiag(isgfa) = 1.0_dp/real(nspin,
dp)
1348 pdiag(isgfa + 1) = 0.0_dp
1353 occ = real(occupation(la + 1),
dp)/real(2*la + 1,
dp)
1354 occ = occ/real(nspin,
dp)
1355 pdiag(isgfa + isgf - 1) = occ
1359 ELSE IF (dft_control%qs_control%semi_empirical)
THEN
1360 yy = real(dft_control%charge, kind=
dp)/real(nao, kind=
dp)
1362 atom_a = atom_list(iatom)
1363 isgfa = first_sgf(atom_a)
1366 pdiag(isgfa) = (zeff - yy)*0.5_dp*maxocc
1370 pdiag(isgfa) = (zeff - yy)*0.5_dp*maxocc
1371 pdiag(isgfa + 1) = 0._dp
1372 pdiag(isgfa + 2) = 0._dp
1373 pdiag(isgfa + 3) = 0._dp
1375 pdiag(isgfa) = (zeff*0.25_dp - yy)*0.5_dp*maxocc
1376 pdiag(isgfa + 1) = (zeff*0.25_dp - yy)*0.5_dp*maxocc
1377 pdiag(isgfa + 2) = (zeff*0.25_dp - yy)*0.5_dp*maxocc
1378 pdiag(isgfa + 3) = (zeff*0.25_dp - yy)*0.5_dp*maxocc
1381 IF (z < 21 .OR. z > 30 .AND. z < 39 .OR. z > 48 .AND. z < 57)
THEN
1383 pdiag(isgfa) = (zeff*0.25_dp - yy)*0.5_dp*maxocc
1384 pdiag(isgfa + 1) = (zeff*0.25_dp - yy)*0.5_dp*maxocc
1385 pdiag(isgfa + 2) = (zeff*0.25_dp - yy)*0.5_dp*maxocc
1386 pdiag(isgfa + 3) = (zeff*0.25_dp - yy)*0.5_dp*maxocc
1387 pdiag(isgfa + 4) = (-yy)*0.5_dp*maxocc
1388 pdiag(isgfa + 5) = (-yy)*0.5_dp*maxocc
1389 pdiag(isgfa + 6) = (-yy)*0.5_dp*maxocc
1390 pdiag(isgfa + 7) = (-yy)*0.5_dp*maxocc
1391 pdiag(isgfa + 8) = (-yy)*0.5_dp*maxocc
1392 ELSE IF (z < 99)
THEN
1393 my_sum = zeff - 9.0_dp*yy
1395 pdiag(isgfa) = (max(0.0_dp, min(my_sum, 2.0_dp)))*0.5_dp*maxocc
1396 my_sum = my_sum - 2.0_dp
1397 IF (my_sum > 0.0_dp)
THEN
1399 pdiag(isgfa + 4) = (max(0.0_dp, min(my_sum*0.2_dp, 2.0_dp)))*0.5_dp*maxocc
1400 pdiag(isgfa + 5) = (max(0.0_dp, min(my_sum*0.2_dp, 2.0_dp)))*0.5_dp*maxocc
1401 pdiag(isgfa + 6) = (max(0.0_dp, min(my_sum*0.2_dp, 2.0_dp)))*0.5_dp*maxocc
1402 pdiag(isgfa + 7) = (max(0.0_dp, min(my_sum*0.2_dp, 2.0_dp)))*0.5_dp*maxocc
1403 pdiag(isgfa + 8) = (max(0.0_dp, min(my_sum*0.2_dp, 2.0_dp)))*0.5_dp*maxocc
1404 my_sum = max(0.0_dp, my_sum - 10.0_dp)
1406 pdiag(isgfa + 1) = (my_sum/3.0_dp)*0.5_dp*maxocc
1407 pdiag(isgfa + 2) = (my_sum/3.0_dp)*0.5_dp*maxocc
1408 pdiag(isgfa + 3) = (my_sum/3.0_dp)*0.5_dp*maxocc
1412 CALL cp_abort(__location__, &
1413 "Only 1 for s-basis, 4 for sp-basis and 9 for spd-basis "// &
1414 "are supported as the value of nsgf in the MOPAC type "// &
1415 "guess for semi-empirical methods")
1423 first_sgf=first_sgfa, &
1427 DO ishell = 1, nshell(iset)
1428 la = l(ishell, iset)
1429 nelec = maxocc*real(2*la + 1,
dp)
1430 IF (econf(la) > 0.0_dp)
THEN
1431 IF (econf(la) >= nelec)
THEN
1433 econf(la) = econf(la) - nelec
1435 paa = maxocc*econf(la)/nelec
1437 ncount = ncount + nint(nelec/maxocc)
1439 DO isgfa = first_sgfa(ishell, iset), last_sgfa(ishell, iset)
1441 atom_a = atom_list(iatom)
1442 isgf = first_sgf(atom_a) + isgfa - 1
1444 IF (paa == maxocc)
THEN
1445 trps1 = trps1 + paa*sdiag(isgf)
1447 trps2 = trps2 + paa*sdiag(isgf)
1457 IF (trps2 == 0.0_dp)
THEN
1459 IF (sdiag(isgf) > 0.0_dp) pdiag(isgf) = pdiag(isgf)/sdiag(isgf)
1462 IF (nelectron_spin(ispin) /= 0)
THEN
1463 rscale = sum(pdiag)/real(nelectron_spin(ispin),
dp)
1464 matrix_p => pmat(ispin)%matrix
1465 pdiag = pdiag/rscale
1467 pdiag = pdiag*rscale
1472 IF (nelectron_spin(ispin) /= 0)
THEN
1473 rscale = (real(nelectron_spin(ispin),
dp) - trps1)/trps2
1475 IF (pdiag(isgf) < maxocc) pdiag(isgf) = rscale*pdiag(isgf)
1477 matrix_p => pmat(ispin)%matrix
1480 IF (pdiag(isgf) < maxocc) pdiag(isgf) = pdiag(isgf)/rscale
1489 DEALLOCATE (first_sgf)
1495 CALL timestop(handle)
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.
subroutine, public get_atomic_kind_set(atomic_kind_set, atom_of_kind, kind_of, natom_of_kind, maxatom, natom, nshell, fist_potential_present, shell_present, shell_adiabatic, shell_check_distance, damping_present)
Get attributes of an atomic kind set.
subroutine, public get_atomic_kind(atomic_kind, fist_potential, element_symbol, name, mass, kind_number, natom, atom_list, rcov, rvdw, z, qeff, apol, cpol, mm_radius, shell, shell_active, damping)
Get attributes of an atomic kind.
subroutine, public get_gto_basis_set(gto_basis_set, name, aliases, norm_type, kind_radius, ncgf, nset, nsgf, cgf_symbol, sgf_symbol, norm_cgf, set_radius, lmax, lmin, lx, ly, lz, m, ncgf_set, npgf, nsgf_set, nshell, cphi, pgf_radius, sphi, scon, zet, first_cgf, first_sgf, l, last_cgf, last_sgf, n, gcc, maxco, maxl, maxpgf, maxsgf_set, maxshell, maxso, nco_sum, npgf_sum, nshell_sum, maxder, short_kind_radius, npgf_seg_sum, ccon)
...
Defines control structures, which contain the parameters and the settings for the DFT-based calculati...
subroutine, public dbcsr_verify_matrix(matrix, verbosity, local)
...
subroutine, public dbcsr_scale(matrix, alpha_scalar)
...
logical function, public dbcsr_iterator_blocks_left(iterator)
...
subroutine, public dbcsr_iterator_stop(iterator)
...
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_iterator_next_block(iterator, row, column, block, block_number_argument_has_been_removed, row_size, col_size, row_offset, col_offset, transposed)
...
subroutine, public dbcsr_filter(matrix, eps)
...
real(kind=dp) function, public dbcsr_get_occupation(matrix)
...
subroutine, public dbcsr_iterator_start(iterator, matrix, shared, dynamic, dynamic_byrows)
...
subroutine, public dbcsr_set(matrix, alpha)
...
subroutine, public dbcsr_release(matrix)
...
integer function, public dbcsr_get_num_blocks(matrix)
...
subroutine, public dbcsr_set_diag(matrix, diag)
Copies the diagonal elements from the given array into the given matrix.
real(kind=dp) function, public dbcsr_checksum(matrix, pos)
Calculates the checksum of a DBCSR matrix.
subroutine, public dbcsr_get_diag(matrix, diag)
Copies the diagonal elements from the given matrix into the given array.
subroutine, public dbcsr_dot(matrix_a, matrix_b, trace)
Computes the dot product of two matrices, also known as the trace of their matrix product.
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, plan)
Copy a DBCSR matrix to a BLACS matrix.
subroutine, public cp_fm_to_dbcsr_row_template(matrix, fm_in, template)
Utility function to copy a specially shaped fm to dbcsr_matrix The result matrix will be the matrix i...
subroutine, public copy_fm_to_dbcsr(fm, matrix, keep_sparsity)
Copy a BLACS matrix to a dbcsr 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,...
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_submatrix(fm, new_values, start_row, start_col, n_rows, n_cols, alpha, beta, transpose)
sets a submatrix of a full matrix fm(start_row:start_row+n_rows,start_col:start_col+n_cols) = alpha*o...
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_get_submatrix(fm, target_m, start_row, start_col, n_rows, n_cols, transpose)
gets a submatrix of a full matrix op(target_m)(1:n_rows,1:n_cols) =fm(start_row:start_row+n_rows,...
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 ...
integer function, public cp_logger_get_default_io_unit(logger)
returns the unit nr for the ionode (-1 on all other processors) skips as well checks if the procs cal...
type(cp_logger_type) function, pointer, public cp_get_default_logger()
returns the default logger
routines to handle the output, The idea is to remove the decision of wheter to output and what to out...
integer function, public cp_print_key_unit_nr(logger, basis_section, print_key_path, extension, middle_name, local, log_filename, ignore_should_output, file_form, file_position, file_action, file_status, do_backup, on_file, is_new_file, mpi_io, fout)
...
subroutine, public cp_print_key_finished_output(unit_nr, logger, basis_section, print_key_path, local, ignore_should_output, on_file, mpi_io)
should be called after you finish working with a unit obtained with cp_print_key_unit_nr,...
Definition of the atomic potential types.
Types and set/get functions for HFX.
Defines the basic variable types.
integer, parameter, public dp
integer, parameter, public default_path_length
Restart file for k point calculations.
subroutine, public read_kpoints_restart(denmat, kpoints, fmwork, natom, para_env, id_nr, dft_section, natom_mismatch)
...
Types and basic routines needed for a kpoint calculation.
Interface to the message passing library MPI.
Define methods related to particle_type.
subroutine, public get_particle_set(particle_set, qs_kind_set, first_sgf, last_sgf, nsgf, nmao, basis, ncgf)
Get the components of a particle set.
Define the data structure for the particle information.
Routine to return block diagonal density matrix. Blocks correspond to the atomic densities.
subroutine, public calculate_atomic_block_dm(pmatrix, matrix_s, atomic_kind_set, qs_kind_set, nspin, nelectron_spin, ounit, para_env)
returns a block diagonal density matrix. Blocks correspond to the atomic densities.
Types used by CNEO-DFT (see J. Chem. Theory Comput. 2025, 21, 16, 7865–7877).
collects routines that calculate density matrices
Working with the DFTB parameter types.
subroutine, public get_dftb_atom_param(dftb_parameter, name, typ, defined, z, zeff, natorb, lmax, skself, occupation, eta, energy, cutoff, xi, di, rcdisp, dudq)
...
Generate an initial guess (dm and orb) from EHT calculation.
subroutine, public calculate_eht_guess(qs_env, mo_array)
EHT MO guess calclulation.
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.
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...
subroutine, public calculate_mopac_dm(pmat, matrix_s, has_unit_metric, dft_control, particle_set, atomic_kind_set, qs_kind_set, nspin, nelectron_spin, para_env)
returns a block diagonal density matrix. Blocks correspond to the mopac initial guess.
subroutine, public calculate_atomic_fock_matrix(matrix_f, atomic_kind_set, qs_kind_set, ounit)
returns a block diagonal fock matrix.
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 get_qs_kind_set(qs_kind_set, all_potential_present, tnadd_potential_present, gth_potential_present, sgp_potential_present, paw_atom_present, dft_plus_u_atom_present, maxcgf, maxsgf, maxco, maxco_proj, maxgtops, maxlgto, maxlprj, maxnset, maxsgf_set, ncgf, npgf, nset, nsgf, nshell, maxpol, maxlppl, maxlppnl, maxppnl, nelectron, maxder, max_ngrid_rad, max_sph_harm, maxg_iso_not0, lmax_rho0, basis_rcut, do_mtlr_present, basis_type, total_zeff_corr, npgf_seg, cneo_potential_present, nkind_q, natom_q)
Get attributes of an atomic kind set.
Definition and initialisation of the mo data type.
subroutine, public wfn_restart_file_name(filename, exist, section, logger, kp, xas, rtp)
...
subroutine, public read_mo_set_from_restart(mo_array, qs_kind_set, particle_set, para_env, id_nr, multiplicity, dft_section, natom_mismatch, cdft, out_unit)
...
collects routines that perform operations directly related to MOs
subroutine, public make_basis_simple(vmatrix, ncol)
given a set of vectors, return an orthogonal (C^T C == 1) set spanning the same space (notice,...
subroutine, public make_basis_lowdin(vmatrix, ncol, matrix_s)
return a set of S orthonormal vectors (C^T S C == 1) where a Loedwin transformation is applied to kee...
subroutine, public make_basis_sm(vmatrix, ncol, matrix_s)
returns an S-orthonormal basis v (v^T S v ==1)
Set occupation of molecular orbitals.
Definition and initialisation of the mo data type.
subroutine, public mo_set_restrict(mo_array, convert_dbcsr)
make the beta orbitals explicitly equal to the alpha orbitals effectively copying the orbital data
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.
subroutine, public reassign_allocated_mos(mo_set_new, mo_set_old)
reassign an already allocated mo_set
methods for deltaSCF calculations
subroutine, public do_mom_guess(nspins, mos, scf_control, p_rmpv)
initial guess for the maximum overlap method
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...
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...
groups fairly general SCF methods, so that modules other than qs_scf can use them too split off from ...
subroutine, public eigensolver_simple(matrix_ks, mo_set, work, do_level_shift, level_shift, use_jacobi, jacobi_threshold)
...
subroutine, public eigensolver(matrix_ks_fm, mo_set, ortho, work, cholesky_method, do_level_shift, level_shift, matrix_u_fm, use_jacobi)
Diagonalise the Kohn-Sham matrix to get a new set of MO eigen- vectors and MO eigenvalues....
module that contains the definitions of the scf types
integer, parameter, public ot_diag_method_nr
integer, parameter, public block_davidson_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...
subroutine, public wfi_update(wf_history, qs_env, dt)
updates the snapshot buffer, taking a new snapshot
parameters that control an scf iteration
All kind of helpful little routines.
Definition of the xTB parameter types.
subroutine, public get_xtb_atom_param(xtb_parameter, symbol, aname, typ, defined, z, zeff, natorb, lmax, nao, lao, rcut, rcov, kx, eta, xgamma, alpha, zneff, nshell, nval, lval, kpoly, kappa, wall, hen, zeta, xi, kappa0, alpg, occupation, ngauss, electronegativity, chmax, en, kqat2, kcn, kq)
...
Provides all information about an atomic kind.
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...
stores some data used in construction of Kohn-Sham matrix
Contains information about kpoints.
stores all the informations relevant to an mpi environment
Provides all information about a quickstep kind.
keeps the density in various representations, keeping track of which ones are valid.