27 dbcsr_type_no_symmetry
59#include "./base/base_uses.f90"
63 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'qs_mo_methods'
71 MODULE PROCEDURE subspace_eigenvalues_ks_fm
72 MODULE PROCEDURE subspace_eigenvalues_ks_dbcsr
76 MODULE PROCEDURE make_basis_sv_fm
77 MODULE PROCEDURE make_basis_sv_dbcsr
92 INTEGER,
INTENT(IN) :: ncol
95 CHARACTER(LEN=*),
PARAMETER :: routinen =
'make_basis_sm'
96 REAL(kind=
dp),
PARAMETER :: rone = 1.0_dp, rzero = 0.0_dp
98 INTEGER :: handle, n, ncol_global
102 IF (ncol == 0)
RETURN
104 CALL timeset(routinen, handle)
106 CALL cp_fm_get_info(matrix=vmatrix, nrow_global=n, ncol_global=ncol_global)
107 IF (ncol > ncol_global) cpabort(
"Wrong ncol value")
109 CALL cp_fm_create(svmatrix, vmatrix%matrix_struct,
"SV", set_zero=.true.)
112 NULLIFY (fm_struct_tmp)
114 para_env=vmatrix%matrix_struct%para_env, &
115 context=vmatrix%matrix_struct%context)
116 CALL cp_fm_create(overlap_vv, fm_struct_tmp,
"overlap_vv")
119 CALL parallel_gemm(
'T',
'N', ncol, ncol, n, rone, vmatrix, svmatrix, rzero, overlap_vv)
126 CALL timestop(handle)
138 SUBROUTINE make_basis_sv_fm(vmatrix, ncol, svmatrix)
141 INTEGER,
INTENT(IN) :: ncol
144 CHARACTER(LEN=*),
PARAMETER :: routineN =
'make_basis_sv_fm'
145 REAL(KIND=
dp),
PARAMETER :: rone = 1.0_dp, rzero = 0.0_dp
147 INTEGER :: handle, n, ncol_global
151 IF (ncol == 0)
RETURN
153 CALL timeset(routinen, handle)
154 NULLIFY (fm_struct_tmp)
156 CALL cp_fm_get_info(matrix=vmatrix, nrow_global=n, ncol_global=ncol_global)
157 IF (ncol > ncol_global) cpabort(
"Wrong ncol value")
160 para_env=vmatrix%matrix_struct%para_env, &
161 context=vmatrix%matrix_struct%context)
162 CALL cp_fm_create(overlap_vv, fm_struct_tmp,
"overlap_vv")
165 CALL parallel_gemm(
'T',
'N', ncol, ncol, n, rone, vmatrix, svmatrix, rzero, overlap_vv)
172 CALL timestop(handle)
174 END SUBROUTINE make_basis_sv_fm
184 SUBROUTINE make_basis_sv_dbcsr(vmatrix, ncol, svmatrix, para_env, blacs_env)
187 INTEGER,
INTENT(IN) :: ncol
192 CHARACTER(LEN=*),
PARAMETER :: routineN =
'make_basis_sv_dbcsr'
193 REAL(KIND=
dp),
PARAMETER :: rone = 1.0_dp, rzero = 0.0_dp
195 INTEGER :: handle, n, ncol_global
197 TYPE(
cp_fm_type) :: fm_svmatrix, fm_vmatrix, overlap_vv
199 IF (ncol == 0)
RETURN
201 CALL timeset(routinen, handle)
204 CALL dbcsr_get_info(vmatrix, nfullrows_total=n, nfullcols_total=ncol_global)
205 IF (ncol > ncol_global) cpabort(
"Wrong ncol value")
208 ncol_global=ncol, para_env=para_env)
209 CALL cp_fm_create(overlap_vv, fm_struct_tmp, name=
"fm_overlap_vv")
213 ncol_global=ncol_global, para_env=para_env)
214 CALL cp_fm_create(fm_vmatrix, fm_struct_tmp, name=
"fm_vmatrix")
215 CALL cp_fm_create(fm_svmatrix, fm_struct_tmp, name=
"fm_svmatrix")
221 CALL parallel_gemm(
'T',
'N', ncol, ncol, n, rone, fm_vmatrix, fm_svmatrix, rzero, overlap_vv)
233 CALL timestop(handle)
235 END SUBROUTINE make_basis_sv_dbcsr
253 INTEGER,
INTENT(IN) :: ncol
256 CHARACTER(LEN=*),
PARAMETER :: routinen =
'make_basis_cholesky'
257 REAL(kind=
dp),
PARAMETER :: rone = 1.0_dp, rzero = 0.0_dp
259 INTEGER :: handle, n, ncol_global
263 IF (ncol == 0)
RETURN
265 CALL timeset(routinen, handle)
266 NULLIFY (fm_struct_tmp)
268 CALL cp_fm_get_info(matrix=vmatrix, nrow_global=n, ncol_global=ncol_global)
269 IF (ncol > ncol_global) cpabort(
"Wrong ncol value")
272 para_env=vmatrix%matrix_struct%para_env, &
273 context=vmatrix%matrix_struct%context)
274 CALL cp_fm_create(overlap_vv, fm_struct_tmp,
"overlap_vv")
278 CALL cp_fm_syrk(
'U',
'T', n, rone, vmatrix, 1, 1, rzero, overlap_vv)
285 CALL timestop(handle)
304 INTEGER,
INTENT(IN) :: ncol
307 CHARACTER(LEN=*),
PARAMETER :: routinen =
'make_basis_lowdin'
308 REAL(kind=
dp),
PARAMETER :: rone = 1.0_dp, rzero = 0.0_dp
310 INTEGER :: handle, n, ncol_global, ndep
311 REAL(
dp) :: threshold
315 IF (ncol == 0)
RETURN
317 CALL timeset(routinen, handle)
318 NULLIFY (fm_struct_tmp)
319 threshold = 1.0e-7_dp
320 CALL cp_fm_get_info(matrix=vmatrix, nrow_global=n, ncol_global=ncol_global)
321 IF (ncol > ncol_global) cpabort(
"Wrong ncol value")
326 NULLIFY (fm_struct_tmp)
328 para_env=vmatrix%matrix_struct%para_env, &
329 context=vmatrix%matrix_struct%context)
336 CALL parallel_gemm(
'T',
'N', ncol, ncol, n, rone, vmatrix, sc, rzero, csc)
337 CALL cp_fm_power(csc, work, -0.5_dp, threshold, ndep)
338 CALL parallel_gemm(
'N',
'N', n, ncol, ncol, rone, vmatrix, csc, rzero, sc)
345 CALL timestop(handle)
360 INTEGER,
INTENT(IN) :: ncol
362 CHARACTER(LEN=*),
PARAMETER :: routinen =
'make_basis_simple'
363 REAL(kind=
dp),
PARAMETER :: rone = 1.0_dp, rzero = 0.0_dp
365 INTEGER :: handle, n, ncol_global
369 IF (ncol == 0)
RETURN
371 CALL timeset(routinen, handle)
373 NULLIFY (fm_struct_tmp)
375 CALL cp_fm_get_info(matrix=vmatrix, nrow_global=n, ncol_global=ncol_global)
376 IF (ncol > ncol_global) cpabort(
"Wrong ncol value")
379 para_env=vmatrix%matrix_struct%para_env, &
380 context=vmatrix%matrix_struct%context)
381 CALL cp_fm_create(overlap_vv, fm_struct_tmp,
"overlap_vv")
384 CALL parallel_gemm(
'T',
'N', ncol, ncol, n, rone, vmatrix, vmatrix, rzero, overlap_vv)
390 CALL timestop(handle)
411 SUBROUTINE subspace_eigenvalues_ks_fm(orbitals, ks_matrix, evals_arg, ionode, scr, &
412 do_rotation, co_rotate, co_rotate_dbcsr)
416 REAL(KIND=
dp),
DIMENSION(:),
OPTIONAL :: evals_arg
417 LOGICAL,
INTENT(IN),
OPTIONAL :: ionode
418 INTEGER,
INTENT(IN),
OPTIONAL :: scr
419 LOGICAL,
INTENT(IN),
OPTIONAL :: do_rotation
420 TYPE(
cp_fm_type),
INTENT(IN),
OPTIONAL :: co_rotate
421 TYPE(
dbcsr_type),
OPTIONAL,
POINTER :: co_rotate_dbcsr
423 CHARACTER(len=*),
PARAMETER :: routineN =
'subspace_eigenvalues_ks_fm'
425 INTEGER :: handle, i, j, n, ncol_global, nrow_global
426 LOGICAL :: compute_evecs, do_rotation_local
427 REAL(KIND=
dp),
ALLOCATABLE,
DIMENSION(:) :: evals
429 TYPE(
cp_fm_type) :: e_vectors, h_block, weighted_vectors, &
432 CALL timeset(routinen, handle)
434 do_rotation_local = .true.
435 IF (
PRESENT(do_rotation)) do_rotation_local = do_rotation
437 NULLIFY (fm_struct_tmp)
439 ncol_global=ncol_global, &
440 nrow_global=nrow_global)
442 IF (do_rotation_local)
THEN
443 compute_evecs = .true.
446 compute_evecs = .false.
448 compute_evecs = .true.
451 IF (ncol_global > 0)
THEN
453 ALLOCATE (evals(ncol_global))
455 CALL cp_fm_create(weighted_vectors, orbitals%matrix_struct,
"weighted_vectors")
456 CALL cp_fm_struct_create(fm_struct_tmp, nrow_global=ncol_global, ncol_global=ncol_global, &
457 para_env=orbitals%matrix_struct%para_env, &
458 context=orbitals%matrix_struct%context)
459 CALL cp_fm_create(h_block, fm_struct_tmp, name=
"h block")
460 IF (compute_evecs)
THEN
461 CALL cp_fm_create(e_vectors, fm_struct_tmp, name=
"e vectors")
468 CALL parallel_gemm(
'T',
'N', ncol_global, ncol_global, nrow_global, 1.0_dp, &
469 orbitals, weighted_vectors, 0.0_dp, h_block)
472 IF (compute_evecs)
THEN
479 IF (do_rotation_local)
THEN
480 CALL parallel_gemm(
'N',
'N', nrow_global, ncol_global, ncol_global, 1.0_dp, &
481 orbitals, e_vectors, 0.0_dp, weighted_vectors)
483 IF (
PRESENT(co_rotate))
THEN
484 CALL parallel_gemm(
'N',
'N', nrow_global, ncol_global, ncol_global, 1.0_dp, &
485 co_rotate, e_vectors, 0.0_dp, weighted_vectors)
488 IF (
PRESENT(co_rotate_dbcsr))
THEN
489 IF (
ASSOCIATED(co_rotate_dbcsr))
THEN
490 CALL cp_fm_create(weighted_vectors2, orbitals%matrix_struct,
"weighted_vectors")
492 CALL parallel_gemm(
'N',
'N', nrow_global, ncol_global, ncol_global, 1.0_dp, &
493 weighted_vectors2, e_vectors, 0.0_dp, weighted_vectors)
501 IF (
PRESENT(evals_arg))
THEN
502 n = min(
SIZE(evals_arg),
SIZE(evals))
503 evals_arg(1:n) = evals(1:n)
506 IF (
PRESENT(ionode) .OR.
PRESENT(scr))
THEN
507 IF (.NOT.
PRESENT(ionode)) cpabort(
"IONODE?")
508 IF (.NOT.
PRESENT(scr)) cpabort(
"SCR?")
510 DO i = 1, ncol_global, 4
511 j = min(3, ncol_global - i)
514 WRITE (scr,
'(1X,4F16.8)') evals(i:i + j)
516 WRITE (scr,
'(1X,3F16.8)') evals(i:i + j)
518 WRITE (scr,
'(1X,2F16.8)') evals(i:i + j)
520 WRITE (scr,
'(1X,1F16.8)') evals(i:i + j)
528 IF (compute_evecs)
THEN
536 CALL timestop(handle)
538 END SUBROUTINE subspace_eigenvalues_ks_fm
552 SUBROUTINE subspace_eigenvalues_ks_dbcsr(orbitals, ks_matrix, evals_arg, ionode, scr, &
553 do_rotation, co_rotate, para_env, blacs_env)
555 TYPE(
dbcsr_type),
POINTER :: orbitals, ks_matrix
556 REAL(KIND=
dp),
DIMENSION(:),
OPTIONAL :: evals_arg
557 LOGICAL,
INTENT(IN),
OPTIONAL :: ionode
558 INTEGER,
INTENT(IN),
OPTIONAL :: scr
559 LOGICAL,
INTENT(IN),
OPTIONAL :: do_rotation
560 TYPE(
dbcsr_type),
OPTIONAL,
POINTER :: co_rotate
564 CHARACTER(len=*),
PARAMETER :: routineN =
'subspace_eigenvalues_ks_dbcsr'
566 INTEGER :: handle, i, j, ncol_global, nrow_global
567 LOGICAL :: compute_evecs, do_rotation_local
568 REAL(KIND=
dp),
ALLOCATABLE,
DIMENSION(:) :: evals
569 TYPE(
dbcsr_type),
POINTER :: e_vectors, h_block, weighted_vectors
571 CALL timeset(routinen, handle)
573 do_rotation_local = .true.
574 IF (
PRESENT(do_rotation)) do_rotation_local = do_rotation
576 NULLIFY (e_vectors, h_block, weighted_vectors)
579 nfullcols_total=ncol_global, &
580 nfullrows_total=nrow_global)
582 IF (do_rotation_local)
THEN
583 compute_evecs = .true.
586 compute_evecs = .false.
588 compute_evecs = .true.
591 IF (ncol_global > 0)
THEN
593 ALLOCATE (evals(ncol_global))
596 CALL dbcsr_copy(weighted_vectors, orbitals, name=
"weighted_vectors")
600 sym=dbcsr_type_no_symmetry)
603 IF (compute_evecs)
THEN
606 sym=dbcsr_type_no_symmetry)
611 0.0_dp, weighted_vectors)
614 CALL dbcsr_multiply(
'T',
'N', 1.0_dp, orbitals, weighted_vectors, 0.0_dp, h_block)
619 IF (compute_evecs)
THEN
620 CALL cp_dbcsr_syevd(h_block, e_vectors, evals, para_env=para_env, blacs_env=blacs_env)
622 CALL cp_dbcsr_syevx(h_block, eigenvalues=evals, para_env=para_env, blacs_env=blacs_env)
626 IF (do_rotation_local)
THEN
627 CALL dbcsr_multiply(
'N',
'N', 1.0_dp, orbitals, e_vectors, 0.0_dp, weighted_vectors)
632 IF (
PRESENT(co_rotate))
THEN
633 IF (
ASSOCIATED(co_rotate))
THEN
634 CALL dbcsr_multiply(
'N',
'N', 1.0_dp, co_rotate, e_vectors, 0.0_dp, weighted_vectors)
644 IF (
PRESENT(evals_arg))
THEN
645 evals_arg(:) = evals(:)
648 IF (
PRESENT(ionode) .OR.
PRESENT(scr))
THEN
649 IF (.NOT.
PRESENT(ionode)) cpabort(
"IONODE?")
650 IF (.NOT.
PRESENT(scr)) cpabort(
"SCR?")
652 DO i = 1, ncol_global, 4
653 j = min(3, ncol_global - i)
656 WRITE (scr,
'(1X,4F16.8)') evals(i:i + j)
658 WRITE (scr,
'(1X,3F16.8)') evals(i:i + j)
660 WRITE (scr,
'(1X,2F16.8)') evals(i:i + j)
662 WRITE (scr,
'(1X,1F16.8)') evals(i:i + j)
670 IF (compute_evecs)
THEN
678 CALL timestop(handle)
680 END SUBROUTINE subspace_eigenvalues_ks_dbcsr
691 REAL(kind=
dp) :: orthonormality
692 TYPE(
mo_set_type),
DIMENSION(:),
INTENT(IN) :: mo_array
693 TYPE(
dbcsr_type),
OPTIONAL,
POINTER :: matrix_s
695 CHARACTER(len=*),
PARAMETER :: routinen =
'calculate_orthonormality'
697 INTEGER :: handle, i, ispin, j, k, n, ncol_local, &
699 INTEGER,
DIMENSION(:),
POINTER :: col_indices, row_indices
700 REAL(kind=
dp) :: alpha, max_alpha
704 NULLIFY (tmp_fm_struct)
706 CALL timeset(routinen, handle)
708 nspin =
SIZE(mo_array)
712 IF (
PRESENT(matrix_s))
THEN
714 CALL cp_fm_create(svec, mo_array(ispin)%mo_coeff%matrix_struct)
716 nrow_global=n, ncol_global=k)
721 para_env=mo_array(ispin)%mo_coeff%matrix_struct%para_env, &
722 context=mo_array(ispin)%mo_coeff%matrix_struct%context)
725 CALL parallel_gemm(
'T',
'N', k, k, n, 1.0_dp, mo_array(ispin)%mo_coeff, &
726 svec, 0.0_dp, overlap)
731 nrow_global=n, ncol_global=k)
733 para_env=mo_array(ispin)%mo_coeff%matrix_struct%para_env, &
734 context=mo_array(ispin)%mo_coeff%matrix_struct%context)
737 CALL parallel_gemm(
'T',
'N', k, k, n, 1.0_dp, mo_array(ispin)%mo_coeff, &
738 mo_array(ispin)%mo_coeff, 0.0_dp, overlap)
740 CALL cp_fm_get_info(overlap, nrow_local=nrow_local, ncol_local=ncol_local, &
741 row_indices=row_indices, col_indices=col_indices)
744 alpha = overlap%local_data(i, j)
745 IF (row_indices(i) == col_indices(j)) alpha = alpha - 1.0_dp
746 max_alpha = max(max_alpha, abs(alpha))
751 CALL mo_array(1)%mo_coeff%matrix_struct%para_env%max(max_alpha)
752 orthonormality = max_alpha
755 CALL timestop(handle)
770 TYPE(
mo_set_type),
DIMENSION(:),
INTENT(IN) :: mo_array
771 REAL(kind=
dp) :: mo_mag_min, mo_mag_max
773 CHARACTER(len=*),
PARAMETER :: routinen =
'calculate_magnitude'
775 INTEGER :: handle, ispin, k, n, nspin
776 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:) :: evals
780 NULLIFY (tmp_fm_struct)
782 CALL timeset(routinen, handle)
784 nspin =
SIZE(mo_array)
785 mo_mag_min = huge(0.0_dp)
786 mo_mag_max = -huge(0.0_dp)
789 nrow_global=n, ncol_global=k)
792 para_env=mo_array(ispin)%mo_coeff%matrix_struct%para_env, &
793 context=mo_array(ispin)%mo_coeff%matrix_struct%context)
797 CALL parallel_gemm(
'T',
'N', k, k, n, 1.0_dp, mo_array(ispin)%mo_coeff, &
798 mo_array(ispin)%mo_coeff, 0.0_dp, overlap)
800 mo_mag_min = min(minval(evals), mo_mag_min)
801 mo_mag_max = max(maxval(evals), mo_mag_max)
806 CALL timestop(handle)
824 SUBROUTINE make_mo_eig(mos, nspins, ks_rmpv, scf_control, mo_derivs, admm_env, &
827 TYPE(
mo_set_type),
DIMENSION(:),
INTENT(INOUT) :: mos
828 INTEGER,
INTENT(IN) :: nspins
832 TYPE(
admm_type),
OPTIONAL,
POINTER :: admm_env
837 CHARACTER(len=*),
PARAMETER :: routinen =
'make_mo_eig'
839 INTEGER :: handle, homo, ispin, nmo, output_unit
840 REAL(kind=
dp),
DIMENSION(:),
POINTER :: mo_eigenvalues
844 CALL timeset(routinen, handle)
846 NULLIFY (mo_coeff_deriv, mo_coeff, mo_eigenvalues)
850 CALL get_mo_set(mo_set=mos(ispin), mo_coeff=mo_coeff, &
851 eigenvalues=mo_eigenvalues, homo=homo, nmo=nmo)
852 IF (output_unit > 0)
WRITE (output_unit, *)
" "
853 IF (output_unit > 0)
WRITE (output_unit, *)
" Eigenvalues of the occupied subspace spin ", ispin
857 IF (output_unit > 0)
WRITE (output_unit, *)
"---------------------------------------------"
859 IF (scf_control%use_ot)
THEN
861 IF (
ASSOCIATED(mo_derivs))
THEN
862 mo_coeff_deriv => mo_derivs(ispin)%matrix
864 mo_coeff_deriv => null()
868 IF (
PRESENT(admm_env))
THEN
873 scr=output_unit, ionode=output_unit > 0, do_rotation=.true., &
874 co_rotate_dbcsr=mo_coeff_deriv)
877 IF (
PRESENT(admm_env))
THEN
881 IF (output_unit > 0)
WRITE (output_unit,
'(4(1X,1F16.8))') mo_eigenvalues(1:homo)
883 IF (.NOT. scf_control%diagonalization%mom)
THEN
885 scf_control%smear%do_smear = .false.
887 smear=scf_control%smear, &
893 IF (output_unit > 0)
WRITE (output_unit,
'(T2,A,F12.6)') &
894 "Fermi Energy [eV] :", mos(ispin)%mu*
evolt
897 CALL timestop(handle)
914 REAL(kind=
dp),
DIMENSION(:),
INTENT(OUT) :: orbital_energies
915 REAL(kind=
dp),
INTENT(OUT) :: max_offdiag
917 CHARACTER(len=*),
PARAMETER :: routinen =
'calculate_orbital_fock_elements'
919 INTEGER :: handle, i, ncol_global, nrow_global
920 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:, :) :: fock
924 CALL timeset(routinen, handle)
926 orbital_energies = 0.0_dp
928 CALL cp_fm_get_info(matrix=orbitals, ncol_global=ncol_global, nrow_global=nrow_global)
929 IF (ncol_global > 0)
THEN
930 NULLIFY (fm_struct_tmp)
931 CALL cp_fm_create(weighted_vectors, orbitals%matrix_struct,
"weighted_vectors")
932 CALL cp_fm_struct_create(fm_struct_tmp, nrow_global=ncol_global, ncol_global=ncol_global, &
933 para_env=orbitals%matrix_struct%para_env, &
934 context=orbitals%matrix_struct%context)
935 CALL cp_fm_create(h_block, fm_struct_tmp, name=
"h block")
939 CALL parallel_gemm(
'T',
'N', ncol_global, ncol_global, nrow_global, 1.0_dp, &
940 orbitals, weighted_vectors, 0.0_dp, h_block)
942 ALLOCATE (fock(ncol_global, ncol_global))
944 DO i = 1, min(ncol_global,
SIZE(orbital_energies))
945 orbital_energies(i) = fock(i, i)
947 DO i = 1, ncol_global
950 max_offdiag = maxval(abs(fock))
957 CALL timestop(handle)
982 REAL(kind=
dp),
INTENT(IN) :: eps_canonical
983 LOGICAL,
INTENT(OUT) :: rotated
984 REAL(kind=
dp),
INTENT(OUT) :: max_offdiag
985 TYPE(
dbcsr_type),
OPTIONAL,
POINTER :: mo_derivs
987 CHARACTER(len=*),
PARAMETER :: routinen =
'make_mo_set_canonical'
988 REAL(kind=
dp),
PARAMETER :: eps_occ = 1.0e-10_dp
990 INTEGER :: first, handle, i, iblock, n, nmo, nocc, &
993 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:) :: energies
995 TYPE(
cp_fm_type) :: block_coeff, block_derivs, derivs
997 CALL timeset(routinen, handle)
1001 IF (mo_set%use_mo_coeff_b)
CALL copy_dbcsr_to_fm(mo_set%mo_coeff_b, mo_set%mo_coeff)
1002 ALLOCATE (energies(nmo))
1004 DEALLOCATE (energies)
1006 IF (max_offdiag > eps_canonical)
THEN
1008 IF (abs(mo_set%occupation_numbers(i)) > eps_occ .AND. &
1009 abs(mo_set%occupation_numbers(i) - mo_set%maxocc) > eps_occ)
THEN
1010 cpabort(
"Canonicalization of orbitals with fractional occupations is not possible")
1014 IF (
PRESENT(mo_derivs)) do_derivs =
ASSOCIATED(mo_derivs)
1016 nocc = count(mo_set%occupation_numbers(1:nmo) > eps_occ)
1017 CALL cp_fm_get_info(matrix=mo_set%mo_coeff, nrow_global=nrow_global)
1019 CALL cp_fm_create(derivs, mo_set%mo_coeff%matrix_struct, name=
"orbital derivatives")
1023 IF (iblock == 1)
THEN
1031 NULLIFY (fm_struct_tmp)
1033 template_fmstruct=mo_set%mo_coeff%matrix_struct)
1034 CALL cp_fm_create(block_coeff, fm_struct_tmp, name=
"canonicalized orbitals")
1035 CALL cp_fm_to_fm(mo_set%mo_coeff, block_coeff, n, first, 1)
1037 CALL cp_fm_create(block_derivs, fm_struct_tmp, name=
"rotated orbital derivatives")
1038 CALL cp_fm_to_fm(derivs, block_derivs, n, first, 1)
1040 evals_arg=mo_set%eigenvalues(first:first + n - 1), &
1041 do_rotation=.true., co_rotate=block_derivs)
1042 CALL cp_fm_to_fm(block_derivs, derivs, n, 1, first)
1046 evals_arg=mo_set%eigenvalues(first:first + n - 1), &
1050 CALL cp_fm_to_fm(block_coeff, mo_set%mo_coeff, n, 1, first)
1057 IF (mo_set%use_mo_coeff_b)
CALL copy_fm_to_dbcsr(mo_set%mo_coeff, mo_set%mo_coeff_b)
1061 CALL timestop(handle)
Types and set/get functions for auxiliary density matrix methods.
Contains methods used in the context of density fitting.
subroutine, public admm_uncorrect_for_eigenvalues(ispin, admm_env, ks_matrix)
...
subroutine, public admm_correct_for_eigenvalues(ispin, admm_env, ks_matrix)
...
methods related to the blacs parallel environment
Defines control structures, which contain the parameters and the settings for the DFT-based calculati...
subroutine, public dbcsr_release_p(matrix)
...
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_init_p(matrix)
...
Interface to (sca)lapack for the Cholesky based procedures.
subroutine, public cp_dbcsr_syevx(matrix, eigenvectors, eigenvalues, neig, work_syevx, para_env, blacs_env)
compute eigenvalues and optionally eigenvectors of a real symmetric matrix using scalapack....
subroutine, public cp_dbcsr_syevd(matrix, eigenvectors, eigenvalues, para_env, blacs_env)
...
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, check_plan)
Copy a DBCSR matrix to a BLACS matrix.
subroutine, public cp_dbcsr_m_by_n_from_template(matrix, template, m, n, sym)
Utility function to create an arbitrary shaped dbcsr matrix with the same processor grid as the templ...
subroutine, public copy_fm_to_dbcsr(fm, matrix, keep_sparsity)
Copy a BLACS matrix to a dbcsr matrix.
Basic linear algebra operations for full matrices.
subroutine, public cp_fm_syrk(uplo, trans, k, alpha, matrix_a, ia, ja, beta, matrix_c)
performs a rank-k update of a symmetric matrix_c matrix_c = beta * matrix_c + alpha * matrix_a * tran...
subroutine, public cp_fm_triangular_multiply(triangular_matrix, matrix_b, side, transpose_tr, invert_tr, uplo_tr, unit_diag_tr, n_rows, n_cols, alpha)
multiplies in place by a triangular matrix: matrix_b = alpha op(triangular_matrix) matrix_b or (if si...
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)
...
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...
subroutine, public cp_fm_syevx(matrix, eigenvectors, eigenvalues, neig, work_syevx)
compute eigenvalues and optionally eigenvectors of a real symmetric matrix using scalapack....
represent the structure of a full matrix
subroutine, public cp_fm_struct_create(fmstruct, para_env, context, nrow_global, ncol_global, nrow_block, ncol_block, descriptor, first_p_pos, local_leading_dimension, template_fmstruct, square_blocks, force_block)
allocates and initializes a full matrix structure
subroutine, public cp_fm_struct_release(fmstruct)
releases a full matrix structure
represent a full matrix distributed on many processors
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_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,...
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...
Defines the basic variable types.
integer, parameter, public dp
Interface to the message passing library MPI.
basic linear algebra operations for full matrixes
Definition of physical constants:
real(kind=dp), parameter, public evolt
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_cholesky(vmatrix, ncol, ortho)
return a set of S orthonormal vectors (C^T S C == 1) where the cholesky decomposed form of S is passe...
subroutine, public calculate_magnitude(mo_array, mo_mag_min, mo_mag_max)
...
subroutine, public make_mo_set_canonical(mo_set, ks_matrix, eps_canonical, rotated, max_offdiag, mo_derivs)
Rotates the orbitals of an MO set into canonical orbitals (eigenvectors of the Fock matrix in the spa...
subroutine, public calculate_orbital_fock_elements(orbitals, ks_matrix, orbital_energies, max_offdiag)
Orbital energies <phi_i|F|phi_i> of a set of orbitals and the largest off-diagonal Fock matrix elemen...
subroutine, public make_basis_sm(vmatrix, ncol, matrix_s)
returns an S-orthonormal basis v (v^T S v ==1)
subroutine, public make_mo_eig(mos, nspins, ks_rmpv, scf_control, mo_derivs, admm_env, hairy_probes, probe)
Calculate KS eigenvalues starting from OF MOS.
subroutine, public calculate_orthonormality(orthonormality, mo_array, matrix_s)
...
Set occupation of molecular orbitals.
Definition and initialisation of the mo data type.
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, cmo_coeff)
Get the components of a MO set data structure.
parameters that control an scf iteration
stores some data used in wavefunction fitting
represent a blacs multidimensional parallel environment (for the mpi corrispective see cp_paratypes/m...
keeps the information about the structure of a full matrix
stores all the informations relevant to an mpi environment