40 USE dbcsr_api,
ONLY: dbcsr_copy,&
47 dbcsr_type_no_symmetry
56 #include "./base/base_uses.f90"
60 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'qs_mo_methods'
66 INTERFACE calculate_subspace_eigenvalues
67 MODULE PROCEDURE subspace_eigenvalues_ks_fm
68 MODULE PROCEDURE subspace_eigenvalues_ks_dbcsr
71 INTERFACE make_basis_sv
72 MODULE PROCEDURE make_basis_sv_fm
73 MODULE PROCEDURE make_basis_sv_dbcsr
87 TYPE(cp_fm_type),
INTENT(IN) :: vmatrix
88 INTEGER,
INTENT(IN) :: ncol
89 TYPE(dbcsr_type),
POINTER :: matrix_s
91 CHARACTER(LEN=*),
PARAMETER :: routinen =
'make_basis_sm'
92 REAL(kind=
dp),
PARAMETER :: rone = 1.0_dp, rzero = 0.0_dp
94 INTEGER :: handle, n, ncol_global
95 TYPE(cp_fm_struct_type),
POINTER :: fm_struct_tmp
96 TYPE(cp_fm_type) :: overlap_vv, svmatrix
98 IF (ncol .EQ. 0)
RETURN
100 CALL timeset(routinen, handle)
102 CALL cp_fm_get_info(matrix=vmatrix, nrow_global=n, ncol_global=ncol_global)
103 IF (ncol .GT. ncol_global) cpabort(
"Wrong ncol value")
105 CALL cp_fm_create(svmatrix, vmatrix%matrix_struct,
"SV")
108 NULLIFY (fm_struct_tmp)
110 para_env=vmatrix%matrix_struct%para_env, &
111 context=vmatrix%matrix_struct%context)
112 CALL cp_fm_create(overlap_vv, fm_struct_tmp,
"overlap_vv")
115 CALL parallel_gemm(
'T',
'N', ncol, ncol, n, rone, vmatrix, svmatrix, rzero, overlap_vv)
119 CALL cp_fm_release(overlap_vv)
120 CALL cp_fm_release(svmatrix)
122 CALL timestop(handle)
134 SUBROUTINE make_basis_sv_fm(vmatrix, ncol, svmatrix)
136 TYPE(cp_fm_type),
INTENT(IN) :: vmatrix
137 INTEGER,
INTENT(IN) :: ncol
138 TYPE(cp_fm_type),
INTENT(IN) :: svmatrix
140 CHARACTER(LEN=*),
PARAMETER :: routinen =
'make_basis_sv_fm'
141 REAL(kind=
dp),
PARAMETER :: rone = 1.0_dp, rzero = 0.0_dp
143 INTEGER :: handle, n, ncol_global
144 TYPE(cp_fm_struct_type),
POINTER :: fm_struct_tmp
145 TYPE(cp_fm_type) :: overlap_vv
147 IF (ncol .EQ. 0)
RETURN
149 CALL timeset(routinen, handle)
150 NULLIFY (fm_struct_tmp)
152 CALL cp_fm_get_info(matrix=vmatrix, nrow_global=n, ncol_global=ncol_global)
153 IF (ncol .GT. ncol_global) cpabort(
"Wrong ncol value")
156 para_env=vmatrix%matrix_struct%para_env, &
157 context=vmatrix%matrix_struct%context)
158 CALL cp_fm_create(overlap_vv, fm_struct_tmp,
"overlap_vv")
161 CALL parallel_gemm(
'T',
'N', ncol, ncol, n, rone, vmatrix, svmatrix, rzero, overlap_vv)
166 CALL cp_fm_release(overlap_vv)
168 CALL timestop(handle)
170 END SUBROUTINE make_basis_sv_fm
180 SUBROUTINE make_basis_sv_dbcsr(vmatrix, ncol, svmatrix, para_env, blacs_env)
182 TYPE(dbcsr_type) :: vmatrix
183 INTEGER,
INTENT(IN) :: ncol
184 TYPE(dbcsr_type) :: svmatrix
185 TYPE(mp_para_env_type),
POINTER :: para_env
186 TYPE(cp_blacs_env_type),
POINTER :: blacs_env
188 CHARACTER(LEN=*),
PARAMETER :: routinen =
'make_basis_sv_dbcsr'
189 REAL(kind=
dp),
PARAMETER :: rone = 1.0_dp, rzero = 0.0_dp
191 INTEGER :: handle, n, ncol_global
192 TYPE(cp_fm_struct_type),
POINTER :: fm_struct_tmp
193 TYPE(cp_fm_type) :: fm_svmatrix, fm_vmatrix, overlap_vv
195 IF (ncol .EQ. 0)
RETURN
197 CALL timeset(routinen, handle)
200 CALL dbcsr_get_info(vmatrix, nfullrows_total=n, nfullcols_total=ncol_global)
201 IF (ncol .GT. ncol_global) cpabort(
"Wrong ncol value")
204 ncol_global=ncol, para_env=para_env)
205 CALL cp_fm_create(overlap_vv, fm_struct_tmp, name=
"fm_overlap_vv")
209 ncol_global=ncol_global, para_env=para_env)
210 CALL cp_fm_create(fm_vmatrix, fm_struct_tmp, name=
"fm_vmatrix")
211 CALL cp_fm_create(fm_svmatrix, fm_struct_tmp, name=
"fm_svmatrix")
217 CALL parallel_gemm(
'T',
'N', ncol, ncol, n, rone, fm_vmatrix, fm_svmatrix, rzero, overlap_vv)
225 CALL cp_fm_release(overlap_vv)
226 CALL cp_fm_release(fm_vmatrix)
227 CALL cp_fm_release(fm_svmatrix)
229 CALL timestop(handle)
231 END SUBROUTINE make_basis_sv_dbcsr
248 TYPE(cp_fm_type),
INTENT(IN) :: vmatrix
249 INTEGER,
INTENT(IN) :: ncol
250 TYPE(cp_fm_type),
INTENT(IN) :: ortho
252 CHARACTER(LEN=*),
PARAMETER :: routinen =
'make_basis_cholesky'
253 REAL(kind=
dp),
PARAMETER :: rone = 1.0_dp, rzero = 0.0_dp
255 INTEGER :: handle, n, ncol_global
256 TYPE(cp_fm_struct_type),
POINTER :: fm_struct_tmp
257 TYPE(cp_fm_type) :: overlap_vv
259 IF (ncol .EQ. 0)
RETURN
261 CALL timeset(routinen, handle)
262 NULLIFY (fm_struct_tmp)
264 CALL cp_fm_get_info(matrix=vmatrix, nrow_global=n, ncol_global=ncol_global)
265 IF (ncol .GT. ncol_global) cpabort(
"Wrong ncol value")
268 para_env=vmatrix%matrix_struct%para_env, &
269 context=vmatrix%matrix_struct%context)
270 CALL cp_fm_create(overlap_vv, fm_struct_tmp,
"overlap_vv")
274 CALL cp_fm_syrk(
'U',
'T', n, rone, vmatrix, 1, 1, rzero, overlap_vv)
279 CALL cp_fm_release(overlap_vv)
281 CALL timestop(handle)
299 TYPE(cp_fm_type),
INTENT(IN) :: vmatrix
300 INTEGER,
INTENT(IN) :: ncol
301 TYPE(dbcsr_type) :: matrix_s
303 CHARACTER(LEN=*),
PARAMETER :: routinen =
'make_basis_lowdin'
304 REAL(kind=
dp),
PARAMETER :: rone = 1.0_dp, rzero = 0.0_dp
306 INTEGER :: handle, n, ncol_global, ndep
307 REAL(
dp) :: threshold
308 TYPE(cp_fm_struct_type),
POINTER :: fm_struct_tmp
309 TYPE(cp_fm_type) :: csc, sc, work
311 IF (ncol .EQ. 0)
RETURN
313 CALL timeset(routinen, handle)
314 NULLIFY (fm_struct_tmp)
315 threshold = 1.0e-7_dp
316 CALL cp_fm_get_info(matrix=vmatrix, nrow_global=n, ncol_global=ncol_global)
317 IF (ncol .GT. ncol_global) cpabort(
"Wrong ncol value")
322 NULLIFY (fm_struct_tmp)
324 para_env=vmatrix%matrix_struct%para_env, &
325 context=vmatrix%matrix_struct%context)
330 CALL parallel_gemm(
'T',
'N', ncol, ncol, n, rone, vmatrix, sc, rzero, csc)
331 CALL cp_fm_power(csc, work, -0.5_dp, threshold, ndep)
332 CALL parallel_gemm(
'N',
'N', n, ncol, ncol, rone, vmatrix, csc, rzero, sc)
333 CALL cp_fm_to_fm(sc, vmatrix, ncol, 1, 1)
335 CALL cp_fm_release(csc)
336 CALL cp_fm_release(sc)
337 CALL cp_fm_release(work)
339 CALL timestop(handle)
353 TYPE(cp_fm_type),
INTENT(IN) :: vmatrix
354 INTEGER,
INTENT(IN) :: ncol
356 CHARACTER(LEN=*),
PARAMETER :: routinen =
'make_basis_simple'
357 REAL(kind=
dp),
PARAMETER :: rone = 1.0_dp, rzero = 0.0_dp
359 INTEGER :: handle, n, ncol_global
360 TYPE(cp_fm_struct_type),
POINTER :: fm_struct_tmp
361 TYPE(cp_fm_type) :: overlap_vv
363 IF (ncol .EQ. 0)
RETURN
365 CALL timeset(routinen, handle)
367 NULLIFY (fm_struct_tmp)
369 CALL cp_fm_get_info(matrix=vmatrix, nrow_global=n, ncol_global=ncol_global)
370 IF (ncol .GT. ncol_global) cpabort(
"Wrong ncol value")
373 para_env=vmatrix%matrix_struct%para_env, &
374 context=vmatrix%matrix_struct%context)
375 CALL cp_fm_create(overlap_vv, fm_struct_tmp,
"overlap_vv")
378 CALL parallel_gemm(
'T',
'N', ncol, ncol, n, rone, vmatrix, vmatrix, rzero, overlap_vv)
382 CALL cp_fm_release(overlap_vv)
384 CALL timestop(handle)
405 SUBROUTINE subspace_eigenvalues_ks_fm(orbitals, ks_matrix, evals_arg, ionode, scr, &
406 do_rotation, co_rotate, co_rotate_dbcsr)
408 TYPE(cp_fm_type),
INTENT(IN) :: orbitals
409 TYPE(dbcsr_type),
POINTER :: ks_matrix
410 REAL(kind=
dp),
DIMENSION(:),
OPTIONAL :: evals_arg
411 LOGICAL,
INTENT(IN),
OPTIONAL :: ionode
412 INTEGER,
INTENT(IN),
OPTIONAL :: scr
413 LOGICAL,
INTENT(IN),
OPTIONAL :: do_rotation
414 TYPE(cp_fm_type),
INTENT(IN),
OPTIONAL :: co_rotate
415 TYPE(dbcsr_type),
OPTIONAL,
POINTER :: co_rotate_dbcsr
417 CHARACTER(len=*),
PARAMETER :: routinen =
'subspace_eigenvalues_ks_fm'
419 INTEGER :: handle, i, j, n, ncol_global, nrow_global
420 LOGICAL :: compute_evecs, do_rotation_local
421 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:) :: evals
422 TYPE(cp_fm_struct_type),
POINTER :: fm_struct_tmp
423 TYPE(cp_fm_type) :: e_vectors, h_block, weighted_vectors, &
426 CALL timeset(routinen, handle)
428 do_rotation_local = .true.
429 IF (
PRESENT(do_rotation)) do_rotation_local = do_rotation
431 NULLIFY (fm_struct_tmp)
433 ncol_global=ncol_global, &
434 nrow_global=nrow_global)
436 IF (do_rotation_local)
THEN
437 compute_evecs = .true.
440 compute_evecs = .false.
442 compute_evecs = .true.
445 IF (ncol_global .GT. 0)
THEN
447 ALLOCATE (evals(ncol_global))
449 CALL cp_fm_create(weighted_vectors, orbitals%matrix_struct,
"weighted_vectors")
450 CALL cp_fm_struct_create(fm_struct_tmp, nrow_global=ncol_global, ncol_global=ncol_global, &
451 para_env=orbitals%matrix_struct%para_env, &
452 context=orbitals%matrix_struct%context)
453 CALL cp_fm_create(h_block, fm_struct_tmp, name=
"h block")
454 IF (compute_evecs)
THEN
455 CALL cp_fm_create(e_vectors, fm_struct_tmp, name=
"e vectors")
462 CALL parallel_gemm(
'T',
'N', ncol_global, ncol_global, nrow_global, 1.0_dp, &
463 orbitals, weighted_vectors, 0.0_dp, h_block)
466 IF (compute_evecs)
THEN
473 IF (do_rotation_local)
THEN
474 CALL parallel_gemm(
'N',
'N', nrow_global, ncol_global, ncol_global, 1.0_dp, &
475 orbitals, e_vectors, 0.0_dp, weighted_vectors)
476 CALL cp_fm_to_fm(weighted_vectors, orbitals)
477 IF (
PRESENT(co_rotate))
THEN
478 CALL parallel_gemm(
'N',
'N', nrow_global, ncol_global, ncol_global, 1.0_dp, &
479 co_rotate, e_vectors, 0.0_dp, weighted_vectors)
480 CALL cp_fm_to_fm(weighted_vectors, co_rotate)
482 IF (
PRESENT(co_rotate_dbcsr))
THEN
483 IF (
ASSOCIATED(co_rotate_dbcsr))
THEN
484 CALL cp_fm_create(weighted_vectors2, orbitals%matrix_struct,
"weighted_vectors")
486 CALL parallel_gemm(
'N',
'N', nrow_global, ncol_global, ncol_global, 1.0_dp, &
487 weighted_vectors2, e_vectors, 0.0_dp, weighted_vectors)
489 CALL cp_fm_release(weighted_vectors2)
495 IF (
PRESENT(evals_arg))
THEN
496 n = min(
SIZE(evals_arg),
SIZE(evals))
497 evals_arg(1:n) = evals(1:n)
500 IF (
PRESENT(ionode) .OR.
PRESENT(scr))
THEN
501 IF (.NOT.
PRESENT(ionode)) cpabort(
"IONODE?")
502 IF (.NOT.
PRESENT(scr)) cpabort(
"SCR?")
504 DO i = 1, ncol_global, 4
505 j = min(3, ncol_global - i)
508 WRITE (scr,
'(1X,4F16.8)') evals(i:i + j)
510 WRITE (scr,
'(1X,3F16.8)') evals(i:i + j)
512 WRITE (scr,
'(1X,2F16.8)') evals(i:i + j)
514 WRITE (scr,
'(1X,1F16.8)') evals(i:i + j)
520 CALL cp_fm_release(weighted_vectors)
521 CALL cp_fm_release(h_block)
522 IF (compute_evecs)
THEN
523 CALL cp_fm_release(e_vectors)
530 CALL timestop(handle)
532 END SUBROUTINE subspace_eigenvalues_ks_fm
546 SUBROUTINE subspace_eigenvalues_ks_dbcsr(orbitals, ks_matrix, evals_arg, ionode, scr, &
547 do_rotation, co_rotate, para_env, blacs_env)
549 TYPE(dbcsr_type),
POINTER :: orbitals, ks_matrix
550 REAL(kind=
dp),
DIMENSION(:),
OPTIONAL :: evals_arg
551 LOGICAL,
INTENT(IN),
OPTIONAL :: ionode
552 INTEGER,
INTENT(IN),
OPTIONAL :: scr
553 LOGICAL,
INTENT(IN),
OPTIONAL :: do_rotation
554 TYPE(dbcsr_type),
OPTIONAL,
POINTER :: co_rotate
555 TYPE(mp_para_env_type),
POINTER :: para_env
556 TYPE(cp_blacs_env_type),
POINTER :: blacs_env
558 CHARACTER(len=*),
PARAMETER :: routinen =
'subspace_eigenvalues_ks_dbcsr'
560 INTEGER :: handle, i, j, ncol_global, nrow_global
561 LOGICAL :: compute_evecs, do_rotation_local
562 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:) :: evals
563 TYPE(dbcsr_type),
POINTER :: e_vectors, h_block, weighted_vectors
565 CALL timeset(routinen, handle)
567 do_rotation_local = .true.
568 IF (
PRESENT(do_rotation)) do_rotation_local = do_rotation
570 NULLIFY (e_vectors, h_block, weighted_vectors)
572 CALL dbcsr_get_info(matrix=orbitals, &
573 nfullcols_total=ncol_global, &
574 nfullrows_total=nrow_global)
576 IF (do_rotation_local)
THEN
577 compute_evecs = .true.
580 compute_evecs = .false.
582 compute_evecs = .true.
585 IF (ncol_global .GT. 0)
THEN
587 ALLOCATE (evals(ncol_global))
589 CALL dbcsr_init_p(weighted_vectors)
590 CALL dbcsr_copy(weighted_vectors, orbitals, name=
"weighted_vectors")
592 CALL dbcsr_init_p(h_block)
594 sym=dbcsr_type_no_symmetry)
597 IF (compute_evecs)
THEN
598 CALL dbcsr_init_p(e_vectors)
600 sym=dbcsr_type_no_symmetry)
604 CALL dbcsr_multiply(
'N',
'N', 1.0_dp, ks_matrix, orbitals, &
605 0.0_dp, weighted_vectors)
608 CALL dbcsr_multiply(
'T',
'N', 1.0_dp, orbitals, weighted_vectors, 0.0_dp, h_block)
613 IF (compute_evecs)
THEN
614 CALL cp_dbcsr_syevd(h_block, e_vectors, evals, para_env=para_env, blacs_env=blacs_env)
616 CALL cp_dbcsr_syevx(h_block, eigenvalues=evals, para_env=para_env, blacs_env=blacs_env)
620 IF (do_rotation_local)
THEN
621 CALL dbcsr_multiply(
'N',
'N', 1.0_dp, orbitals, e_vectors, 0.0_dp, weighted_vectors)
624 CALL dbcsr_copy(orbitals, weighted_vectors)
626 IF (
PRESENT(co_rotate))
THEN
627 IF (
ASSOCIATED(co_rotate))
THEN
628 CALL dbcsr_multiply(
'N',
'N', 1.0_dp, co_rotate, e_vectors, 0.0_dp, weighted_vectors)
631 CALL dbcsr_copy(co_rotate, weighted_vectors)
638 IF (
PRESENT(evals_arg))
THEN
639 evals_arg(:) = evals(:)
642 IF (
PRESENT(ionode) .OR.
PRESENT(scr))
THEN
643 IF (.NOT.
PRESENT(ionode)) cpabort(
"IONODE?")
644 IF (.NOT.
PRESENT(scr)) cpabort(
"SCR?")
646 DO i = 1, ncol_global, 4
647 j = min(3, ncol_global - i)
650 WRITE (scr,
'(1X,4F16.8)') evals(i:i + j)
652 WRITE (scr,
'(1X,3F16.8)') evals(i:i + j)
654 WRITE (scr,
'(1X,2F16.8)') evals(i:i + j)
656 WRITE (scr,
'(1X,1F16.8)') evals(i:i + j)
662 CALL dbcsr_release_p(weighted_vectors)
663 CALL dbcsr_release_p(h_block)
664 IF (compute_evecs)
THEN
665 CALL dbcsr_release_p(e_vectors)
672 CALL timestop(handle)
674 END SUBROUTINE subspace_eigenvalues_ks_dbcsr
685 REAL(kind=
dp) :: orthonormality
686 TYPE(mo_set_type),
DIMENSION(:),
INTENT(IN) :: mo_array
687 TYPE(dbcsr_type),
OPTIONAL,
POINTER :: matrix_s
689 CHARACTER(len=*),
PARAMETER :: routinen =
'calculate_orthonormality'
691 INTEGER :: handle, i, ispin, j, k, n, ncol_local, &
693 INTEGER,
DIMENSION(:),
POINTER :: col_indices, row_indices
694 REAL(kind=
dp) :: alpha, max_alpha
695 TYPE(cp_fm_struct_type),
POINTER :: tmp_fm_struct
696 TYPE(cp_fm_type) :: overlap, svec
698 NULLIFY (tmp_fm_struct)
700 CALL timeset(routinen, handle)
702 nspin =
SIZE(mo_array)
706 IF (
PRESENT(matrix_s))
THEN
708 CALL cp_fm_create(svec, mo_array(ispin)%mo_coeff%matrix_struct)
710 nrow_global=n, ncol_global=k)
715 para_env=mo_array(ispin)%mo_coeff%matrix_struct%para_env, &
716 context=mo_array(ispin)%mo_coeff%matrix_struct%context)
719 CALL parallel_gemm(
'T',
'N', k, k, n, 1.0_dp, mo_array(ispin)%mo_coeff, &
720 svec, 0.0_dp, overlap)
721 CALL cp_fm_release(svec)
725 nrow_global=n, ncol_global=k)
727 para_env=mo_array(ispin)%mo_coeff%matrix_struct%para_env, &
728 context=mo_array(ispin)%mo_coeff%matrix_struct%context)
731 CALL parallel_gemm(
'T',
'N', k, k, n, 1.0_dp, mo_array(ispin)%mo_coeff, &
732 mo_array(ispin)%mo_coeff, 0.0_dp, overlap)
734 CALL cp_fm_get_info(overlap, nrow_local=nrow_local, ncol_local=ncol_local, &
735 row_indices=row_indices, col_indices=col_indices)
738 alpha = overlap%local_data(i, j)
739 IF (row_indices(i) .EQ. col_indices(j)) alpha = alpha - 1.0_dp
740 max_alpha = max(max_alpha, abs(alpha))
743 CALL cp_fm_release(overlap)
745 CALL mo_array(1)%mo_coeff%matrix_struct%para_env%max(max_alpha)
746 orthonormality = max_alpha
749 CALL timestop(handle)
764 TYPE(mo_set_type),
DIMENSION(:),
INTENT(IN) :: mo_array
765 REAL(kind=
dp) :: mo_mag_min, mo_mag_max
767 CHARACTER(len=*),
PARAMETER :: routinen =
'calculate_magnitude'
769 INTEGER :: handle, ispin, k, n, nspin
770 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:) :: evals
771 TYPE(cp_fm_struct_type),
POINTER :: tmp_fm_struct
772 TYPE(cp_fm_type) :: evecs, overlap
774 NULLIFY (tmp_fm_struct)
776 CALL timeset(routinen, handle)
778 nspin =
SIZE(mo_array)
779 mo_mag_min = huge(0.0_dp)
780 mo_mag_max = -huge(0.0_dp)
783 nrow_global=n, ncol_global=k)
786 para_env=mo_array(ispin)%mo_coeff%matrix_struct%para_env, &
787 context=mo_array(ispin)%mo_coeff%matrix_struct%context)
791 CALL parallel_gemm(
'T',
'N', k, k, n, 1.0_dp, mo_array(ispin)%mo_coeff, &
792 mo_array(ispin)%mo_coeff, 0.0_dp, overlap)
794 mo_mag_min = min(minval(evals), mo_mag_min)
795 mo_mag_max = max(maxval(evals), mo_mag_max)
796 CALL cp_fm_release(overlap)
797 CALL cp_fm_release(evecs)
800 CALL timestop(handle)
816 SUBROUTINE make_mo_eig(mos, nspins, ks_rmpv, scf_control, mo_derivs, admm_env)
818 TYPE(mo_set_type),
DIMENSION(:),
INTENT(INOUT) :: mos
819 INTEGER,
INTENT(IN) :: nspins
820 TYPE(dbcsr_p_type),
DIMENSION(:),
POINTER :: ks_rmpv
821 TYPE(scf_control_type),
POINTER :: scf_control
822 TYPE(dbcsr_p_type),
DIMENSION(:),
POINTER :: mo_derivs
823 TYPE(admm_type),
OPTIONAL,
POINTER :: admm_env
825 CHARACTER(len=*),
PARAMETER :: routinen =
'make_mo_eig'
827 INTEGER :: handle, homo, ispin, nmo, output_unit
828 REAL(kind=
dp),
DIMENSION(:),
POINTER :: mo_eigenvalues
829 TYPE(cp_fm_type),
POINTER :: mo_coeff
830 TYPE(dbcsr_type),
POINTER :: mo_coeff_deriv
832 CALL timeset(routinen, handle)
834 NULLIFY (mo_coeff_deriv, mo_coeff, mo_eigenvalues)
838 CALL get_mo_set(mo_set=mos(ispin), mo_coeff=mo_coeff, &
839 eigenvalues=mo_eigenvalues, homo=homo, nmo=nmo)
840 IF (output_unit > 0)
WRITE (output_unit, *)
" "
841 IF (output_unit > 0)
WRITE (output_unit, *)
" Eigenvalues of the occupied subspace spin ", ispin
845 IF (output_unit > 0)
WRITE (output_unit, *)
"---------------------------------------------"
847 IF (scf_control%use_ot)
THEN
849 IF (
ASSOCIATED(mo_derivs))
THEN
850 mo_coeff_deriv => mo_derivs(ispin)%matrix
852 mo_coeff_deriv => null()
856 IF (
PRESENT(admm_env))
THEN
860 CALL calculate_subspace_eigenvalues(mo_coeff, ks_rmpv(ispin)%matrix, mo_eigenvalues, &
861 scr=output_unit, ionode=output_unit > 0, do_rotation=.true., &
862 co_rotate_dbcsr=mo_coeff_deriv)
865 IF (
PRESENT(admm_env))
THEN
869 IF (output_unit > 0)
WRITE (output_unit,
'(4(1X,1F16.8))') mo_eigenvalues(1:homo)
871 IF (.NOT. scf_control%diagonalization%mom) &
872 CALL set_mo_occupation(mo_set=mos(ispin), smear=scf_control%smear)
873 IF (output_unit > 0)
WRITE (output_unit,
'(T2,A,F12.6)') &
874 "Fermi Energy [eV] :", mos(ispin)%mu*
evolt
877 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
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 cp_dbcsr_m_by_n_from_template(matrix, template, m, n, sym, data_type)
Utility function to create an arbitrary shaped dbcsr matrix with the same processor grid as the templ...
subroutine, public copy_dbcsr_to_fm(matrix, fm)
Copy a DBCSR matrix to a BLACS matrix.
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_create(matrix, matrix_struct, name, use_sp)
creates a new full matrix with the given structure
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_mo_eig(mos, nspins, ks_rmpv, scf_control, mo_derivs, admm_env)
Calculate KS eigenvalues starting from OF MOS.
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_basis_sm(vmatrix, ncol, matrix_s)
returns an S-orthonormal basis v (v^T S v ==1)
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)
Get the components of a MO set data structure.
parameters that control an scf iteration