81#include "./base/base_uses.f90"
87 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'dft_plus_u'
102 SUBROUTINE plus_u(qs_env, matrix_h, matrix_w)
106 POINTER :: matrix_h, matrix_w
108 CHARACTER(LEN=*),
PARAMETER :: routinen =
'plus_u'
110 INTEGER :: handle, output_unit, print_level
111 LOGICAL :: orthonormal_basis, should_output
116 CALL timeset(routinen, handle)
118 cpassert(
ASSOCIATED(qs_env))
120 NULLIFY (input, dft_control)
126 dft_control=dft_control)
134 orthonormal_basis = .false.
138 print_level = logger%iter_info%print_level
141 (.NOT.
PRESENT(matrix_w)))
143 extension=
".plus_u", &
144 ignore_should_output=should_output, &
145 log_filename=.false.)
149 SELECT CASE (dft_control%plus_u_method_id)
151 IF (orthonormal_basis)
THEN
154 CALL mulliken(qs_env, orthonormal_basis, matrix_h, &
155 should_output, output_unit, print_level)
157 CALL lowdin(qs_env, matrix_h, matrix_w, &
158 should_output, output_unit, print_level)
161 CALL mulliken(qs_env, orthonormal_basis, matrix_h, &
162 should_output, output_unit, print_level)
164 CALL mulliken_charges(qs_env, orthonormal_basis, matrix_h, matrix_w, &
165 should_output, output_unit, print_level)
167 cpabort(
"Invalid DFT+U method requested")
171 ignore_should_output=should_output)
173 CALL timestop(handle)
206 SUBROUTINE lowdin(qs_env, matrix_h, matrix_w, should_output, output_unit, &
211 POINTER :: matrix_h, matrix_w
212 LOGICAL,
INTENT(IN) :: should_output
213 INTEGER,
INTENT(IN) :: output_unit, print_level
215 CHARACTER(LEN=*),
PARAMETER :: routinen =
'lowdin'
217 CHARACTER(LEN=10) :: spin_info
218 CHARACTER(LEN=6),
ALLOCATABLE,
DIMENSION(:) :: symbol
219 CHARACTER(LEN=default_string_length) :: atomic_kind_name
220 INTEGER :: atom_a, handle, i, i0, iatom, ikind, iorb, isb, iset, isgf, ishell, ispin, j, &
221 jsb, jset, jsgf, jshell, lu, m, max_scf, n, natom, natom_of_kind, nimg, nkind, norb, nsb, &
222 nsbsize, nset, nsgf, nsgf_kind, nspin
223 INTEGER,
ALLOCATABLE,
DIMENSION(:) :: first_sgf_atom
224 INTEGER,
DIMENSION(1) :: iloc
225 INTEGER,
DIMENSION(:),
POINTER :: atom_list, nshell, orbitals
226 INTEGER,
DIMENSION(:, :),
POINTER :: first_sgf, l, last_sgf
227 LOGICAL :: debug, dft_plus_u_atom, do_kpoints, &
228 found, just_energy, smear
229 LOGICAL,
ALLOCATABLE,
DIMENSION(:) :: orb_occ
230 REAL(kind=
dp) :: eps_scf, eps_u_ramping, fspin, occ, sij, &
231 trq, trq2, u_minus_j, &
232 u_minus_j_target, u_ramping
233 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:) :: eigval, q_eigval
234 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:, :) :: orbq, q_eigvec, q_matrix, q_work, slam
235 REAL(kind=
dp),
CONTIGUOUS,
DIMENSION(:, :), &
236 POINTER :: local_data
237 REAL(kind=
dp),
DIMENSION(:, :),
POINTER :: q_block, v_block
240 TYPE(
cp_fm_type) :: fm_sev, fm_work1, fm_work2, slambda
241 TYPE(
cp_fm_type),
DIMENSION(:),
POINTER :: fm_wmat
243 TYPE(
dbcsr_p_type),
DIMENSION(:, :),
POINTER :: matrix_p, matrix_s
245 TYPE(
dbcsr_type),
POINTER :: sm_h, sm_p, sm_s, sm_w
252 TYPE(
qs_kind_type),
DIMENSION(:),
POINTER :: qs_kind_set
256 CALL timeset(routinen, handle)
260 NULLIFY (sm_h, sm_p, sm_s, sm_w)
267 atomic_kind_set=atomic_kind_set, &
268 qs_kind_set=qs_kind_set, &
269 dft_control=dft_control, &
270 do_kpoints=do_kpoints, &
273 matrix_s_kp=matrix_s, &
274 particle_set=particle_set, &
281 energy%dft_plus_u = 0.0_dp
283 nspin = dft_control%nspins
284 nimg = dft_control%nimages
298 nkind =
SIZE(atomic_kind_set)
300 ALLOCATE (first_sgf_atom(natom))
301 first_sgf_atom(:) = 0
303 first_sgf=first_sgf_atom)
305 IF (
PRESENT(matrix_h) .OR.
PRESENT(matrix_w))
THEN
306 just_energy = .false.
312 fm_wmat => scf_env%scf_work1
313 fmstruct => fm_wmat(1)%matrix_struct
316 fm_s_half => scf_env%s_half
317 cpassert(
ASSOCIATED(fm_s_half))
321 CALL cp_fm_create(matrix=fm_work1, matrix_struct=fmstruct, &
322 name=
"FULL WORK MATRIX 1")
323 CALL cp_fm_create(matrix=fm_work2, matrix_struct=fmstruct, &
324 name=
"FULL WORK MATRIX 2")
329 IF (
PRESENT(matrix_w))
THEN
331 cpabort(
"Lowdin forces with k-points NYA in DFT+U")
333 CALL cp_fm_create(matrix=fm_sev, matrix_struct=fmstruct)
334 CALL cp_fm_create(matrix=slambda, matrix_struct=fmstruct)
335 ALLOCATE (eigval(nsgf), slam(nsgf, 1))
336 sm_s => matrix_s(1, 1)%matrix
341 IF (eigval(i) > 0._dp)
THEN
342 slam(i, 1) = sqrt(eigval(i))
344 cpabort(
"S matrix not positive definit")
354 DO i = 1,
SIZE(local_data, 2)
355 DO j = 1,
SIZE(local_data, 1)
356 sij = local_data(j, i)
357 IF (sij > 0.0_dp) sij = 1.0_dp/sij
358 local_data(j, i) = sij
361 DEALLOCATE (eigval, slam)
366 cpabort(
"Lowdin option with k-points NYA in DFT+U")
367 ALLOCATE (orbq(nsgf, nspin))
373 sm_s => matrix_s(1, 1)%matrix
384 cpabort(
"Lowdin option with k-points NYA in DFT+U")
387 sm_p => matrix_p(ispin, 1)%matrix
395 matrix_a=fm_s_half, &
401 output_unit=output_unit)
403 output_unit=output_unit)
405 output_unit=output_unit)
425 atom_list=atom_list, &
426 name=atomic_kind_name, &
430 dft_plus_u_atom=dft_plus_u_atom, &
431 l_of_dft_plus_u=lu, &
433 basis_set=orb_basis_set, &
434 u_minus_j=u_minus_j, &
435 u_minus_j_target=u_minus_j_target, &
436 u_ramping=u_ramping, &
437 eps_u_ramping=eps_u_ramping, &
444 IF (.NOT.
ASSOCIATED(orb_basis_set)) cycle
445 IF (.NOT. dft_plus_u_atom) cycle
449 IF ((ispin == 1) .AND. (u_ramping > 0.0_dp))
THEN
450 IF (qs_env%scf_env%iter_delta <= eps_u_ramping)
THEN
451 u_minus_j = min(u_minus_j + u_ramping, u_minus_j_target)
452 CALL set_qs_kind(qs_kind_set(ikind), u_minus_j=u_minus_j)
454 IF (should_output .AND. (output_unit > 0))
THEN
455 WRITE (unit=output_unit, fmt=
"(T3,A,3X,A,F0.3,A)") &
456 "Kind name: "//trim(adjustl(atomic_kind_name)), &
457 "U(eff) = ", u_minus_j*
evolt,
" eV"
461 IF (u_minus_j == 0.0_dp) cycle
465 first_sgf=first_sgf, &
474 DO ishell = 1, nshell(iset)
475 IF (l(ishell, iset) == lu) nsb = nsb + 1
482 ALLOCATE (q_matrix(n, n))
483 q_matrix(:, :) = 0.0_dp
487 IF (output_unit > 0)
THEN
488 ALLOCATE (symbol(nsbsize))
493 WRITE (unit=spin_info, fmt=
"(A8,I2)")
" of spin", ispin
497 WRITE (unit=output_unit, fmt=
"(/,T3,A,I0,A,/,/,T5,A,10(2X,A6))") &
498 "DFT+U occupations"//trim(spin_info)//
" for the atoms of atomic kind ", ikind, &
499 ": "//trim(atomic_kind_name), &
500 "Atom Shell ", (adjustr(symbol(i)), i=1, nsbsize),
" Trace"
506 DO iatom = 1, natom_of_kind
507 atom_a = atom_list(iatom)
508 q_matrix(:, :) = 0.0_dp
517 IF (
ASSOCIATED(q_block))
THEN
521 DO ishell = 1, nshell(iset)
522 IF (l(ishell, iset) /= lu) cycle
523 DO isgf = first_sgf(ishell, iset), last_sgf(ishell, iset)
527 DO jshell = 1, nshell(jset)
528 IF (l(jshell, jset) /= lu) cycle
529 DO jsgf = first_sgf(jshell, jset), last_sgf(jshell, jset)
531 IF (isgf == jsgf) q_matrix(i, j) = q_block(isgf, jsgf)
540 IF (
ASSOCIATED(orbitals))
THEN
541 IF ((qs_env%scf_env%iter_delta >= eps_scf) .OR. &
542 ((qs_env%scf_env%outer_scf%iter_count == 0) .AND. &
543 (qs_env%scf_env%iter_count <= max_scf)))
THEN
544 ALLOCATE (orb_occ(nsbsize))
545 ALLOCATE (q_eigval(n))
547 ALLOCATE (q_eigvec(n, n))
548 q_eigvec(:, :) = 0.0_dp
549 norb =
SIZE(orbitals)
550 CALL jacobi(q_matrix, q_eigval, q_eigvec)
551 q_matrix(:, :) = 0.0_dp
554 DO i = (isb - 1)*nsbsize + 1, isb*nsbsize
555 trq = trq + q_eigval(i)
558 occ = trq/real(norb, kind=
dp)
563 iloc = maxloc(q_eigvec(:, isb*nsbsize))
564 jsb = int((iloc(1) - 1)/nsbsize) + 1
566 i0 = (jsb - 1)*nsbsize + 1
568 DO j = i0, jsb*nsbsize
572 IF (.NOT. orb_occ(lu + m + 1))
THEN
574 orb_occ(lu + m + 1) = .true.
578 iorb = i0 + lu + orbitals(i)
579 orb_occ(lu + orbitals(i) + 1) = .true.
581 cpassert(iorb /= -1000)
582 iloc = maxloc(q_eigvec(iorb, :))
583 q_eigval(iloc(1)) = min(occ, trq)
584 q_matrix(:, iloc(1)) = q_eigval(iloc(1))*q_eigvec(:, iloc(1))
585 trq = trq - q_eigval(iloc(1))
588 q_matrix(:, :) = matmul(q_matrix, transpose(q_eigvec))
590 DEALLOCATE (q_eigval)
591 DEALLOCATE (q_eigvec)
598 trq = trq + q_matrix(i, i)
600 trq2 = trq2 + q_matrix(i, j)*q_matrix(j, i)
604 trq2 = fspin*fspin*trq2
607 energy%dft_plus_u = energy%dft_plus_u + 0.5_dp*u_minus_j*(trq - trq2)/fspin
610 IF (.NOT. just_energy)
THEN
616 cpassert(
ASSOCIATED(v_block))
620 DO ishell = 1, nshell(iset)
621 IF (l(ishell, iset) /= lu) cycle
622 DO isgf = first_sgf(ishell, iset), last_sgf(ishell, iset)
626 DO jshell = 1, nshell(jset)
627 IF (l(jshell, jset) /= lu) cycle
628 DO jsgf = first_sgf(jshell, jset), last_sgf(jshell, jset)
630 IF (isgf == jsgf)
THEN
631 v_block(isgf, isgf) = u_minus_j*(0.5_dp - fspin*q_matrix(i, i))
633 cpassert(abs(q_matrix(j, i)) < 1.0e-14_dp)
634 v_block(isgf, jsgf) = -u_minus_j*fspin*q_matrix(j, i)
648 CALL para_env%sum(q_matrix)
649 IF (output_unit > 0)
THEN
650 ALLOCATE (q_work(nsb, nsbsize))
651 q_work(:, :) = 0.0_dp
654 DO i = (isb - 1)*nsbsize + 1, isb*nsbsize
656 q_work(isb, j) = q_matrix(i, i)
660 WRITE (unit=output_unit, fmt=
"(T3,I6,2X,I6,2X,10F8.3)") &
661 atom_a, isb, q_work(isb, :), sum(q_work(isb, :))
663 WRITE (unit=output_unit, fmt=
"(T12,A,2X,10F8.3)") &
664 "Total", (sum(q_work(:, i)), i=1, nsbsize), sum(q_work)
665 WRITE (unit=output_unit, fmt=
"(A)")
""
669 WRITE (unit=output_unit, fmt=
"(T9,70I10)") (i, i=1, n)
671 WRITE (unit=output_unit, fmt=
"(T3,I6,70F10.6)") i, q_matrix(i, :)
674 ALLOCATE (q_eigval(n))
676 ALLOCATE (q_eigvec(n, n))
677 q_eigvec(:, :) = 0.0_dp
678 CALL jacobi(q_matrix, q_eigval, q_eigvec)
679 WRITE (unit=output_unit, fmt=
"(/,T9,70I10)") (i, i=1, n)
680 WRITE (unit=output_unit, fmt=
"(T9,71F10.6)") (q_eigval(i), i=1, n), &
683 WRITE (unit=output_unit, fmt=
"(T3,I6,70F10.6)") i, q_eigvec(i, :)
685 DEALLOCATE (q_eigval)
686 DEALLOCATE (q_eigvec)
691 ALLOCATE (q_work(nsgf_kind, nsgf_kind))
692 q_work(:, :) = 0.0_dp
693 IF (
ASSOCIATED(q_block)) q_work(:, :) = q_block(:, :)
694 CALL para_env%sum(q_work)
695 IF (output_unit > 0)
THEN
696 norb =
SIZE(q_work, 1)
697 WRITE (unit=output_unit, fmt=
"(/,T9,200I10)") (i, i=1, norb)
699 WRITE (unit=output_unit, fmt=
"(T3,I6,200F10.6)") i, q_work(i, :)
701 ALLOCATE (q_eigval(norb))
703 ALLOCATE (q_eigvec(norb, norb))
704 q_eigvec(:, :) = 0.0_dp
705 CALL jacobi(q_work, q_eigval, q_eigvec)
706 WRITE (unit=output_unit, fmt=
"(/,T9,200I10)") (i, i=1, norb)
707 WRITE (unit=output_unit, fmt=
"(T9,201F10.6)") (q_eigval(i), i=1, norb), &
708 sum(q_eigval(1:norb))
710 WRITE (unit=output_unit, fmt=
"(T3,I6,200F10.6)") i, q_eigvec(i, :)
712 DEALLOCATE (q_eigval)
713 DEALLOCATE (q_eigvec)
721 IF (
ALLOCATED(q_matrix))
THEN
722 DEALLOCATE (q_matrix)
727 IF (
PRESENT(matrix_h))
THEN
729 cpabort(
"Lowdin option with k-points NYA in DFT+U")
731 sm_h => matrix_h(ispin, 1)%matrix
740 IF (
PRESENT(matrix_w))
THEN
742 sm_p => matrix_p(ispin, 1)%matrix
743 sm_w => matrix_w(ispin, 1)%matrix
748 CALL parallel_gemm(
'N',
'N', nsgf, nsgf, nsgf, 1.0_dp, fm_work1, fm_sev, 0.0_dp, fm_work2)
749 CALL parallel_gemm(
'T',
'N', nsgf, nsgf, nsgf, 1.0_dp, fm_sev, fm_work2, 0.0_dp, fm_work1)
753 CALL parallel_gemm(
'N',
'N', nsgf, nsgf, nsgf, -2.0_dp, fm_sev, fm_work2, 0.0_dp, fm_work1)
760 IF (
PRESENT(matrix_w))
THEN
767 CALL para_env%sum(energy%dft_plus_u)
769 IF (energy%dft_plus_u < 0.0_dp) &
770 CALL cp_warn(__location__, &
771 "DFT+U energy contribution is negative possibly due "// &
772 "to unphysical Lowdin charges!")
783 CALL timestop(handle)
785 END SUBROUTINE lowdin
817 SUBROUTINE mulliken(qs_env, orthonormal_basis, matrix_h, should_output, &
818 output_unit, print_level)
821 LOGICAL,
INTENT(IN) :: orthonormal_basis
824 LOGICAL,
INTENT(IN) :: should_output
825 INTEGER,
INTENT(IN) :: output_unit, print_level
827 CHARACTER(LEN=*),
PARAMETER :: routinen =
'mulliken'
829 CHARACTER(LEN=10) :: spin_info
830 CHARACTER(LEN=6),
ALLOCATABLE,
DIMENSION(:) :: symbol
831 CHARACTER(LEN=default_string_length) :: atomic_kind_name
832 INTEGER :: atom_a, handle, i, i0, iatom, ic, ikind, iorb, isb, iset, isgf, ishell, ispin, j, &
833 jsb, jset, jsgf, jshell, lu, m, max_scf, n, natom, natom_of_kind, nimg, nkind, norb, nsb, &
834 nsbsize, nset, nsgf_kind, nspin
835 INTEGER,
DIMENSION(1) :: iloc
836 INTEGER,
DIMENSION(:),
POINTER :: atom_list, nshell, orbitals
837 INTEGER,
DIMENSION(:, :),
POINTER :: first_sgf, l, last_sgf
838 LOGICAL :: debug, dft_plus_u_atom, found, &
839 just_energy, occupation_enforced, smear
840 LOGICAL,
ALLOCATABLE,
DIMENSION(:) :: is_plus_u_kind, orb_occ
841 REAL(kind=
dp) :: eps_scf, eps_u_ramping, fspin, occ, trq, &
842 trq2, u_minus_j, u_minus_j_target, &
844 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:) :: q_eigval
845 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:, :) :: q_eigvec, q_matrix, q_work
846 REAL(kind=
dp),
DIMENSION(:),
POINTER :: nelec
847 REAL(kind=
dp),
DIMENSION(:, :),
POINTER :: h_block, p_block, q_block, s_block, &
851 TYPE(
dbcsr_p_type),
DIMENSION(:, :),
POINTER :: matrix_p, matrix_s
852 TYPE(
dbcsr_type),
POINTER :: sm_h, sm_p, sm_q, sm_s, sm_v
858 TYPE(
qs_kind_type),
DIMENSION(:),
POINTER :: qs_kind_set
861 CALL timeset(routinen, handle)
866 NULLIFY (atomic_kind_set)
867 NULLIFY (qs_kind_set)
868 NULLIFY (dft_control)
878 NULLIFY (orb_basis_set)
880 NULLIFY (particle_set)
896 occupation_enforced = .false.
899 atomic_kind_set=atomic_kind_set, &
900 qs_kind_set=qs_kind_set, &
901 dft_control=dft_control, &
903 particle_set=particle_set, &
907 cpassert(
ASSOCIATED(atomic_kind_set))
908 cpassert(
ASSOCIATED(dft_control))
909 cpassert(
ASSOCIATED(energy))
910 cpassert(
ASSOCIATED(particle_set))
911 cpassert(
ASSOCIATED(rho))
913 IF (orthonormal_basis)
THEN
918 matrix_s_kp=matrix_s)
919 cpassert(
ASSOCIATED(matrix_s))
921 nimg = dft_control%nimages
927 energy%dft_plus_u = 0.0_dp
929 nspin = dft_control%nspins
943 nkind =
SIZE(atomic_kind_set)
945 ALLOCATE (is_plus_u_kind(nkind))
946 is_plus_u_kind(:) = .false.
948 IF (
PRESENT(matrix_h))
THEN
949 just_energy = .false.
959 IF (.NOT. orthonormal_basis)
THEN
960 sm_s => matrix_s(1, ic)%matrix
963 IF (
PRESENT(matrix_h))
THEN
965 sm_h => matrix_h(ispin, ic)%matrix
972 sm_p => matrix_p(ispin, ic)%matrix
974 IF (.NOT.
ASSOCIATED(sm_q))
THEN
980 IF (.NOT.
ASSOCIATED(sm_v))
THEN
994 IF (.NOT.
ASSOCIATED(p_block)) cycle
1001 cpassert(
ASSOCIATED(q_block))
1003 IF (orthonormal_basis)
THEN
1005 DO isgf = 1,
SIZE(q_block, 1)
1006 q_block(isgf, isgf) = p_block(isgf, isgf)
1014 cpassert(
ASSOCIATED(s_block))
1016 DO jsgf = 1,
SIZE(p_block, 2)
1017 DO isgf = 1,
SIZE(p_block, 1)
1018 q_block(isgf, jsgf) = p_block(isgf, jsgf)*s_block(isgf, jsgf)
1039 atom_list=atom_list, &
1040 name=atomic_kind_name, &
1041 natom=natom_of_kind)
1044 dft_plus_u_atom=dft_plus_u_atom, &
1045 l_of_dft_plus_u=lu, &
1047 basis_set=orb_basis_set, &
1048 u_minus_j=u_minus_j, &
1049 u_minus_j_target=u_minus_j_target, &
1050 u_ramping=u_ramping, &
1051 eps_u_ramping=eps_u_ramping, &
1053 orbitals=orbitals, &
1060 IF (.NOT.
ASSOCIATED(orb_basis_set)) cycle
1061 IF (.NOT. dft_plus_u_atom) cycle
1066 IF ((ispin == 1) .AND. (u_ramping > 0.0_dp))
THEN
1067 IF (qs_env%scf_env%iter_delta <= eps_u_ramping)
THEN
1068 u_minus_j = min(u_minus_j + u_ramping, u_minus_j_target)
1069 CALL set_qs_kind(qs_kind_set(ikind), u_minus_j=u_minus_j)
1071 IF (should_output .AND. (output_unit > 0))
THEN
1072 WRITE (unit=output_unit, fmt=
"(T3,A,3X,A,F0.3,A)") &
1073 "Kind name: "//trim(adjustl(atomic_kind_name)), &
1074 "U(eff) = ", u_minus_j*
evolt,
" eV"
1078 IF (u_minus_j == 0.0_dp) cycle
1080 is_plus_u_kind(ikind) = .true.
1085 first_sgf=first_sgf, &
1087 last_sgf=last_sgf, &
1095 DO ishell = 1, nshell(iset)
1096 IF (l(ishell, iset) == lu) nsb = nsb + 1
1100 nsbsize = (2*lu + 1)
1103 ALLOCATE (q_matrix(n, n))
1104 q_matrix(:, :) = 0.0_dp
1109 IF (output_unit > 0)
THEN
1110 ALLOCATE (symbol(nsbsize))
1115 WRITE (unit=spin_info, fmt=
"(A8,I2)")
" of spin", ispin
1119 WRITE (unit=output_unit, fmt=
"(/,T3,A,I0,A,/,/,T5,A,10(2X,A6))") &
1120 "DFT+U occupations"//trim(spin_info)//
" for the atoms of atomic kind ", ikind, &
1121 ": "//trim(atomic_kind_name), &
1122 "Atom Shell ", (adjustr(symbol(i)), i=1, nsbsize),
" Trace"
1129 DO iatom = 1, natom_of_kind
1131 atom_a = atom_list(iatom)
1133 q_matrix(:, :) = 0.0_dp
1145 IF (
ASSOCIATED(q_block))
THEN
1149 DO ishell = 1, nshell(iset)
1150 IF (l(ishell, iset) /= lu) cycle
1151 DO isgf = first_sgf(ishell, iset), last_sgf(ishell, iset)
1155 DO jshell = 1, nshell(jset)
1156 IF (l(jshell, jset) /= lu) cycle
1157 DO jsgf = first_sgf(jshell, jset), last_sgf(jshell, jset)
1159 q_matrix(i, j) = q_block(isgf, jsgf)
1169 IF (
ASSOCIATED(orbitals))
THEN
1170 IF ((qs_env%scf_env%iter_delta >= eps_scf) .OR. &
1171 ((qs_env%scf_env%outer_scf%iter_count == 0) .AND. &
1172 (qs_env%scf_env%iter_count <= max_scf)))
THEN
1173 ALLOCATE (orb_occ(nsbsize))
1174 ALLOCATE (q_eigval(n))
1175 q_eigval(:) = 0.0_dp
1176 ALLOCATE (q_eigvec(n, n))
1177 q_eigvec(:, :) = 0.0_dp
1178 norb =
SIZE(orbitals)
1179 CALL jacobi(q_matrix, q_eigval, q_eigvec)
1180 q_matrix(:, :) = 0.0_dp
1181 IF (nelec(ispin) >= 0.5_dp)
THEN
1182 trq = nelec(ispin)/sum(q_eigval(1:n))
1183 q_eigval(1:n) = trq*q_eigval(1:n)
1187 DO i = (isb - 1)*nsbsize + 1, isb*nsbsize
1188 trq = trq + q_eigval(i)
1191 occ = trq/real(norb, kind=
dp)
1195 orb_occ(:) = .false.
1196 iloc = maxloc(q_eigvec(:, isb*nsbsize))
1197 jsb = int((iloc(1) - 1)/nsbsize) + 1
1199 i0 = (jsb - 1)*nsbsize + 1
1201 DO j = i0, jsb*nsbsize
1205 IF (.NOT. orb_occ(lu + m + 1))
THEN
1207 orb_occ(lu + m + 1) = .true.
1211 iorb = i0 + lu + orbitals(i)
1212 orb_occ(lu + orbitals(i) + 1) = .true.
1214 cpassert(iorb /= -1000)
1215 iloc = maxloc(q_eigvec(iorb, :))
1216 q_eigval(iloc(1)) = min(occ, trq)
1217 q_matrix(:, iloc(1)) = q_eigval(iloc(1))*q_eigvec(:, iloc(1))
1218 trq = trq - q_eigval(iloc(1))
1221 q_matrix(:, :) = matmul(q_matrix, transpose(q_eigvec))
1222 DEALLOCATE (orb_occ)
1223 DEALLOCATE (q_eigval)
1224 DEALLOCATE (q_eigvec)
1225 occupation_enforced = .true.
1233 trq = trq + q_matrix(i, i)
1235 trq2 = trq2 + q_matrix(i, j)*q_matrix(j, i)
1240 trq2 = fspin*fspin*trq2
1244 energy%dft_plus_u = energy%dft_plus_u + 0.5_dp*u_minus_j*(trq - trq2)/fspin
1248 IF (.NOT. just_energy)
THEN
1255 cpassert(
ASSOCIATED(v_block))
1259 DO ishell = 1, nshell(iset)
1260 IF (l(ishell, iset) /= lu) cycle
1261 DO isgf = first_sgf(ishell, iset), last_sgf(ishell, iset)
1265 DO jshell = 1, nshell(jset)
1266 IF (l(jshell, jset) /= lu) cycle
1267 DO jsgf = first_sgf(jshell, jset), last_sgf(jshell, jset)
1269 IF (isgf == jsgf)
THEN
1270 v_block(isgf, isgf) = u_minus_j*(0.5_dp - fspin*q_matrix(i, i))
1272 v_block(isgf, jsgf) = -u_minus_j*fspin*q_matrix(j, i)
1288 CALL para_env%sum(q_matrix)
1289 IF (output_unit > 0)
THEN
1290 ALLOCATE (q_work(nsb, nsbsize))
1291 q_work(:, :) = 0.0_dp
1294 DO i = (isb - 1)*nsbsize + 1, isb*nsbsize
1296 q_work(isb, j) = q_matrix(i, i)
1300 WRITE (unit=output_unit, fmt=
"(T3,I6,2X,I6,2X,10F8.3)") &
1301 atom_a, isb, q_work(isb, :), sum(q_work(isb, :))
1303 WRITE (unit=output_unit, fmt=
"(T12,A,2X,10F8.3)") &
1304 "Total", (sum(q_work(:, i)), i=1, nsbsize), sum(q_work)
1305 WRITE (unit=output_unit, fmt=
"(A)")
""
1309 WRITE (unit=output_unit, fmt=
"(T9,70I10)") (i, i=1, n)
1311 WRITE (unit=output_unit, fmt=
"(T3,I6,70F10.6)") i, q_matrix(i, :)
1314 ALLOCATE (q_eigval(n))
1315 q_eigval(:) = 0.0_dp
1316 ALLOCATE (q_eigvec(n, n))
1317 q_eigvec(:, :) = 0.0_dp
1318 CALL jacobi(q_matrix, q_eigval, q_eigvec)
1319 WRITE (unit=output_unit, fmt=
"(/,T9,70I10)") (i, i=1, n)
1320 WRITE (unit=output_unit, fmt=
"(T9,71F10.6)") (q_eigval(i), i=1, n), &
1323 WRITE (unit=output_unit, fmt=
"(T3,I6,70F10.6)") i, q_eigvec(i, :)
1325 DEALLOCATE (q_eigval)
1326 DEALLOCATE (q_eigvec)
1331 ALLOCATE (q_work(nsgf_kind, nsgf_kind))
1332 q_work(:, :) = 0.0_dp
1333 IF (
ASSOCIATED(q_block)) q_work(:, :) = q_block(:, :)
1334 CALL para_env%sum(q_work)
1335 IF (output_unit > 0)
THEN
1336 norb =
SIZE(q_work, 1)
1337 WRITE (unit=output_unit, fmt=
"(/,T9,200I10)") (i, i=1, norb)
1339 WRITE (unit=output_unit, fmt=
"(T3,I6,200F10.6)") i, q_work(i, :)
1341 ALLOCATE (q_eigval(norb))
1342 q_eigval(:) = 0.0_dp
1343 ALLOCATE (q_eigvec(norb, norb))
1344 q_eigvec(:, :) = 0.0_dp
1345 CALL jacobi(q_work, q_eigval, q_eigvec)
1346 WRITE (unit=output_unit, fmt=
"(/,T9,200I10)") (i, i=1, norb)
1347 WRITE (unit=output_unit, fmt=
"(T9,201F10.6)") (q_eigval(i), i=1, norb), &
1348 sum(q_eigval(1:norb))
1350 WRITE (unit=output_unit, fmt=
"(T3,I6,200F10.6)") i, q_eigvec(i, :)
1352 DEALLOCATE (q_eigval)
1353 DEALLOCATE (q_eigvec)
1361 IF (
ALLOCATED(q_matrix))
THEN
1362 DEALLOCATE (q_matrix)
1369 IF (
ASSOCIATED(sm_h))
THEN
1373 IF (.NOT. is_plus_u_kind(ikind)) cycle
1375 kind_a => atomic_kind_set(ikind)
1378 atom_list=atom_list, &
1379 natom=natom_of_kind)
1381 DO iatom = 1, natom_of_kind
1383 atom_a = atom_list(iatom)
1391 IF (.NOT.
ASSOCIATED(h_block)) cycle
1398 cpassert(
ASSOCIATED(v_block))
1400 IF (orthonormal_basis)
THEN
1401 DO isgf = 1,
SIZE(h_block, 1)
1402 h_block(isgf, isgf) = h_block(isgf, isgf) + v_block(isgf, isgf)
1410 cpassert(
ASSOCIATED(s_block))
1411 DO jsgf = 1,
SIZE(h_block, 2)
1412 DO isgf = 1,
SIZE(h_block, 1)
1413 h_block(isgf, jsgf) = h_block(isgf, jsgf) + v_block(isgf, jsgf)*s_block(isgf, jsgf)
1430 CALL para_env%sum(energy%dft_plus_u)
1432 IF (energy%dft_plus_u < 0.0_dp)
THEN
1433 IF (.NOT. occupation_enforced)
THEN
1434 CALL cp_warn(__location__, &
1435 "DFT+U energy contribution is negative possibly due "// &
1436 "to unphysical Mulliken charges!")
1443 CALL timestop(handle)
1483 SUBROUTINE mulliken_charges(qs_env, orthonormal_basis, matrix_h, matrix_w, &
1484 should_output, output_unit, print_level)
1487 LOGICAL,
INTENT(IN) :: orthonormal_basis
1489 POINTER :: matrix_h, matrix_w
1490 LOGICAL,
INTENT(IN) :: should_output
1491 INTEGER,
INTENT(IN) :: output_unit, print_level
1493 CHARACTER(LEN=*),
PARAMETER :: routinen =
'mulliken_charges'
1495 CHARACTER(LEN=10) :: spin_info
1496 CHARACTER(LEN=6),
ALLOCATABLE,
DIMENSION(:) :: symbol
1497 CHARACTER(LEN=default_string_length) :: atomic_kind_name
1498 INTEGER :: atom_a, handle, i, iatom, ic, ikind, isb, iset, isgf, ishell, ispin, jatom, jsgf, &
1499 lu, m, natom, natom_of_kind, nimg, nkind, nsb, nset, nsgf, nspin, sgf
1500 INTEGER,
ALLOCATABLE,
DIMENSION(:) :: first_sgf_atom
1501 INTEGER,
DIMENSION(:),
POINTER :: atom_list, nshell
1502 INTEGER,
DIMENSION(:, :),
POINTER :: first_sgf, l, last_sgf
1503 LOGICAL :: dft_plus_u_atom, found, just_energy
1504 REAL(kind=
dp) :: eps_u_ramping, fspin, q, u_minus_j, &
1505 u_minus_j_target, u_ramping, v
1506 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:) :: dedq, trps
1507 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:, :) :: q_ii
1508 REAL(kind=
dp),
DIMENSION(:, :),
POINTER :: h_block, p_block, s_block, w_block
1511 TYPE(
dbcsr_p_type),
DIMENSION(:, :),
POINTER :: matrix_p, matrix_s
1512 TYPE(
dbcsr_type),
POINTER :: sm_h, sm_p, sm_s, sm_w
1518 TYPE(
qs_kind_type),
DIMENSION(:),
POINTER :: qs_kind_set
1521 CALL timeset(routinen, handle)
1524 NULLIFY (atomic_kind_set)
1525 NULLIFY (qs_kind_set)
1526 NULLIFY (dft_control)
1535 NULLIFY (orb_basis_set)
1537 NULLIFY (particle_set)
1547 atomic_kind_set=atomic_kind_set, &
1548 qs_kind_set=qs_kind_set, &
1549 dft_control=dft_control, &
1551 particle_set=particle_set, &
1555 cpassert(
ASSOCIATED(atomic_kind_set))
1556 cpassert(
ASSOCIATED(dft_control))
1557 cpassert(
ASSOCIATED(energy))
1558 cpassert(
ASSOCIATED(particle_set))
1559 cpassert(
ASSOCIATED(rho))
1561 IF (orthonormal_basis)
THEN
1566 matrix_s_kp=matrix_s)
1567 cpassert(
ASSOCIATED(matrix_s))
1574 energy%dft_plus_u = 0.0_dp
1576 nspin = dft_control%nspins
1577 nimg = dft_control%nimages
1579 IF (nspin == 2)
THEN
1591 nkind =
SIZE(atomic_kind_set)
1593 ALLOCATE (first_sgf_atom(natom))
1594 first_sgf_atom(:) = 0
1597 first_sgf=first_sgf_atom)
1599 ALLOCATE (trps(nsgf))
1602 IF (
PRESENT(matrix_h) .OR.
PRESENT(matrix_w))
THEN
1603 ALLOCATE (dedq(nsgf))
1604 just_energy = .false.
1606 just_energy = .true.
1613 IF (.NOT. just_energy) dedq(:) = 0.0_dp
1620 IF (orthonormal_basis)
THEN
1623 sm_s => matrix_s(1, ic)%matrix
1625 sm_p => matrix_p(ispin, ic)%matrix
1633 IF (orthonormal_basis)
THEN
1635 IF (iatom /= jatom) cycle
1637 IF (
ASSOCIATED(p_block))
THEN
1638 sgf = first_sgf_atom(iatom)
1639 DO isgf = 1,
SIZE(p_block, 1)
1640 trps(sgf) = trps(sgf) + p_block(isgf, isgf)
1652 cpassert(
ASSOCIATED(s_block))
1654 sgf = first_sgf_atom(jatom)
1655 DO jsgf = 1,
SIZE(p_block, 2)
1656 DO isgf = 1,
SIZE(p_block, 1)
1657 trps(sgf) = trps(sgf) + p_block(isgf, jsgf)*s_block(isgf, jsgf)
1662 IF (iatom /= jatom)
THEN
1663 sgf = first_sgf_atom(iatom)
1664 DO isgf = 1,
SIZE(p_block, 1)
1665 DO jsgf = 1,
SIZE(p_block, 2)
1666 trps(sgf) = trps(sgf) + p_block(isgf, jsgf)*s_block(isgf, jsgf)
1680 CALL para_env%sum(trps)
1697 atom_list=atom_list, &
1698 name=atomic_kind_name, &
1699 natom=natom_of_kind)
1702 dft_plus_u_atom=dft_plus_u_atom, &
1703 l_of_dft_plus_u=lu, &
1704 basis_set=orb_basis_set, &
1705 u_minus_j=u_minus_j, &
1706 u_minus_j_target=u_minus_j_target, &
1707 u_ramping=u_ramping, &
1708 eps_u_ramping=eps_u_ramping)
1712 IF (.NOT.
ASSOCIATED(orb_basis_set)) cycle
1713 IF (.NOT. dft_plus_u_atom) cycle
1718 IF ((ispin == 1) .AND. (u_ramping > 0.0_dp))
THEN
1719 IF (qs_env%scf_env%iter_delta <= eps_u_ramping)
THEN
1720 u_minus_j = min(u_minus_j + u_ramping, u_minus_j_target)
1721 CALL set_qs_kind(qs_kind_set(ikind), u_minus_j=u_minus_j)
1723 IF (should_output .AND. (output_unit > 0))
THEN
1724 WRITE (unit=output_unit, fmt=
"(T3,A,3X,A,F0.3,A)") &
1725 "Kind name: "//trim(adjustl(atomic_kind_name)), &
1726 "U(eff) = ", u_minus_j*
evolt,
" eV"
1730 IF (u_minus_j == 0.0_dp) cycle
1735 first_sgf=first_sgf, &
1737 last_sgf=last_sgf, &
1745 DO ishell = 1, nshell(iset)
1746 IF (l(ishell, iset) == lu) nsb = nsb + 1
1750 ALLOCATE (q_ii(nsb, 2*lu + 1))
1755 IF (output_unit > 0)
THEN
1756 ALLOCATE (symbol(2*lu + 1))
1761 WRITE (unit=spin_info, fmt=
"(A8,I2)")
" of spin", ispin
1765 WRITE (unit=output_unit, fmt=
"(/,T3,A,I0,A,/,/,T5,A,10(2X,A6))") &
1766 "DFT+U occupations"//trim(spin_info)//
" for the atoms of atomic kind ", ikind, &
1767 ": "//trim(atomic_kind_name), &
1768 "Atom Shell ", (adjustr(symbol(i)), i=1, 2*lu + 1),
" Trace"
1775 DO iatom = 1, natom_of_kind
1777 atom_a = atom_list(iatom)
1791 IF (
ASSOCIATED(p_block))
THEN
1793 sgf = first_sgf_atom(atom_a)
1797 DO ishell = 1, nshell(iset)
1798 IF (l(ishell, iset) == lu)
THEN
1801 DO isgf = first_sgf(ishell, iset), last_sgf(ishell, iset)
1805 energy%dft_plus_u = energy%dft_plus_u + &
1806 0.5_dp*u_minus_j*(q - q**2)/fspin
1807 IF (.NOT. just_energy)
THEN
1808 dedq(sgf) = dedq(sgf) + u_minus_j*(0.5_dp - q)
1813 sgf = sgf + last_sgf(ishell, iset) - first_sgf(ishell, iset) + 1
1823 CALL para_env%sum(q_ii)
1824 IF (output_unit > 0)
THEN
1826 WRITE (unit=output_unit, fmt=
"(T3,I6,2X,I6,2X,10F8.3)") &
1827 atom_a, isb, q_ii(isb, :), sum(q_ii(isb, :))
1829 WRITE (unit=output_unit, fmt=
"(T12,A,2X,10F8.3)") &
1830 "Total", (sum(q_ii(:, i)), i=1, 2*lu + 1), sum(q_ii)
1831 WRITE (unit=output_unit, fmt=
"(A)")
""
1837 IF (
ALLOCATED(q_ii))
THEN
1843 IF (.NOT. just_energy)
THEN
1844 CALL para_env%sum(dedq)
1849 IF (
PRESENT(matrix_h))
THEN
1852 IF (orthonormal_basis)
THEN
1855 sm_s => matrix_s(1, ic)%matrix
1857 sm_h => matrix_h(ispin, ic)%matrix
1865 IF (orthonormal_basis)
THEN
1867 IF (iatom /= jatom) cycle
1869 IF (
ASSOCIATED(h_block))
THEN
1870 sgf = first_sgf_atom(iatom)
1871 DO isgf = 1,
SIZE(h_block, 1)
1872 h_block(isgf, isgf) = h_block(isgf, isgf) + dedq(sgf)
1886 cpassert(
ASSOCIATED(s_block))
1890 sgf = first_sgf_atom(iatom)
1892 DO isgf = 1,
SIZE(h_block, 1)
1893 IF (dedq(sgf) /= 0.0_dp)
THEN
1894 v = 0.5_dp*dedq(sgf)
1895 DO jsgf = 1,
SIZE(h_block, 2)
1896 h_block(isgf, jsgf) = h_block(isgf, jsgf) + v*s_block(isgf, jsgf)
1902 sgf = first_sgf_atom(jatom)
1904 DO jsgf = 1,
SIZE(h_block, 2)
1905 IF (dedq(sgf) /= 0.0_dp)
THEN
1906 v = 0.5_dp*dedq(sgf)
1907 DO isgf = 1,
SIZE(h_block, 1)
1908 h_block(isgf, jsgf) = h_block(isgf, jsgf) + v*s_block(isgf, jsgf)
1928 IF (
PRESENT(matrix_w) .AND. (.NOT. orthonormal_basis))
THEN
1931 sm_s => matrix_s(1, ic)%matrix
1932 sm_p => matrix_p(ispin, ic)%matrix
1933 sm_w => matrix_w(ispin, ic)%matrix
1943 IF (iatom == jatom) cycle
1952 cpassert(
ASSOCIATED(w_block))
1956 sgf = first_sgf_atom(iatom)
1958 DO isgf = 1,
SIZE(w_block, 1)
1959 IF (dedq(sgf) /= 0.0_dp)
THEN
1960 v = -0.5_dp*dedq(sgf)
1961 DO jsgf = 1,
SIZE(w_block, 2)
1962 w_block(isgf, jsgf) = w_block(isgf, jsgf) + v*p_block(isgf, jsgf)
1968 sgf = first_sgf_atom(jatom)
1970 DO jsgf = 1,
SIZE(w_block, 2)
1971 IF (dedq(sgf) /= 0.0_dp)
THEN
1972 v = -0.5_dp*dedq(sgf)
1973 DO isgf = 1,
SIZE(w_block, 1)
1974 w_block(isgf, jsgf) = w_block(isgf, jsgf) + v*p_block(isgf, jsgf)
1992 CALL para_env%sum(energy%dft_plus_u)
1994 IF (energy%dft_plus_u < 0.0_dp) &
1995 CALL cp_warn(__location__, &
1996 "DFT+U energy contribution is negative possibly due "// &
1997 "to unphysical Mulliken charges!")
2001 IF (
ALLOCATED(first_sgf_atom))
THEN
2002 DEALLOCATE (first_sgf_atom)
2005 IF (
ALLOCATED(trps))
THEN
2009 IF (
ALLOCATED(dedq))
THEN
2013 CALL timestop(handle)
2015 END SUBROUTINE mulliken_charges
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)
...
collects all references to literature in CP2K as new algorithms / method are included from literature...
integer, save, public dudarev1997
integer, save, public dudarev1998
Defines control structures, which contain the parameters and the settings for the DFT-based calculati...
subroutine, public dbcsr_deallocate_matrix(matrix)
...
subroutine, public dbcsr_iterator_next_block(iterator, row, column, block, block_number_argument_has_been_removed, row_size, col_size, row_offset, col_offset)
...
logical function, public dbcsr_iterator_blocks_left(iterator)
...
subroutine, public dbcsr_iterator_stop(iterator)
...
subroutine, public dbcsr_get_block_p(matrix, row, col, block, found, row_size, col_size)
...
subroutine, public dbcsr_iterator_start(iterator, matrix, shared, dynamic, dynamic_byrows)
...
subroutine, public dbcsr_set(matrix, alpha)
...
subroutine, public dbcsr_release(matrix)
...
subroutine, public dbcsr_get_block_diag(matrix, diag)
Copies the diagonal blocks of matrix into diag.
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_plus_fm_fm_t(sparse_matrix, matrix_v, matrix_g, ncol, alpha, keep_sparsity, symmetry_mode)
performs the multiplication sparse_matrix+dense_mat*dens_mat^T if matrix_g is not explicitly given,...
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.
subroutine, public cp_dbcsr_write_sparse_matrix(sparse_matrix, before, after, qs_env, para_env, first_row, last_row, first_col, last_col, scale, output_unit, omit_headers)
...
Basic linear algebra operations for full matrices.
subroutine, public cp_fm_transpose(matrix, matrixt)
transposes a matrix matrixt = matrix ^ T
subroutine, public cp_fm_schur_product(matrix_a, matrix_b, matrix_c)
computes the schur product of two matrices c_ij = a_ij * b_ij
subroutine, public cp_fm_scale_and_add(alpha, matrix_a, beta, matrix_b)
calc A <- alpha*A + beta*B optimized for alpha == 1.0 (just add beta*B) and beta == 0....
used for collecting some of the diagonalization schemes available for cp_fm_type. cp_fm_power also mo...
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...
represent the structure of a full matrix
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_create(matrix, matrix_struct, name, use_sp, nrow, ncol, set_zero)
creates a new full matrix with the given structure
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...
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)
...
integer, parameter, public low_print_level
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...
Add the DFT+U contribution to the Hamiltonian matrix.
subroutine, public plus_u(qs_env, matrix_h, matrix_w)
Add the DFT+U contribution to the Hamiltonian matrix. Wrapper routine for all "+U" methods.
Defines the basic variable types.
integer, parameter, public dp
integer, parameter, public default_string_length
Routines needed for kpoint calculation.
subroutine, public lowdin_kp_trans(kpoint, pmat_diag)
Calculate Lowdin transformation of density matrix S^1/2 P S^1/2 Integrate diagonal elements over k-po...
Types and basic routines needed for a kpoint calculation.
Collection of simple mathematical functions and subroutines.
subroutine, public jacobi(a, d, v)
Jacobi matrix diagonalization. The eigenvalues are returned in vector d and the eigenvectors are retu...
Interface to the message passing library MPI.
compute mulliken charges we (currently) define them as c_i = 1/2 [ (PS)_{ii} + (SP)_{ii} ]
character(len=6) function, public sgf_symbol(n, l, m)
Build a spherical orbital symbol (orbital labels for printing).
basic linear algebra operations for full matrixes
Define methods related to particle_type.
subroutine, public get_particle_set(particle_set, qs_kind_set, first_sgf, last_sgf, nsgf, nmao, basis)
Get the components of a particle set.
Define the data structure for the particle information.
Definition of physical constants:
real(kind=dp), parameter, public evolt
subroutine, public get_qs_env(qs_env, atomic_kind_set, qs_kind_set, cell, super_cell, cell_ref, use_ref_cell, kpoints, dft_control, mos, sab_orb, sab_all, qmmm, qmmm_periodic, mimic, sac_ae, sac_ppl, sac_lri, sap_ppnl, sab_vdw, sab_scp, sap_oce, sab_lrc, sab_se, sab_xtbe, sab_tbe, sab_core, sab_xb, sab_xtb_pp, sab_xtb_nonbond, sab_almo, sab_kp, sab_kp_nosym, sab_cneo, particle_set, energy, force, matrix_h, matrix_h_im, matrix_ks, matrix_ks_im, matrix_vxc, run_rtp, rtp, matrix_h_kp, matrix_h_im_kp, matrix_ks_kp, matrix_ks_im_kp, matrix_vxc_kp, kinetic_kp, matrix_s_kp, matrix_w_kp, matrix_s_ri_aux_kp, matrix_s, matrix_s_ri_aux, matrix_w, matrix_p_mp2, matrix_p_mp2_admm, rho, rho_xc, pw_env, ewald_env, ewald_pw, active_space, mpools, input, para_env, blacs_env, scf_control, rel_control, kinetic, qs_charges, vppl, xcint_weights, rho_core, rho_nlcc, rho_nlcc_g, ks_env, ks_qmmm_env, wf_history, scf_env, local_particles, local_molecules, distribution_2d, dbcsr_dist, molecule_kind_set, molecule_set, subsys, cp_subsys, oce, local_rho_set, rho_atom_set, task_list, task_list_soft, rho0_atom_set, rho0_mpole, rhoz_set, rhoz_cneo_set, ecoul_1c, rho0_s_rs, rho0_s_gs, rhoz_cneo_s_rs, rhoz_cneo_s_gs, do_kpoints, has_unit_metric, requires_mo_derivs, mo_derivs, mo_loc_history, nkind, natom, nelectron_total, nelectron_spin, efield, neighbor_list_id, linres_control, xas_env, virial, cp_ddapc_env, cp_ddapc_ewald, outer_scf_history, outer_scf_ihistory, x_data, et_coupling, dftb_potential, results, se_taper, se_store_int_env, se_nddo_mpole, se_nonbond_env, admm_env, lri_env, lri_density, exstate_env, ec_env, harris_env, dispersion_env, gcp_env, vee, rho_external, external_vxc, mask, mp2_env, bs_env, kg_env, wanniercentres, atprop, ls_scf_env, do_transport, transport_env, v_hartree_rspace, s_mstruct_changed, rho_changed, potential_changed, forces_up_to_date, mscfg_env, almo_scf_env, gradient_history, variable_history, embed_pot, spin_embed_pot, polar_env, mos_last_converged, eeq, rhs, do_rixs, tb_tblite)
Get the QUICKSTEP environment.
Define the quickstep kind type and their sub types.
subroutine, public get_qs_kind(qs_kind, basis_set, basis_type, ncgf, nsgf, all_potential, tnadd_potential, gth_potential, sgp_potential, upf_potential, cneo_potential, se_parameter, dftb_parameter, xtb_parameter, dftb3_param, zatom, zeff, elec_conf, mao, lmax_dftb, alpha_core_charge, ccore_charge, core_charge, core_charge_radius, paw_proj_set, paw_atom, hard_radius, hard0_radius, max_rad_local, covalent_radius, vdw_radius, gpw_type_forced, harmonics, max_iso_not0, max_s_harm, grid_atom, ngrid_ang, ngrid_rad, lmax_rho0, dft_plus_u_atom, l_of_dft_plus_u, n_of_dft_plus_u, u_minus_j, u_of_dft_plus_u, j_of_dft_plus_u, alpha_of_dft_plus_u, beta_of_dft_plus_u, j0_of_dft_plus_u, occupation_of_dft_plus_u, dispersion, bs_occupation, magnetization, no_optimize, addel, laddel, naddel, orbitals, max_scf, eps_scf, smear, u_ramping, u_minus_j_target, eps_u_ramping, init_u_ramping_each_scf, reltmat, ghost, monovalent, floating, name, element_symbol, pao_basis_size, pao_model_file, pao_potentials, pao_descriptors, nelec)
Get attributes of an atomic kind.
subroutine, public get_qs_kind_set(qs_kind_set, all_potential_present, tnadd_potential_present, gth_potential_present, sgp_potential_present, paw_atom_present, dft_plus_u_atom_present, maxcgf, maxsgf, maxco, maxco_proj, maxgtops, maxlgto, maxlprj, maxnset, maxsgf_set, ncgf, npgf, nset, nsgf, nshell, maxpol, maxlppl, maxlppnl, maxppnl, nelectron, maxder, max_ngrid_rad, max_sph_harm, maxg_iso_not0, lmax_rho0, basis_rcut, basis_type, total_zeff_corr, npgf_seg, cneo_potential_present, nkind_q, natom_q)
Get attributes of an atomic kind set.
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, reltmat, dftb_parameter, xtb_parameter, elec_conf, pao_basis_size)
Set the components of an atomic kind data set.
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...
module that contains the definitions of the scf types
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...
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.