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) &
186 cpabort(
"ACE: k-points / multiple images are not implemented.")
191 CALL get_qs_env(qs_env, scf_control=scf_control)
192 IF (scf_control%use_ot) &
193 cpabort(
"ACE: OT doesn't work, use diagonalization-based SCF.")
195 rebuild_freq = max(1, ace_rebuild_frequency)
200 IF (just_energy)
THEN
201 IF (dbg_routing .AND. iw > 0) &
202 WRITE (iw,
'(T2,A)')
'ACE | just_energy=T: full HFX (no matrix update)'
203 CALL hfx_call(qs_env, ks_matrix, rho, energy, &
204 calculate_forces, just_energy, &
205 v_rspace_new, v_tau_rspace, ext_xc_section)
206 CALL timestop(handle)
213 IF (calculate_forces)
THEN
214 IF (dbg_routing .AND. iw > 0) &
215 WRITE (iw,
'(T2,A)')
'ACE | calculate_forces=T: full HFX for exact forces'
216 CALL hfx_call(qs_env, ks_matrix, rho, energy, &
217 calculate_forces, just_energy, &
218 v_rspace_new, v_tau_rspace, ext_xc_section)
219 ace_is_built = .false.
221 ace_geo_step = ace_geo_step + 1
222 CALL timestop(handle)
235 IF (ace_geo_step == 0 .AND. ace_dynamic_mode)
THEN
236 IF (iw > 0)
WRITE (iw,
'(T2,A)') &
237 'ACE | geo_step=0 (MD/GEO_OPT): full HFX for reference wavefunction'
238 CALL hfx_call(qs_env, ks_matrix, rho, energy, &
239 .false., just_energy, &
240 v_rspace_new, v_tau_rspace, ext_xc_section)
241 CALL timestop(handle)
248 rebuild_ace = (.NOT. ace_is_built) .OR. &
249 (mod(ace_step_counter, rebuild_freq) == 0)
251 IF (dbg_routing .AND. iw > 0)
THEN
252 WRITE (iw,
'(/,T2,A)') repeat(
'-', 56)
253 WRITE (iw,
'(T2,A)')
'ACE | hfx_ace_ks_matrix'
254 WRITE (iw,
'(T4,A,L1)')
'ace_is_built = ', ace_is_built
255 WRITE (iw,
'(T4,A,L1)')
'rebuild_ace = ', rebuild_ace
256 WRITE (iw,
'(T4,A,I6)')
'step_counter = ', ace_step_counter
257 WRITE (iw,
'(T4,A,I6)')
'rebuild_freq = ', rebuild_freq
258 WRITE (iw,
'(T4,A,I4)')
'nspins = ', nspins
259 WRITE (iw,
'(T4,A)') merge(
'-> BUILD',
'-> APPLY', rebuild_ace)
260 WRITE (iw,
'(T2,A)') repeat(
'-', 56)
263 IF (rebuild_ace)
THEN
265 ace_built_now = .false.
266 CALL hfx_ace_build_projector(qs_env, ks_matrix, rho, energy, &
268 v_rspace_new, v_tau_rspace, &
269 nspins, iw, ace_built_now, &
271 IF (ace_built_now)
THEN
272 ace_is_built = .true.
274 IF (dbg_routing .AND. iw > 0) &
275 WRITE (iw,
'(T4,A)')
'ACE | W built. Projector live from next step.'
277 ace_is_built = .false.
279 IF (dbg_routing .AND. iw > 0) &
280 WRITE (iw,
'(T4,A)')
'ACE | Build deferred (C_occ=0). Full HFX in ks_matrix.'
285 CALL hfx_ace_apply_projector(qs_env, ks_matrix, rho, energy, nspins, iw)
286 ace_step_counter = ace_step_counter + 1
303 IF (dbg_exact_ex)
THEN
306 CALL hfx_call(qs_env, ks_matrix, rho, energy, &
308 v_rspace_new, v_tau_rspace, ext_xc_section)
310 WRITE (iw,
'(/,T2,A)') repeat(
'-', 56)
311 WRITE (iw,
'(T2,A,I6)')
'ACE DIAG B | ace_step_counter = ', ace_step_counter
312 WRITE (iw,
'(T4,A,F20.10)')
'E_x(exact, P^k) = ', energy%ex
313 WRITE (iw,
'(T4,A,F20.10)')
'E_x(ACE, P^k) = ', ex_ace
314 WRITE (iw,
'(T4,A,ES12.4)')
'|delta| = ', abs(ex_ace - energy%ex)
315 WRITE (iw,
'(T4,A)') &
316 '|delta|->0 on BUILD step; growth confirms stale projector'
317 WRITE (iw,
'(T2,A)') repeat(
'-', 56)
321 CALL hfx_ace_apply_projector(qs_env, ks_matrix, rho, energy, nspins, iw)
326 IF (dbg_routing .AND. iw > 0)
THEN
327 WRITE (iw,
'(T4,A,F20.10)')
'energy%ex on exit = ', energy%ex
328 WRITE (iw,
'(T4,A,I6)')
'step_counter now = ', ace_step_counter
331 CALL timestop(handle)
349 SUBROUTINE hfx_ace_build_projector(qs_env, ks_matrix, rho, energy, &
351 v_rspace_new, v_tau_rspace, &
352 nspins, iw, build_succeeded, &
356 TYPE(
dbcsr_p_type),
DIMENSION(:, :),
POINTER :: ks_matrix
359 LOGICAL,
INTENT(IN) :: just_energy
360 TYPE(
pw_r3d_rs_type),
DIMENSION(:),
POINTER :: v_rspace_new, v_tau_rspace
361 INTEGER,
INTENT(IN) :: nspins, iw
362 LOGICAL,
INTENT(OUT) :: build_succeeded
365 CHARACTER(LEN=*),
PARAMETER :: routinen =
'hfx_ace_build_projector'
367 INTEGER :: handle, info_chol, ispin, nao, nmo, nocc
369 REAL(dp) :: ehfx_full, frob
370 REAL(dp),
DIMENSION(:),
POINTER :: occ_nums
374 TYPE(
cp_fm_type) :: a_ref_fm, c_occ_fm, k_fm, m_fm, xi_fm
377 TYPE(
dbcsr_p_type),
DIMENSION(:, :),
POINTER :: matrix_h
380 TYPE(
mo_set_type),
DIMENSION(:),
POINTER :: mos, mos_for_ace
385 CALL timeset(routinen, handle)
386 NULLIFY (blacs_env, para_env, mos, mo_coeff, matrix_h, occ_nums, fmstruct)
387 NULLIFY (dft_control, admm_env, mos_for_ace, ks_aux_fit)
389 build_succeeded = .false.
391 CALL get_qs_env(qs_env, blacs_env=blacs_env, para_env=para_env, &
392 mos=mos, matrix_h_kp=matrix_h, &
393 dft_control=dft_control)
395 do_admm = dft_control%do_admm
400 matrix_ks_aux_fit=ks_aux_fit, &
401 mos_aux_fit=mos_for_ace)
407 CALL hfx_call(qs_env, ks_matrix, rho, energy, &
408 .false., just_energy, &
409 v_rspace_new, v_tau_rspace, ext_xc_section)
410 ehfx_full = energy%ex
412 IF (dbg_build .AND. iw > 0) &
413 WRITE (iw,
'(/,T2,A,F20.10)')
'ACE BUILD | E_x(full HFX) = ', ehfx_full
416 IF (
ALLOCATED(ace_w))
THEN
419 IF (.NOT.
ALLOCATED(ace_w))
ALLOCATE (ace_w(1, nspins))
422 ace_w_ref_norm = 0.0_dp
429 IF (mos_for_ace(ispin)%use_mo_coeff_b) &
431 mos_for_ace(ispin)%mo_coeff)
433 CALL get_mo_set(mos_for_ace(ispin), mo_coeff=mo_coeff, &
434 nao=nao, nmo=nmo, homo=nocc, &
435 occupation_numbers=occ_nums)
437 IF (nocc <= 0) cpabort(
"ACE: homo <= 0.")
438 IF (nocc > nmo) cpabort(
"ACE: homo > nmo.")
439 cpassert(
ASSOCIATED(mo_coeff))
443 IF (dbg_build .AND. iw > 0)
THEN
444 WRITE (iw,
'(/,T2,A,I4)')
'ACE BUILD | ispin = ', ispin
445 WRITE (iw,
'(T4,A,I8)')
'nao = ', nao
446 WRITE (iw,
'(T4,A,I8)')
'nmo = ', nmo
447 WRITE (iw,
'(T4,A,I8)')
'nocc = ', nocc
448 WRITE (iw,
'(T4,A,L1)')
'use_mo_coeff_b = ', mos_for_ace(ispin)%use_mo_coeff_b
449 WRITE (iw,
'(T4,A,ES12.4)')
'||mo_coeff||_F = ', sqrt(max(frob, 0.0_dp))
452 IF (frob < 1.0e-20_dp)
THEN
453 IF (dbg_build .AND. iw > 0) &
454 WRITE (iw,
'(T4,A)')
'mo_coeff=0: build deferred to next step.'
455 CALL timestop(handle)
461 CALL dbcsr_create(k_ao_dbcsr, template=ks_aux_fit(ispin)%matrix, &
463 CALL dbcsr_copy(k_ao_dbcsr, ks_aux_fit(ispin)%matrix)
465 CALL dbcsr_create(k_ao_dbcsr, template=ks_matrix(ispin, 1)%matrix, &
467 CALL dbcsr_copy(k_ao_dbcsr, ks_matrix(ispin, 1)%matrix)
468 CALL dbcsr_add(k_ao_dbcsr, matrix_h(1, 1)%matrix, 1.0_dp, -1.0_dp)
473 nrow_global=nao, ncol_global=nao)
479 IF (dbg_build .AND. iw > 0)
THEN
481 WRITE (iw,
'(T4,A,ES12.4)')
'||K_AO||_F = ', sqrt(max(frob, 0.0_dp))
487 nrow_global=nao, ncol_global=nocc)
496 1.0_dp, k_fm, c_occ_fm, 0.0_dp, xi_fm)
499 IF (dbg_build .AND. iw > 0)
THEN
501 WRITE (iw,
'(T4,A,ES12.4)')
'||xi||_F = ', sqrt(max(frob, 0.0_dp))
507 nrow_global=nocc, ncol_global=nocc)
512 1.0_dp, c_occ_fm, xi_fm, 0.0_dp, m_fm)
515 IF (dbg_build .AND. iw > 0)
THEN
517 WRITE (iw,
'(T4,A,ES12.4)')
'||M||_F = ', sqrt(max(frob, 0.0_dp))
524 IF (info_chol /= 0)
THEN
526 WRITE (iw,
'(T4,A,I6)')
'ACE | Cholesky failed, info = ', info_chol
527 WRITE (iw,
'(T4,A,F20.10)')
'ACE | E_x(full) = ', ehfx_full
528 WRITE (iw,
'(T4,A,I8,A,I8)')
'ACE | nao=', nao,
' nocc=', nocc
530 cpabort(
"ACE: Cholesky of -M failed (not positive definite).")
533 IF (dbg_build .AND. iw > 0) &
534 WRITE (iw,
'(T4,A)')
'Cholesky OK (info=0).'
537 IF (
ASSOCIATED(ace_w(1, ispin)%matrix_struct)) &
540 CALL cp_fm_create(ace_w(1, ispin), xi_fm%matrix_struct, name=
"W_ACE")
544 side=
'R', uplo_tr=
'U', &
545 transpose_tr=.false., &
547 n_rows=nao, n_cols=nocc, &
553 IF (dbg_build .AND. iw > 0)
THEN
554 CALL cp_fm_trace(ace_w(1, ispin), ace_w(1, ispin), frob)
555 WRITE (iw,
'(T4,A,I4,A,2I8,A,ES12.4)') &
556 'W spin=', ispin,
' shape=', nao, nocc, &
557 ' ||W||_F=', sqrt(max(frob, 0.0_dp))
574 nrow_global=nao, ncol_global=nocc)
575 CALL cp_fm_create(c_occ_fm, fmstruct, name=
"C_occ_ref_diag")
582 nrow_global=nocc, ncol_global=nocc)
587 1.0_dp, ace_w(1, ispin), c_occ_fm, 0.0_dp, a_ref_fm)
589 ace_w_ref_norm = ace_w_ref_norm + sqrt(max(frob, 0.0_dp))
597 IF (dbg_stale .AND. iw > 0)
THEN
598 WRITE (iw,
'(/,T2,A)') repeat(
'-', 56)
599 WRITE (iw,
'(T2,A)')
'ACE DIAG A | Reference norm stored at BUILD'
600 WRITE (iw,
'(T4,A,ES12.4)') &
601 '||W^T C_occ^BUILD||_F (sum over spins) = ', ace_w_ref_norm
602 WRITE (iw,
'(T4,A)') &
603 'Staleness ratio = 1.0 at BUILD step; decreasing means W is becoming stale'
604 WRITE (iw,
'(T2,A)') repeat(
'-', 56)
607 build_succeeded = .true.
610 CALL hfx_ace_apply_projector(qs_env, ks_matrix, rho, energy, &
611 nspins, iw, ehfx_full_ref=ehfx_full)
613 CALL timestop(handle)
615 END SUBROUTINE hfx_ace_build_projector
627 SUBROUTINE hfx_ace_apply_projector(qs_env, ks_matrix, rho, energy, &
628 nspins, iw, ehfx_full_ref)
631 TYPE(
dbcsr_p_type),
DIMENSION(:, :),
POINTER :: ks_matrix
634 INTEGER,
INTENT(IN) :: nspins, iw
635 REAL(dp),
INTENT(IN),
OPTIONAL :: ehfx_full_ref
637 CHARACTER(LEN=*),
PARAMETER :: routinen =
'hfx_ace_apply_projector'
639 INTEGER :: handle, ispin, nao, nao_d, nmo_d, nocc, &
642 REAL(dp) :: ehfx_ace, frob_a, stale_norm, trace_val
646 TYPE(
cp_fm_type) :: a_diag_fm, c_occ_diag, p_fm, pw_fm
648 TYPE(
dbcsr_p_type),
DIMENSION(:),
POINTER :: ks_aux_fit, ks_aux_fit_hfx
649 TYPE(
dbcsr_p_type),
DIMENSION(:, :),
POINTER :: matrix_h, rho_ao
651 TYPE(
mo_set_type),
DIMENSION(:),
POINTER :: mos_aux_diag, mos_diag
667 CALL timeset(routinen, handle)
668 NULLIFY (blacs_env, para_env, matrix_h, rho_ao, fmstruct)
669 NULLIFY (dft_control, admm_env, ks_aux_fit, ks_aux_fit_hfx, rho_aux_fit)
670 NULLIFY (mos_diag, mos_aux_diag, mo_coeff_diag, fmstruct_diag)
671 cpassert(
ALLOCATED(ace_w))
673 CALL get_qs_env(qs_env, blacs_env=blacs_env, para_env=para_env, &
674 matrix_h_kp=matrix_h, dft_control=dft_control)
675 do_admm = dft_control%do_admm
680 matrix_ks_aux_fit=ks_aux_fit, &
681 matrix_ks_aux_fit_hfx=ks_aux_fit_hfx, &
682 rho_aux_fit=rho_aux_fit)
683 CALL qs_rho_get(rho_aux_fit, rho_ao_kp=rho_ao)
689 CALL cp_fm_get_info(ace_w(1, ispin), nrow_global=nao, ncol_global=nocc)
692 CALL dbcsr_set(ks_matrix(ispin, 1)%matrix, 0.0_dp)
693 CALL dbcsr_add(ks_matrix(ispin, 1)%matrix, &
694 matrix_h(1, 1)%matrix, 1.0_dp, 1.0_dp)
695 CALL dbcsr_set(ks_aux_fit(ispin)%matrix, 0.0_dp)
697 sparse_matrix=ks_aux_fit(ispin)%matrix, &
698 matrix_v=ace_w(1, ispin), &
701 keep_sparsity=.true.)
702 CALL dbcsr_add(ks_aux_fit_hfx(ispin)%matrix, &
703 ks_aux_fit(ispin)%matrix, 0.0_dp, 1.0_dp)
705 CALL dbcsr_set(ks_matrix(ispin, 1)%matrix, 0.0_dp)
707 sparse_matrix=ks_matrix(ispin, 1)%matrix, &
708 matrix_v=ace_w(1, ispin), &
711 keep_sparsity=.true.)
712 CALL dbcsr_add(ks_matrix(ispin, 1)%matrix, &
713 matrix_h(1, 1)%matrix, 1.0_dp, 1.0_dp)
720 CALL cp_fm_get_info(ace_w(1, ispin), nrow_global=nao, ncol_global=nocc)
724 nrow_global=nao, ncol_global=nao)
729 CALL cp_fm_create(pw_fm, ace_w(1, ispin)%matrix_struct, name=
"PW")
731 1.0_dp, p_fm, ace_w(1, ispin), 0.0_dp, pw_fm)
732 CALL cp_fm_trace(ace_w(1, ispin), pw_fm, trace_val)
733 ehfx_ace = ehfx_ace - 0.5_dp*trace_val
738 IF (dbg_energy .AND. iw > 0) &
739 WRITE (iw,
'(T4,A,I4,A,F20.10)') &
740 'ispin=', ispin,
' E_x(ACE) += ', -0.5_dp*trace_val
746 IF (dbg_energy .AND. iw > 0)
THEN
747 WRITE (iw,
'(T2,A,F20.10)')
'ACE | E_x(ACE) = ', ehfx_ace
748 IF (
PRESENT(ehfx_full_ref))
THEN
749 WRITE (iw,
'(T2,A,F20.10)')
'ACE | E_x(full) = ', ehfx_full_ref
750 WRITE (iw,
'(T2,A,ES12.4)')
'ACE | |delta| = ', abs(ehfx_ace - ehfx_full_ref)
751 WRITE (iw,
'(T2,A)')
'(|delta| should be ~0 on BUILD steps; small is good)'
770 IF (dbg_stale .AND. ace_w_ref_norm > 0.0_dp)
THEN
775 CALL cp_fm_get_info(ace_w(1, ispin), nrow_global=nao_d, ncol_global=nocc_d)
779 IF (mos_aux_diag(ispin)%use_mo_coeff_b) &
781 mos_aux_diag(ispin)%mo_coeff)
782 CALL get_mo_set(mos_aux_diag(ispin), mo_coeff=mo_coeff_diag, &
783 nao=nao_d, nmo=nmo_d, homo=nocc_d)
785 IF (mos_diag(ispin)%use_mo_coeff_b) &
787 mos_diag(ispin)%mo_coeff)
788 CALL get_mo_set(mos_diag(ispin), mo_coeff=mo_coeff_diag, &
789 nao=nao_d, nmo=nmo_d, homo=nocc_d)
792 NULLIFY (fmstruct_diag)
795 nrow_global=nao_d, ncol_global=nocc_d)
796 CALL cp_fm_create(c_occ_diag, fmstruct_diag, name=
"C_stale")
800 NULLIFY (fmstruct_diag)
803 nrow_global=nocc_d, ncol_global=nocc_d)
804 CALL cp_fm_create(a_diag_fm, fmstruct_diag, name=
"WtC_stale")
808 1.0_dp, ace_w(1, ispin), c_occ_diag, 0.0_dp, a_diag_fm)
810 stale_norm = stale_norm + sqrt(max(frob_a, 0.0_dp))
816 WRITE (iw,
'(/,T2,A)') repeat(
'-', 56)
817 WRITE (iw,
'(T2,A,I6)')
'ACE DIAG A | ace_step_counter = ', ace_step_counter
818 WRITE (iw,
'(T4,A,ES12.4)')
'||W^T C_occ^current||_F = ', stale_norm
819 WRITE (iw,
'(T4,A,ES12.4)')
'||W^T C_occ^BUILD||_F (ref) = ', ace_w_ref_norm
820 WRITE (iw,
'(T4,A,F10.6)')
'staleness ratio (1=fresh, 0=stale) = ', &
821 stale_norm/max(ace_w_ref_norm, 1.0e-30_dp)
822 WRITE (iw,
'(T2,A)') repeat(
'-', 56)
826 CALL timestop(handle)
828 END SUBROUTINE hfx_ace_apply_projector
836 INTEGER,
INTENT(IN),
OPTIONAL :: iw_opt
841 IF (
PRESENT(iw_opt)) iw = iw_opt
843 IF (
ALLOCATED(ace_w))
THEN
844 DO j = 1,
SIZE(ace_w, 2)
845 DO i = 1,
SIZE(ace_w, 1)
846 IF (
ASSOCIATED(ace_w(i, j)%matrix_struct))
CALL cp_fm_release(ace_w(i, j))
852 ace_is_built = .false.
854 ace_w_ref_norm = 0.0_dp
856 ace_dynamic_mode = .false.
858 IF (iw > 0)
WRITE (iw,
'(T2,A)')
'ACE | storage released, counters reset'
872 LOGICAL,
INTENT(IN) :: is_dynamic
874 ace_dynamic_mode = is_dynamic
901 SUBROUTINE hfx_call(qs_env, ks_matrix, rho, energy, &
902 calculate_forces, just_energy, &
903 v_rspace_new, v_tau_rspace, ext_xc_section)
906 TYPE(
dbcsr_p_type),
DIMENSION(:, :),
POINTER :: ks_matrix
909 LOGICAL,
INTENT(IN) :: calculate_forces, just_energy
910 TYPE(
pw_r3d_rs_type),
DIMENSION(:),
POINTER :: v_rspace_new, v_tau_rspace
913 IF (
PRESENT(ext_xc_section))
THEN
915 calculate_forces, just_energy, &
916 v_rspace_new, v_tau_rspace, &
917 ext_xc_section=ext_xc_section)
920 calculate_forces, just_energy, &
921 v_rspace_new, v_tau_rspace)
924 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, use_sp, 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, 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.