90#include "./base/base_uses.f90"
95 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'hfx_ace_methods'
105 TYPE(cp_fm_type),
ALLOCATABLE,
SAVE :: ace_W(:, :)
106 LOGICAL,
SAVE :: ace_is_built = .false.
107 INTEGER,
SAVE :: ace_step_counter = 0
108 REAL(dp),
SAVE :: ace_W_ref_norm = 0.0_dp
109 INTEGER,
SAVE :: ace_geo_step = 0
120 LOGICAL,
PARAMETER,
PRIVATE :: DBG_ROUTING = .false.
121 LOGICAL,
PARAMETER,
PRIVATE :: DBG_BUILD = .false.
122 LOGICAL,
PARAMETER,
PRIVATE :: DBG_ENERGY = .false.
123 LOGICAL,
PARAMETER,
PRIVATE :: DBG_STALE = .false.
124 LOGICAL,
PARAMETER,
PRIVATE :: DBG_EXACT_EX = .false.
126 LOGICAL,
SAVE :: ace_dynamic_mode = .false.
148 calculate_forces, just_energy, &
149 v_rspace_new, v_tau_rspace, &
150 ace_rebuild_frequency, ext_xc_section)
153 TYPE(
dbcsr_p_type),
DIMENSION(:, :),
POINTER :: ks_matrix
156 LOGICAL,
INTENT(IN) :: calculate_forces, just_energy
157 TYPE(
pw_r3d_rs_type),
DIMENSION(:),
POINTER :: v_rspace_new, v_tau_rspace
158 INTEGER,
INTENT(IN) :: ace_rebuild_frequency
161 CHARACTER(LEN=*),
PARAMETER :: routinen =
'hfx_ace_ks_matrix'
163 INTEGER :: handle, iw, n_rep_hf, nspins, &
165 LOGICAL :: ace_built_now, rebuild_ace
169 TYPE(
hfx_type),
DIMENSION(:, :),
POINTER :: x_data
172 CALL timeset(routinen, handle)
175 NULLIFY (logger, dft_control, x_data, scf_control)
180 CALL get_qs_env(qs_env, x_data=x_data, dft_control=dft_control)
181 n_rep_hf =
SIZE(x_data, 1)
182 nspins = dft_control%nspins
184 IF (n_rep_hf /= 1) cpabort(
"ACE: only one &HF section is supported.")
185 IF (dft_control%nimages /= 1)
THEN
186 cpabort(
"ACE: k-points / multiple images are not implemented.")
192 CALL get_qs_env(qs_env, scf_control=scf_control)
193 IF (scf_control%use_ot)
THEN
194 cpabort(
"ACE: OT doesn't work, use diagonalization-based SCF.")
197 rebuild_freq = max(1, ace_rebuild_frequency)
202 IF (just_energy)
THEN
203 IF (dbg_routing .AND. iw > 0)
THEN
204 WRITE (iw,
'(T2,A)')
'ACE | just_energy=T: full HFX (no matrix update)'
206 CALL hfx_call(qs_env, ks_matrix, rho, energy, &
207 calculate_forces, just_energy, &
208 v_rspace_new, v_tau_rspace, ext_xc_section)
209 CALL timestop(handle)
216 IF (calculate_forces)
THEN
217 IF (dbg_routing .AND. iw > 0)
THEN
218 WRITE (iw,
'(T2,A)')
'ACE | calculate_forces=T: full HFX for exact forces'
220 CALL hfx_call(qs_env, ks_matrix, rho, energy, &
221 calculate_forces, just_energy, &
222 v_rspace_new, v_tau_rspace, ext_xc_section)
223 ace_is_built = .false.
225 ace_geo_step = ace_geo_step + 1
226 CALL timestop(handle)
239 IF (ace_geo_step == 0 .AND. ace_dynamic_mode)
THEN
240 IF (iw > 0)
WRITE (iw,
'(T2,A)') &
241 'ACE | geo_step=0 (MD/GEO_OPT): full HFX for reference wavefunction'
242 CALL hfx_call(qs_env, ks_matrix, rho, energy, &
243 .false., just_energy, &
244 v_rspace_new, v_tau_rspace, ext_xc_section)
245 CALL timestop(handle)
252 rebuild_ace = (.NOT. ace_is_built) .OR. &
253 (mod(ace_step_counter, rebuild_freq) == 0)
255 IF (dbg_routing .AND. iw > 0)
THEN
256 WRITE (iw,
'(/,T2,A)') repeat(
'-', 56)
257 WRITE (iw,
'(T2,A)')
'ACE | hfx_ace_ks_matrix'
258 WRITE (iw,
'(T4,A,L1)')
'ace_is_built = ', ace_is_built
259 WRITE (iw,
'(T4,A,L1)')
'rebuild_ace = ', rebuild_ace
260 WRITE (iw,
'(T4,A,I6)')
'step_counter = ', ace_step_counter
261 WRITE (iw,
'(T4,A,I6)')
'rebuild_freq = ', rebuild_freq
262 WRITE (iw,
'(T4,A,I4)')
'nspins = ', nspins
263 WRITE (iw,
'(T4,A)') merge(
'-> BUILD',
'-> APPLY', rebuild_ace)
264 WRITE (iw,
'(T2,A)') repeat(
'-', 56)
267 IF (rebuild_ace)
THEN
269 ace_built_now = .false.
270 CALL hfx_ace_build_projector(qs_env, ks_matrix, rho, energy, &
272 v_rspace_new, v_tau_rspace, &
273 nspins, iw, ace_built_now, &
275 IF (ace_built_now)
THEN
276 ace_is_built = .true.
278 IF (dbg_routing .AND. iw > 0)
THEN
279 WRITE (iw,
'(T4,A)')
'ACE | W built. Projector live from next step.'
282 ace_is_built = .false.
284 IF (dbg_routing .AND. iw > 0)
THEN
285 WRITE (iw,
'(T4,A)')
'ACE | Build deferred (C_occ=0). Full HFX in ks_matrix.'
291 CALL hfx_ace_apply_projector(qs_env, ks_matrix, rho, energy, nspins, iw)
292 ace_step_counter = ace_step_counter + 1
309 IF (dbg_exact_ex)
THEN
312 CALL hfx_call(qs_env, ks_matrix, rho, energy, &
314 v_rspace_new, v_tau_rspace, ext_xc_section)
316 WRITE (iw,
'(/,T2,A)') repeat(
'-', 56)
317 WRITE (iw,
'(T2,A,I6)')
'ACE DIAG B | ace_step_counter = ', ace_step_counter
318 WRITE (iw,
'(T4,A,F20.10)')
'E_x(exact, P^k) = ', energy%ex
319 WRITE (iw,
'(T4,A,F20.10)')
'E_x(ACE, P^k) = ', ex_ace
320 WRITE (iw,
'(T4,A,ES12.4)')
'|delta| = ', abs(ex_ace - energy%ex)
321 WRITE (iw,
'(T4,A)') &
322 '|delta|->0 on BUILD step; growth confirms stale projector'
323 WRITE (iw,
'(T2,A)') repeat(
'-', 56)
327 CALL hfx_ace_apply_projector(qs_env, ks_matrix, rho, energy, nspins, iw)
332 IF (dbg_routing .AND. iw > 0)
THEN
333 WRITE (iw,
'(T4,A,F20.10)')
'energy%ex on exit = ', energy%ex
334 WRITE (iw,
'(T4,A,I6)')
'step_counter now = ', ace_step_counter
337 CALL timestop(handle)
355 SUBROUTINE hfx_ace_build_projector(qs_env, ks_matrix, rho, energy, &
357 v_rspace_new, v_tau_rspace, &
358 nspins, iw, build_succeeded, &
362 TYPE(
dbcsr_p_type),
DIMENSION(:, :),
POINTER :: ks_matrix
365 LOGICAL,
INTENT(IN) :: just_energy
366 TYPE(
pw_r3d_rs_type),
DIMENSION(:),
POINTER :: v_rspace_new, v_tau_rspace
367 INTEGER,
INTENT(IN) :: nspins, iw
368 LOGICAL,
INTENT(OUT) :: build_succeeded
371 CHARACTER(LEN=*),
PARAMETER :: routinen =
'hfx_ace_build_projector'
373 INTEGER :: handle, info_chol, ispin, nao, nmo, nocc
375 REAL(dp) :: ehfx_full, frob
376 REAL(dp),
DIMENSION(:),
POINTER :: occ_nums
380 TYPE(
cp_fm_type) :: a_ref_fm, c_occ_fm, k_fm, m_fm, xi_fm
383 TYPE(
dbcsr_p_type),
DIMENSION(:, :),
POINTER :: matrix_h
386 TYPE(
mo_set_type),
DIMENSION(:),
POINTER :: mos, mos_for_ace
391 CALL timeset(routinen, handle)
392 NULLIFY (blacs_env, para_env, mos, mo_coeff, matrix_h, occ_nums, fmstruct)
393 NULLIFY (dft_control, admm_env, mos_for_ace, ks_aux_fit)
395 build_succeeded = .false.
397 CALL get_qs_env(qs_env, blacs_env=blacs_env, para_env=para_env, &
398 mos=mos, matrix_h_kp=matrix_h, &
399 dft_control=dft_control)
401 do_admm = dft_control%do_admm
406 matrix_ks_aux_fit=ks_aux_fit, &
407 mos_aux_fit=mos_for_ace)
413 CALL hfx_call(qs_env, ks_matrix, rho, energy, &
414 .false., just_energy, &
415 v_rspace_new, v_tau_rspace, ext_xc_section)
416 ehfx_full = energy%ex
418 IF (dbg_build .AND. iw > 0)
THEN
419 WRITE (iw,
'(/,T2,A,F20.10)')
'ACE BUILD | E_x(full HFX) = ', ehfx_full
423 IF (
ALLOCATED(ace_w))
THEN
426 IF (.NOT.
ALLOCATED(ace_w))
ALLOCATE (ace_w(1, nspins))
429 ace_w_ref_norm = 0.0_dp
436 IF (mos_for_ace(ispin)%use_mo_coeff_b)
THEN
438 mos_for_ace(ispin)%mo_coeff)
441 CALL get_mo_set(mos_for_ace(ispin), mo_coeff=mo_coeff, &
442 nao=nao, nmo=nmo, homo=nocc, &
443 occupation_numbers=occ_nums)
445 IF (nocc <= 0) cpabort(
"ACE: homo <= 0.")
446 IF (nocc > nmo) cpabort(
"ACE: homo > nmo.")
447 cpassert(
ASSOCIATED(mo_coeff))
451 IF (dbg_build .AND. iw > 0)
THEN
452 WRITE (iw,
'(/,T2,A,I4)')
'ACE BUILD | ispin = ', ispin
453 WRITE (iw,
'(T4,A,I8)')
'nao = ', nao
454 WRITE (iw,
'(T4,A,I8)')
'nmo = ', nmo
455 WRITE (iw,
'(T4,A,I8)')
'nocc = ', nocc
456 WRITE (iw,
'(T4,A,L1)')
'use_mo_coeff_b = ', mos_for_ace(ispin)%use_mo_coeff_b
457 WRITE (iw,
'(T4,A,ES12.4)')
'||mo_coeff||_F = ', sqrt(max(frob, 0.0_dp))
460 IF (frob < 1.0e-20_dp)
THEN
461 IF (dbg_build .AND. iw > 0)
THEN
462 WRITE (iw,
'(T4,A)')
'mo_coeff=0: build deferred to next step.'
464 CALL timestop(handle)
470 CALL dbcsr_create(k_ao_dbcsr, template=ks_aux_fit(ispin)%matrix, &
472 CALL dbcsr_copy(k_ao_dbcsr, ks_aux_fit(ispin)%matrix)
474 CALL dbcsr_create(k_ao_dbcsr, template=ks_matrix(ispin, 1)%matrix, &
476 CALL dbcsr_copy(k_ao_dbcsr, ks_matrix(ispin, 1)%matrix)
477 CALL dbcsr_add(k_ao_dbcsr, matrix_h(1, 1)%matrix, 1.0_dp, -1.0_dp)
482 nrow_global=nao, ncol_global=nao)
488 IF (dbg_build .AND. iw > 0)
THEN
490 WRITE (iw,
'(T4,A,ES12.4)')
'||K_AO||_F = ', sqrt(max(frob, 0.0_dp))
496 nrow_global=nao, ncol_global=nocc)
505 1.0_dp, k_fm, c_occ_fm, 0.0_dp, xi_fm)
508 IF (dbg_build .AND. iw > 0)
THEN
510 WRITE (iw,
'(T4,A,ES12.4)')
'||xi||_F = ', sqrt(max(frob, 0.0_dp))
516 nrow_global=nocc, ncol_global=nocc)
521 1.0_dp, c_occ_fm, xi_fm, 0.0_dp, m_fm)
524 IF (dbg_build .AND. iw > 0)
THEN
526 WRITE (iw,
'(T4,A,ES12.4)')
'||M||_F = ', sqrt(max(frob, 0.0_dp))
533 IF (info_chol /= 0)
THEN
535 WRITE (iw,
'(T4,A,I6)')
'ACE | Cholesky failed, info = ', info_chol
536 WRITE (iw,
'(T4,A,F20.10)')
'ACE | E_x(full) = ', ehfx_full
537 WRITE (iw,
'(T4,A,I8,A,I8)')
'ACE | nao=', nao,
' nocc=', nocc
539 cpabort(
"ACE: Cholesky of -M failed (not positive definite).")
542 IF (dbg_build .AND. iw > 0)
THEN
543 WRITE (iw,
'(T4,A)')
'Cholesky OK (info=0).'
547 IF (
ASSOCIATED(ace_w(1, ispin)%matrix_struct))
THEN
551 CALL cp_fm_create(ace_w(1, ispin), xi_fm%matrix_struct, name=
"W_ACE")
555 side=
'R', uplo_tr=
'U', &
556 transpose_tr=.false., &
558 n_rows=nao, n_cols=nocc, &
564 IF (dbg_build .AND. iw > 0)
THEN
565 CALL cp_fm_trace(ace_w(1, ispin), ace_w(1, ispin), frob)
566 WRITE (iw,
'(T4,A,I4,A,2I8,A,ES12.4)') &
567 'W spin=', ispin,
' shape=', nao, nocc, &
568 ' ||W||_F=', sqrt(max(frob, 0.0_dp))
585 nrow_global=nao, ncol_global=nocc)
586 CALL cp_fm_create(c_occ_fm, fmstruct, name=
"C_occ_ref_diag")
593 nrow_global=nocc, ncol_global=nocc)
598 1.0_dp, ace_w(1, ispin), c_occ_fm, 0.0_dp, a_ref_fm)
600 ace_w_ref_norm = ace_w_ref_norm + sqrt(max(frob, 0.0_dp))
608 IF (dbg_stale .AND. iw > 0)
THEN
609 WRITE (iw,
'(/,T2,A)') repeat(
'-', 56)
610 WRITE (iw,
'(T2,A)')
'ACE DIAG A | Reference norm stored at BUILD'
611 WRITE (iw,
'(T4,A,ES12.4)') &
612 '||W^T C_occ^BUILD||_F (sum over spins) = ', ace_w_ref_norm
613 WRITE (iw,
'(T4,A)') &
614 'Staleness ratio = 1.0 at BUILD step; decreasing means W is becoming stale'
615 WRITE (iw,
'(T2,A)') repeat(
'-', 56)
618 build_succeeded = .true.
621 CALL hfx_ace_apply_projector(qs_env, ks_matrix, rho, energy, &
622 nspins, iw, ehfx_full_ref=ehfx_full)
624 CALL timestop(handle)
626 END SUBROUTINE hfx_ace_build_projector
638 SUBROUTINE hfx_ace_apply_projector(qs_env, ks_matrix, rho, energy, &
639 nspins, iw, ehfx_full_ref)
642 TYPE(
dbcsr_p_type),
DIMENSION(:, :),
POINTER :: ks_matrix
645 INTEGER,
INTENT(IN) :: nspins, iw
646 REAL(dp),
INTENT(IN),
OPTIONAL :: ehfx_full_ref
648 CHARACTER(LEN=*),
PARAMETER :: routinen =
'hfx_ace_apply_projector'
650 INTEGER :: handle, ispin, nao, nao_d, nmo_d, nocc, &
653 REAL(dp) :: ehfx_ace, frob_a, stale_norm, trace_val
657 TYPE(
cp_fm_type) :: a_diag_fm, c_occ_diag, p_fm, pw_fm
659 TYPE(
dbcsr_p_type),
DIMENSION(:),
POINTER :: ks_aux_fit, ks_aux_fit_hfx
660 TYPE(
dbcsr_p_type),
DIMENSION(:, :),
POINTER :: matrix_h, rho_ao
662 TYPE(
mo_set_type),
DIMENSION(:),
POINTER :: mos_aux_diag, mos_diag
678 CALL timeset(routinen, handle)
679 NULLIFY (blacs_env, para_env, matrix_h, rho_ao, fmstruct)
680 NULLIFY (dft_control, admm_env, ks_aux_fit, ks_aux_fit_hfx, rho_aux_fit)
681 NULLIFY (mos_diag, mos_aux_diag, mo_coeff_diag, fmstruct_diag)
682 cpassert(
ALLOCATED(ace_w))
684 CALL get_qs_env(qs_env, blacs_env=blacs_env, para_env=para_env, &
685 matrix_h_kp=matrix_h, dft_control=dft_control)
686 do_admm = dft_control%do_admm
691 matrix_ks_aux_fit=ks_aux_fit, &
692 matrix_ks_aux_fit_hfx=ks_aux_fit_hfx, &
693 rho_aux_fit=rho_aux_fit)
694 CALL qs_rho_get(rho_aux_fit, rho_ao_kp=rho_ao)
700 CALL cp_fm_get_info(ace_w(1, ispin), nrow_global=nao, ncol_global=nocc)
703 CALL dbcsr_set(ks_matrix(ispin, 1)%matrix, 0.0_dp)
704 CALL dbcsr_add(ks_matrix(ispin, 1)%matrix, &
705 matrix_h(1, 1)%matrix, 1.0_dp, 1.0_dp)
706 CALL dbcsr_set(ks_aux_fit(ispin)%matrix, 0.0_dp)
708 sparse_matrix=ks_aux_fit(ispin)%matrix, &
709 matrix_v=ace_w(1, ispin), &
712 keep_sparsity=.true.)
713 CALL dbcsr_add(ks_aux_fit_hfx(ispin)%matrix, &
714 ks_aux_fit(ispin)%matrix, 0.0_dp, 1.0_dp)
716 CALL dbcsr_set(ks_matrix(ispin, 1)%matrix, 0.0_dp)
718 sparse_matrix=ks_matrix(ispin, 1)%matrix, &
719 matrix_v=ace_w(1, ispin), &
722 keep_sparsity=.true.)
723 CALL dbcsr_add(ks_matrix(ispin, 1)%matrix, &
724 matrix_h(1, 1)%matrix, 1.0_dp, 1.0_dp)
731 CALL cp_fm_get_info(ace_w(1, ispin), nrow_global=nao, ncol_global=nocc)
735 nrow_global=nao, ncol_global=nao)
740 CALL cp_fm_create(pw_fm, ace_w(1, ispin)%matrix_struct, name=
"PW")
742 1.0_dp, p_fm, ace_w(1, ispin), 0.0_dp, pw_fm)
743 CALL cp_fm_trace(ace_w(1, ispin), pw_fm, trace_val)
744 ehfx_ace = ehfx_ace - 0.5_dp*trace_val
749 IF (dbg_energy .AND. iw > 0)
THEN
750 WRITE (iw,
'(T4,A,I4,A,F20.10)') &
751 'ispin=', ispin,
' E_x(ACE) += ', -0.5_dp*trace_val
758 IF (dbg_energy .AND. iw > 0)
THEN
759 WRITE (iw,
'(T2,A,F20.10)')
'ACE | E_x(ACE) = ', ehfx_ace
760 IF (
PRESENT(ehfx_full_ref))
THEN
761 WRITE (iw,
'(T2,A,F20.10)')
'ACE | E_x(full) = ', ehfx_full_ref
762 WRITE (iw,
'(T2,A,ES12.4)')
'ACE | |delta| = ', abs(ehfx_ace - ehfx_full_ref)
763 WRITE (iw,
'(T2,A)')
'(|delta| should be ~0 on BUILD steps; small is good)'
782 IF (dbg_stale .AND. ace_w_ref_norm > 0.0_dp)
THEN
787 CALL cp_fm_get_info(ace_w(1, ispin), nrow_global=nao_d, ncol_global=nocc_d)
791 IF (mos_aux_diag(ispin)%use_mo_coeff_b)
THEN
793 mos_aux_diag(ispin)%mo_coeff)
795 CALL get_mo_set(mos_aux_diag(ispin), mo_coeff=mo_coeff_diag, &
796 nao=nao_d, nmo=nmo_d, homo=nocc_d)
798 IF (mos_diag(ispin)%use_mo_coeff_b)
THEN
800 mos_diag(ispin)%mo_coeff)
802 CALL get_mo_set(mos_diag(ispin), mo_coeff=mo_coeff_diag, &
803 nao=nao_d, nmo=nmo_d, homo=nocc_d)
806 NULLIFY (fmstruct_diag)
809 nrow_global=nao_d, ncol_global=nocc_d)
810 CALL cp_fm_create(c_occ_diag, fmstruct_diag, name=
"C_stale")
814 NULLIFY (fmstruct_diag)
817 nrow_global=nocc_d, ncol_global=nocc_d)
818 CALL cp_fm_create(a_diag_fm, fmstruct_diag, name=
"WtC_stale")
822 1.0_dp, ace_w(1, ispin), c_occ_diag, 0.0_dp, a_diag_fm)
824 stale_norm = stale_norm + sqrt(max(frob_a, 0.0_dp))
830 WRITE (iw,
'(/,T2,A)') repeat(
'-', 56)
831 WRITE (iw,
'(T2,A,I6)')
'ACE DIAG A | ace_step_counter = ', ace_step_counter
832 WRITE (iw,
'(T4,A,ES12.4)')
'||W^T C_occ^current||_F = ', stale_norm
833 WRITE (iw,
'(T4,A,ES12.4)')
'||W^T C_occ^BUILD||_F (ref) = ', ace_w_ref_norm
834 WRITE (iw,
'(T4,A,F10.6)')
'staleness ratio (1=fresh, 0=stale) = ', &
835 stale_norm/max(ace_w_ref_norm, 1.0e-30_dp)
836 WRITE (iw,
'(T2,A)') repeat(
'-', 56)
840 CALL timestop(handle)
842 END SUBROUTINE hfx_ace_apply_projector
850 INTEGER,
INTENT(IN),
OPTIONAL :: iw_opt
855 IF (
PRESENT(iw_opt)) iw = iw_opt
857 IF (
ALLOCATED(ace_w))
THEN
858 DO j = 1,
SIZE(ace_w, 2)
859 DO i = 1,
SIZE(ace_w, 1)
860 IF (
ASSOCIATED(ace_w(i, j)%matrix_struct))
CALL cp_fm_release(ace_w(i, j))
866 ace_is_built = .false.
868 ace_w_ref_norm = 0.0_dp
870 ace_dynamic_mode = .false.
872 IF (iw > 0)
WRITE (iw,
'(T2,A)')
'ACE | storage released, counters reset'
886 LOGICAL,
INTENT(IN) :: is_dynamic
888 ace_dynamic_mode = is_dynamic
915 SUBROUTINE hfx_call(qs_env, ks_matrix, rho, energy, &
916 calculate_forces, just_energy, &
917 v_rspace_new, v_tau_rspace, ext_xc_section)
920 TYPE(
dbcsr_p_type),
DIMENSION(:, :),
POINTER :: ks_matrix
923 LOGICAL,
INTENT(IN) :: calculate_forces, just_energy
924 TYPE(
pw_r3d_rs_type),
DIMENSION(:),
POINTER :: v_rspace_new, v_tau_rspace
927 IF (
PRESENT(ext_xc_section))
THEN
929 calculate_forces, just_energy, &
930 v_rspace_new, v_tau_rspace, &
931 ext_xc_section=ext_xc_section)
934 calculate_forces, just_energy, &
935 v_rspace_new, v_tau_rspace)
938 END SUBROUTINE hfx_call
Types and set/get functions for auxiliary density matrix methods.
subroutine, public get_admm_env(admm_env, mo_derivs_aux_fit, mos_aux_fit, sab_aux_fit, sab_aux_fit_asymm, sab_aux_fit_vs_orb, matrix_s_aux_fit, matrix_s_aux_fit_kp, matrix_s_aux_fit_vs_orb, matrix_s_aux_fit_vs_orb_kp, task_list_aux_fit, matrix_ks_aux_fit, matrix_ks_aux_fit_kp, matrix_ks_aux_fit_im, matrix_ks_aux_fit_dft, matrix_ks_aux_fit_hfx, matrix_ks_aux_fit_dft_kp, matrix_ks_aux_fit_hfx_kp, rho_aux_fit, rho_aux_fit_buffer, admm_dm)
Get routine for the ADMM env.
collects all references to literature in CP2K as new algorithms / method are included from literature...
integer, save, public lin2016ace
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_copy(matrix_b, matrix_a, name, keep_sparsity, keep_imaginary)
...
subroutine, public dbcsr_set(matrix, alpha)
...
subroutine, public dbcsr_release(matrix)
...
subroutine, public dbcsr_add(matrix_a, matrix_b, alpha_scalar, beta_scalar)
...
DBCSR operations in CP2K.
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,...
Basic linear algebra operations for full matrices.
subroutine, public cp_fm_scale(alpha, matrix_a)
scales a matrix matrix_a = alpha * matrix_b
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,...
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, nrow, ncol, set_zero)
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...
type(cp_logger_type) function, pointer, public cp_get_default_logger()
returns the default logger
Adaptively Compressed Exchange (ACE) operator for HFX. Reference: Lin, J. Chem. Theory Comput....
subroutine, public hfx_ace_set_dynamic_mode(is_dynamic)
Mark this run as dynamic (GEO_OPT/MD) so Bypass C fires for geo step 0. Call this once from the geo_o...
subroutine, public hfx_ace_release(iw_opt)
Release all ACE storage and reset state flags.
subroutine, public hfx_ace_ks_matrix(qs_env, ks_matrix, rho, energy, calculate_forces, just_energy, v_rspace_new, v_tau_rspace, ace_rebuild_frequency, ext_xc_section)
Main ACE entry point, replacing hfx_ks_matrix in qs_ks_methods.
Utilities for hfx and admm methods.
subroutine, public hfx_ks_matrix(qs_env, matrix_ks, rho, energy, calculate_forces, just_energy, v_rspace_new, v_tau_rspace, ext_xc_section)
Add the hfx contributions to the Hamiltonian.
Types and set/get functions for HFX.
Defines the basic variable types.
integer, parameter, public dp
Interface to the message passing library MPI.
basic linear algebra operations for full matrixes
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.
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.
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...
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
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
stores all the informations relevant to an mpi environment
keeps the density in various representations, keeping track of which ones are valid.