28 USE dbcsr_api,
ONLY: dbcsr_add,&
70 integrate_v_rspace_diagonal,&
71 integrate_v_rspace_one_center
85#include "./base/base_uses.f90"
91 LOGICAL,
PRIVATE,
PARAMETER :: debug_this_module = .true.
92 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'qs_kpp1_env_methods'
113 NULLIFY (kpp1_env%v_ao, kpp1_env%rho_set, kpp1_env%deriv_set, &
114 kpp1_env%rho_set_admm, kpp1_env%deriv_set_admm)
132 CHARACTER(len=*),
PARAMETER :: routinen =
'kpp1_calc_k_p_p1'
134 INTEGER :: excitations, handle, res_etype
135 LOGICAL :: do_excitations, do_triplet, explicit, &
139 CALL timeset(routinen, handle)
143 cpassert(
ASSOCIATED(rho1))
159 IF (.NOT. explicit)
THEN
167 CALL calc_kpp1(rho1_xc, rho1, xc_section, .true., &
168 lsd_singlets, .false., do_excitations, &
169 do_triplet, qs_env, p_env)
171 CALL timestop(handle)
190 SUBROUTINE calc_kpp1(rho1_xc, rho1, xc_section, do_tddft, lsd_singlets, lrigpw, &
191 do_excitations, do_triplet, qs_env, p_env, calc_forces, &
196 LOGICAL,
INTENT(IN) :: do_tddft, lsd_singlets, lrigpw, &
197 do_excitations, do_triplet
200 LOGICAL,
INTENT(IN),
OPTIONAL :: calc_forces, calc_virial
201 REAL(kind=
dp),
DIMENSION(3, 3),
INTENT(INOUT), &
204 CHARACTER(len=*),
PARAMETER :: routinen =
'calc_kpp1'
206 INTEGER :: handle, ikind, ispin, nkind, ns, nspins, &
208 LOGICAL :: gapw, gapw_xc, lsd, my_calc_forces
209 REAL(kind=
dp) :: alpha, energy_hartree, energy_hartree_1c
212 TYPE(dbcsr_p_type),
DIMENSION(:),
POINTER :: k1mat, rho_ao
213 TYPE(dbcsr_p_type),
DIMENSION(:, :),
POINTER :: ksmat, psmat
224 TYPE(
pw_r3d_rs_type),
DIMENSION(:),
POINTER :: rho1_r, rho1_r_pw, tau1_r, tau1_r_pw, &
225 v_rspace_new, v_xc, v_xc_tau
227 TYPE(
rho_atom_type),
DIMENSION(:),
POINTER :: rho1_atom_set, rho_atom_set
230 CALL timeset(routinen, handle)
232 NULLIFY (v_xc, rho1_g, pw_env, rho1_g_pw, tau1_r_pw)
235 cpassert(
ASSOCIATED(p_env%kpp1))
236 cpassert(
ASSOCIATED(p_env%kpp1_env))
237 cpassert(
ASSOCIATED(rho1))
239 nspins =
SIZE(p_env%kpp1)
242 my_calc_forces = .false.
243 IF (
PRESENT(calc_forces)) my_calc_forces = calc_forces
251 cpassert(
ASSOCIATED(rho1))
256 lri_density=lri_density, &
257 atomic_kind_set=atomic_kind_set)
263 cpassert(
ASSOCIATED(rho1_xc))
266 CALL kpp1_check_i_alloc(p_env%kpp1_env, qs_env, do_excitations, lsd_singlets, do_triplet)
272 cpassert(
ASSOCIATED(pw_env))
273 CALL pw_env_get(pw_env, auxbas_pw_pool=auxbas_pw_pool, &
274 poisson_env=poisson_env)
275 CALL auxbas_pw_pool%create_pw(v_hartree_rspace)
277 IF (gapw .OR. gapw_xc) &
281 CALL auxbas_pw_pool%create_pw(rho1_tot_gspace)
283 CALL pw_copy(rho1_g(1), rho1_tot_gspace)
285 CALL pw_axpy(rho1_g(ispin), rho1_tot_gspace)
288 CALL pw_axpy(p_env%local_rho_set%rho0_mpole%rho0_s_gs, rho1_tot_gspace)
295 CALL print_densities(rho1, rho1_tot_gspace, output_unit)
297 "PRINT%TOTAL_DENSITIES")
300 IF (.NOT. (nspins == 1 .AND. do_excitations .AND. do_triplet))
THEN
303 CALL auxbas_pw_pool%create_pw(v_hartree_gspace)
307 CALL pw_transfer(v_hartree_gspace, v_hartree_rspace)
308 CALL auxbas_pw_pool%give_back_pw(v_hartree_gspace)
310 CALL pw_scale(v_hartree_rspace, v_hartree_rspace%pw_grid%dvol)
313 CALL auxbas_pw_pool%give_back_pw(rho1_tot_gspace)
317 CALL qs_rho_get(rho1_xc, rho_r=rho1_r, tau_r=tau1_r)
319 CALL qs_rho_get(rho1, rho_r=rho1_r, tau_r=tau1_r)
322 IF (nspins == 1 .AND. do_excitations .AND. &
323 (lsd_singlets .OR. do_triplet))
THEN
326 ALLOCATE (rho1_r_pw(2))
328 CALL rho1_r_pw(ispin)%create(rho1_r(1)%pw_grid)
332 IF (
ASSOCIATED(tau1_r))
THEN
333 ALLOCATE (tau1_r_pw(2))
335 CALL tau1_r_pw(ispin)%create(tau1_r(1)%pw_grid)
348 CALL xc_calc_2nd_deriv(v_xc, v_xc_tau, p_env%kpp1_env%deriv_set, p_env%kpp1_env%rho_set, &
349 rho1_r_pw, rho1_g_pw, tau1_r_pw, auxbas_pw_pool, xc_section, .false., &
350 lsd_singlets=lsd_singlets, do_excitations=do_excitations, &
351 do_triplet=do_triplet, do_tddft=do_tddft, &
352 compute_virial=calc_virial, virial_xc=virial)
355 CALL pw_scale(v_xc(ispin), v_xc(ispin)%pw_grid%dvol)
358 IF (
SIZE(v_xc) /= nspins)
THEN
359 CALL auxbas_pw_pool%give_back_pw(v_xc(2))
362 IF (
ASSOCIATED(v_xc_tau))
THEN
364 CALL pw_scale(v_xc_tau(ispin), v_xc_tau(ispin)%pw_grid%dvol)
366 IF (
SIZE(v_xc_tau) /= nspins)
THEN
367 CALL auxbas_pw_pool%give_back_pw(v_xc_tau(2))
371 IF (gapw .OR. gapw_xc)
THEN
372 CALL get_qs_env(qs_env, rho_atom_set=rho_atom_set)
373 rho1_atom_set => p_env%local_rho_set%rho_atom_set
375 do_tddft=do_tddft, do_triplet=do_triplet)
378 IF (nspins == 1 .AND. do_excitations .AND. &
379 (lsd_singlets .OR. do_triplet))
THEN
380 DO ispin = 1,
SIZE(rho1_r_pw)
381 CALL rho1_r_pw(ispin)%release()
383 DEALLOCATE (rho1_r_pw)
384 IF (
ASSOCIATED(tau1_r_pw))
THEN
385 DO ispin = 1,
SIZE(tau1_r_pw)
386 CALL tau1_r_pw(ispin)%release()
388 DEALLOCATE (tau1_r_pw)
393 IF (do_excitations .AND. nspins == 1) alpha = 2.0_dp
399 CALL dbcsr_set(p_env%kpp1_env%v_ao(ispin)%matrix, 0.0_dp)
405 IF (do_excitations .AND. nspins == 1)
THEN
406 CALL integrate_v_rspace(v_rspace=v_rspace_new(ispin), &
407 pmat=rho_ao(ispin), &
408 hmat=p_env%kpp1_env%v_ao(ispin), &
410 calculate_forces=my_calc_forces, gapw=gapw_xc)
412 IF (
ASSOCIATED(v_xc_tau))
THEN
413 CALL integrate_v_rspace(v_rspace=v_xc_tau(ispin), &
414 pmat=rho_ao(ispin), &
415 hmat=p_env%kpp1_env%v_ao(ispin), &
417 compute_tau=.true., &
418 calculate_forces=my_calc_forces, gapw=gapw_xc)
422 IF (.NOT. do_triplet)
THEN
423 CALL pw_copy(v_hartree_rspace, v_rspace_new(1))
425 CALL integrate_v_rspace(v_rspace=v_rspace_new(ispin), &
426 pmat=rho_ao(ispin), &
427 hmat=p_env%kpp1_env%v_ao(ispin), &
429 calculate_forces=my_calc_forces, gapw=gapw)
432 CALL integrate_v_rspace(v_rspace=v_rspace_new(ispin), &
433 pmat=rho_ao(ispin), &
434 hmat=p_env%kpp1_env%v_ao(ispin), &
436 calculate_forces=my_calc_forces, gapw=gapw_xc)
438 IF (
ASSOCIATED(v_xc_tau))
THEN
439 CALL integrate_v_rspace(v_rspace=v_xc_tau(ispin), &
440 pmat=rho_ao(ispin), &
441 hmat=p_env%kpp1_env%v_ao(ispin), &
443 compute_tau=.true., &
444 calculate_forces=my_calc_forces, gapw=gapw_xc)
447 CALL pw_copy(v_hartree_rspace, v_rspace_new(ispin))
448 CALL integrate_v_rspace(v_rspace=v_rspace_new(ispin), &
449 pmat=rho_ao(ispin), &
450 hmat=p_env%kpp1_env%v_ao(ispin), &
452 calculate_forces=my_calc_forces, gapw=gapw)
457 IF (do_excitations .AND. nspins == 1)
THEN
460 IF (.NOT. do_triplet)
THEN
461 CALL pw_axpy(v_hartree_rspace, v_rspace_new(1))
464 CALL pw_axpy(v_hartree_rspace, v_rspace_new(ispin))
468 IF (
ASSOCIATED(v_xc_tau)) cpabort(
"Meta-GGA functionals not supported with LRI!")
470 lri_v_int => lri_density%lri_coefs(ispin)%lri_kinds
473 lri_v_int(ikind)%v_int = 0.0_dp
475 CALL integrate_v_rspace_one_center(v_rspace_new(ispin), qs_env, &
476 lri_v_int, .false.,
"LRI_AUX")
478 CALL para_env%sum(lri_v_int(ikind)%v_int)
481 k1mat(1)%matrix => p_env%kpp1_env%v_ao(ispin)%matrix
482 IF (lri_env%exact_1c_terms)
THEN
483 CALL integrate_v_rspace_diagonal(v_rspace_new(ispin), k1mat(1)%matrix, &
484 rho_ao(ispin)%matrix, qs_env, my_calc_forces,
"ORB")
489 CALL integrate_v_rspace(v_rspace=v_rspace_new(ispin), &
490 pmat=rho_ao(ispin), &
491 hmat=p_env%kpp1_env%v_ao(ispin), &
493 calculate_forces=my_calc_forces, gapw=gapw)
495 IF (
ASSOCIATED(v_xc_tau))
THEN
496 CALL integrate_v_rspace(v_rspace=v_xc_tau(ispin), &
497 pmat=rho_ao(ispin), &
498 hmat=p_env%kpp1_env%v_ao(ispin), &
500 compute_tau=.true., &
501 calculate_forces=my_calc_forces, gapw=gapw)
506 CALL dbcsr_add(p_env%kpp1(ispin)%matrix, p_env%kpp1_env%v_ao(ispin)%matrix, 1.0_dp, alpha)
510 IF (.NOT. (do_excitations .AND. nspins == 1 .AND. do_triplet))
THEN
512 p_env%hartree_local%ecoul_1c, &
513 p_env%local_rho_set, &
514 para_env, tddft=.true., core_2nd=.true.)
516 calculate_forces=my_calc_forces, &
517 local_rho_set=p_env%local_rho_set)
521 ns =
SIZE(p_env%kpp1)
522 ksmat(1:ns, 1:1) => p_env%kpp1(1:ns)
524 psmat(1:ns, 1:1) => rho_ao(1:ns)
525 CALL update_ks_atom(qs_env, ksmat, psmat, forces=my_calc_forces, tddft=.true., &
526 rho_atom_external=p_env%local_rho_set%rho_atom_set)
527 ELSEIF (gapw_xc)
THEN
528 ns =
SIZE(p_env%kpp1)
529 ksmat(1:ns, 1:1) => p_env%kpp1(1:ns)
531 psmat(1:ns, 1:1) => rho_ao(1:ns)
532 CALL update_ks_atom(qs_env, ksmat, psmat, forces=my_calc_forces, tddft=.true., &
533 rho_atom_external=p_env%local_rho_set%rho_atom_set)
536 CALL auxbas_pw_pool%give_back_pw(v_hartree_rspace)
537 DO ispin = 1,
SIZE(v_rspace_new)
538 CALL auxbas_pw_pool%give_back_pw(v_rspace_new(ispin))
540 DEALLOCATE (v_rspace_new)
541 IF (
ASSOCIATED(v_xc_tau))
THEN
542 DO ispin = 1,
SIZE(v_xc_tau)
543 CALL auxbas_pw_pool%give_back_pw(v_xc_tau(ispin))
545 DEALLOCATE (v_xc_tau)
548 CALL timestop(handle)
570 TYPE(qs_environment_type),
POINTER :: qs_env
571 TYPE(dbcsr_p_type),
DIMENSION(:),
POINTER :: k_p_p1
572 TYPE(qs_rho_type),
POINTER :: rho, rho1
573 REAL(kind=dp),
INTENT(in),
OPTIONAL :: diff
575 INTEGER :: ispin, nspins
576 REAL(kind=dp) :: my_diff
577 TYPE(dbcsr_p_type),
DIMENSION(:),
POINTER :: ks_2, matrix_s, rho1_ao, rho_ao
578 TYPE(pw_c1d_gs_type),
DIMENSION(:),
POINTER :: rho1_g, rho_g
579 TYPE(pw_r3d_rs_type),
DIMENSION(:),
POINTER :: rho1_r, rho_r
580 TYPE(qs_energy_type),
POINTER ::
qs_energy
582 NULLIFY (ks_2, matrix_s,
qs_energy, rho_ao, rho1_ao, rho_r, rho1_r, rho_g, rho1_g)
583 nspins =
SIZE(k_p_p1)
585 IF (
PRESENT(diff)) my_diff = diff
588 CALL qs_rho_get(rho, rho_ao=rho_ao, rho_r=rho_r, rho_g=rho_g)
589 CALL qs_rho_get(rho1, rho_ao=rho1_ao, rho_r=rho1_r, rho_g=rho1_g)
590 CALL get_qs_env(qs_env, matrix_s=matrix_s)
593 my_diff = my_diff/2.0_dp
594 DO ispin = 1,
SIZE(k_p_p1)
595 CALL dbcsr_add(rho_ao(ispin)%matrix, rho1_ao(ispin)%matrix, &
596 alpha_scalar=1.0_dp, beta_scalar=my_diff)
597 CALL pw_axpy(rho1_r(ispin), rho_r(ispin), my_diff)
598 CALL pw_axpy(rho1_g(ispin), rho_g(ispin), my_diff)
601 CALL qs_ks_build_kohn_sham_matrix(qs_env, &
602 ext_ks_matrix=k_p_p1, &
603 calculate_forces=.false., &
606 CALL dbcsr_allocate_matrix_set(ks_2, nspins)
608 ALLOCATE (ks_2(ispin)%matrix)
609 CALL dbcsr_copy(ks_2(ispin)%matrix, matrix_s(1)%matrix, &
610 name=
"tmp_ks2-"//adjustl(cp_to_string(ispin)))
614 my_diff = -2.0_dp*my_diff
616 CALL dbcsr_add(rho_ao(ispin)%matrix, rho1_ao(ispin)%matrix, &
617 alpha_scalar=1.0_dp, beta_scalar=my_diff)
618 CALL pw_axpy(rho1_r(ispin), rho_r(ispin), my_diff)
619 CALL pw_axpy(rho1_g(ispin), rho_g(ispin), my_diff)
622 CALL qs_ks_build_kohn_sham_matrix(qs_env, &
623 ext_ks_matrix=ks_2, &
624 calculate_forces=.false., &
628 my_diff = -0.5_dp*my_diff
630 CALL dbcsr_add(rho_ao(ispin)%matrix, rho1_ao(ispin)%matrix, &
631 alpha_scalar=1.0_dp, beta_scalar=my_diff)
632 CALL pw_axpy(rho1_r(ispin), rho_r(ispin), my_diff)
633 CALL pw_axpy(rho1_g(ispin), rho_g(ispin), my_diff)
638 CALL dbcsr_add(k_p_p1(ispin)%matrix, ks_2(ispin)%matrix, &
639 alpha_scalar=1.0_dp, beta_scalar=-1.0_dp)
640 CALL dbcsr_scale(k_p_p1(ispin)%matrix, alpha_scalar=0.5_dp/my_diff)
643 CALL dbcsr_deallocate_matrix_set(ks_2)
660 TYPE(qs_kpp1_env_type) :: kpp1_env
661 TYPE(qs_environment_type),
INTENT(IN),
POINTER :: qs_env
662 LOGICAL,
INTENT(IN) :: do_excitations, lsd_singlets, do_triplet
664 INTEGER :: ispin, nspins
665 TYPE(admm_type),
POINTER :: admm_env
666 TYPE(dbcsr_p_type),
DIMENSION(:),
POINTER :: matrix_s
667 TYPE(dft_control_type),
POINTER :: dft_control
668 TYPE(pw_env_type),
POINTER :: pw_env
669 TYPE(pw_pool_type),
POINTER :: auxbas_pw_pool
670 TYPE(pw_r3d_rs_type),
DIMENSION(:),
POINTER :: my_rho_r, my_tau_r, rho_r, tau_r
671 TYPE(qs_rho_type),
POINTER :: rho
672 TYPE(section_vals_type),
POINTER :: admm_xc_section, input, xc_section
676 NULLIFY (pw_env, auxbas_pw_pool, matrix_s, rho, rho_r, admm_env, dft_control, my_rho_r, my_tau_r)
678 CALL get_qs_env(qs_env, pw_env=pw_env, &
679 matrix_s=matrix_s, rho=rho, input=input, &
680 admm_env=admm_env, dft_control=dft_control)
682 CALL qs_rho_get(rho, rho_r=rho_r, tau_r=tau_r)
685 CALL pw_env_get(pw_env, auxbas_pw_pool=auxbas_pw_pool)
687 IF (.NOT.
ASSOCIATED(kpp1_env%v_ao))
THEN
688 CALL dbcsr_allocate_matrix_set(kpp1_env%v_ao, nspins)
690 ALLOCATE (kpp1_env%v_ao(ispin)%matrix)
691 CALL dbcsr_copy(kpp1_env%v_ao(ispin)%matrix, matrix_s(1)%matrix, &
692 name=
"kpp1%v_ao-"//adjustl(cp_to_string(ispin)))
696 IF (.NOT.
ASSOCIATED(kpp1_env%deriv_set))
THEN
698 IF (nspins == 1 .AND. (do_excitations .AND. &
699 (lsd_singlets .OR. do_triplet)))
THEN
700 ALLOCATE (my_rho_r(2))
702 CALL auxbas_pw_pool%create_pw(my_rho_r(ispin))
703 CALL pw_axpy(rho_r(1), my_rho_r(ispin), 0.5_dp, 0.0_dp)
705 IF (dft_control%use_kinetic_energy_density)
THEN
706 ALLOCATE (my_tau_r(2))
708 CALL auxbas_pw_pool%create_pw(my_tau_r(ispin))
709 CALL pw_axpy(tau_r(1), my_tau_r(ispin), 0.5_dp, 0.0_dp)
714 IF (dft_control%use_kinetic_energy_density)
THEN
719 IF (dft_control%do_admm)
THEN
720 xc_section => admm_env%xc_section_primary
722 xc_section => section_vals_get_subs_vals(input,
"DFT%XC")
725 ALLOCATE (kpp1_env%deriv_set, kpp1_env%rho_set)
726 CALL xc_prep_2nd_deriv(kpp1_env%deriv_set, kpp1_env%rho_set, &
727 my_rho_r, auxbas_pw_pool, &
728 xc_section=xc_section, tau_r=my_tau_r)
730 IF (nspins == 1 .AND. (do_excitations .AND. &
731 (lsd_singlets .OR. do_triplet)))
THEN
732 DO ispin = 1,
SIZE(my_rho_r)
733 CALL my_rho_r(ispin)%release()
735 DEALLOCATE (my_rho_r)
736 IF (
ASSOCIATED(my_tau_r))
THEN
737 DO ispin = 1,
SIZE(my_tau_r)
738 CALL my_tau_r(ispin)%release()
740 DEALLOCATE (my_tau_r)
746 IF (dft_control%do_admm)
THEN
747 IF (admm_env%aux_exch_func /= do_admm_aux_exch_func_none)
THEN
748 IF (.NOT.
ASSOCIATED(kpp1_env%deriv_set_admm))
THEN
749 cpassert(.NOT. do_triplet)
750 admm_xc_section => admm_env%xc_section_aux
751 CALL get_admm_env(qs_env%admm_env, rho_aux_fit=rho)
752 CALL qs_rho_get(rho, rho_r=rho_r)
753 ALLOCATE (kpp1_env%deriv_set_admm, kpp1_env%rho_set_admm)
754 CALL xc_prep_2nd_deriv(kpp1_env%deriv_set_admm, kpp1_env%rho_set_admm, &
755 rho_r, auxbas_pw_pool, &
756 xc_section=admm_xc_section)
771 TYPE(qs_kpp1_env_type) :: kpp1_env
773 IF (
ASSOCIATED(kpp1_env%deriv_set))
THEN
774 CALL xc_dset_release(kpp1_env%deriv_set)
775 DEALLOCATE (kpp1_env%deriv_set)
776 NULLIFY (kpp1_env%deriv_set)
778 IF (
ASSOCIATED(kpp1_env%rho_set))
THEN
779 CALL xc_rho_set_release(kpp1_env%rho_set)
780 DEALLOCATE (kpp1_env%rho_set)
791 SUBROUTINE print_densities(rho1, rho1_tot_gspace, out_unit)
793 TYPE(qs_rho_type),
POINTER :: rho1
794 TYPE(pw_c1d_gs_type),
INTENT(IN) :: rho1_tot_gspace
797 REAL(kind=dp) :: total_rho_gspace
798 REAL(kind=dp),
DIMENSION(:),
POINTER :: tot_rho1_r
802 total_rho_gspace = pw_integrate_function(rho1_tot_gspace, isign=-1)
803 IF (out_unit > 0)
THEN
804 CALL qs_rho_get(rho1, tot_rho_r=tot_rho1_r)
805 WRITE (unit=out_unit, fmt=
"(T3,A,T60,F20.10)") &
806 "KPP1 total charge density (r-space):", &
807 accurate_sum(tot_rho1_r), &
808 "KPP1 total charge density (g-space):", &
812 END SUBROUTINE print_densities
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.
Define the atomic kind types and their sub types.
Defines control structures, which contain the parameters and the settings for the DFT-based calculati...
DBCSR operations in CP2K.
various routines to log and control the output. The idea is that decisions about where to log should ...
type(cp_logger_type) function, pointer, public cp_get_default_logger()
returns the default logger
routines to handle the output, The idea is to remove the decision of wheter to output and what to out...
integer function, public cp_print_key_unit_nr(logger, basis_section, print_key_path, extension, middle_name, local, log_filename, ignore_should_output, file_form, file_position, file_action, file_status, do_backup, on_file, is_new_file, mpi_io, fout)
...
subroutine, public cp_print_key_finished_output(unit_nr, logger, basis_section, print_key_path, local, ignore_should_output, on_file, mpi_io)
should be called after you finish working with a unit obtained with cp_print_key_unit_nr,...
integer function, public cp_print_key_should_output(iteration_info, basis_section, print_key_path, used_print_key, first_time)
returns what should be done with the given property if btest(res,cp_p_store) then the property should...
subroutine, public vh_1c_gg_integrals(qs_env, energy_hartree_1c, ecoul_1c, local_rho_set, para_env, tddft, local_rho_set_2nd, core_2nd)
Calculates one center GAPW Hartree energies and matrix elements Hartree potentials are input Takes po...
sums arrays of real/complex numbers with much reduced round-off as compared to a naive implementation...
Defines the basic variable types.
integer, parameter, public dp
contains the types and subroutines for dealing with the lri_env lri : local resolution of the identit...
routines that build the Kohn-Sham matrix for the LRIGPW and xc parts
subroutine, public calculate_lri_ks_matrix(lri_env, lri_v_int, h_matrix, atomic_kind_set, cell_to_index)
update of LRIGPW KS matrix
Interface to the message passing library MPI.
container for various plainwaves related things
subroutine, public pw_env_get(pw_env, pw_pools, cube_info, gridlevel_info, auxbas_pw_pool, auxbas_grid, auxbas_rs_desc, auxbas_rs_grid, rs_descs, rs_grids, xc_pw_pool, vdw_pw_pool, poisson_env, interp_section)
returns the various attributes of the pw env
functions related to the poisson solver on regular grids
Manages a pool of grids (to be used for example as tmp objects), but can also be used to instantiate ...
subroutine, public deallocate_qs_energy(qs_energy)
Deallocate a Quickstep energy data structure.
subroutine, public allocate_qs_energy(qs_energy)
Allocate and/or initialise a Quickstep energy data structure.
Perform a QUICKSTEP wavefunction optimization (single point)
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, 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_nonbond, sab_almo, sab_kp, sab_kp_nosym, 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, 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, ecoul_1c, rho0_s_rs, rho0_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, 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, rhs)
Get the QUICKSTEP environment.
subroutine, public prepare_gapw_den(qs_env, local_rho_set, do_rho0, kind_set_external)
...
Integrate single or product functions over a potential on a RS grid.
module that builds the second order perturbation kernel kpp1 = delta_rho|_P delta_rho|_P E drho(P1) d...
subroutine, public kpp1_calc_k_p_p1(p_env, qs_env, rho1, rho1_xc)
calculates the k_p_p1 kernel of the perturbation theory
subroutine, public kpp1_create(kpp1_env)
allocates and initializes a kpp1_env
subroutine, public kpp1_calc_k_p_p1_fdiff(qs_env, k_p_p1, rho, rho1, diff)
calcualtes the k_p_p1 kernel of the perturbation theory with finite differences
subroutine, public kpp1_did_change(kpp1_env)
function to advise of changes either in the grids
subroutine, public calc_kpp1(rho1_xc, rho1, xc_section, do_tddft, lsd_singlets, lrigpw, do_excitations, do_triplet, qs_env, p_env, calc_forces, calc_virial, virial)
...
subroutine, public kpp1_check_i_alloc(kpp1_env, qs_env, do_excitations, lsd_singlets, do_triplet)
checks that the intenal storage is allocated, and allocs it if needed
basis types for the calculation of the perturbation of density theory.
routines that build the Kohn-Sham matrix contributions coming from local atomic densities
subroutine, public update_ks_atom(qs_env, ksmat, pmat, forces, tddft, rho_atom_external, kind_set_external, oce_external, sab_external, kscale, kintegral, kforce, fscale)
The correction to the KS matrix due to the GAPW local terms to the hartree and XC contributions is he...
routines that build the Kohn-Sham matrix (i.e calculate the coulomb and xc parts
subroutine, public qs_ks_build_kohn_sham_matrix(qs_env, calculate_forces, just_energy, print_active, ext_ks_matrix)
routine where the real calculations are made: the KS matrix is calculated
basis types for the calculation of the perturbation of density theory.
subroutine, public integrate_vhg0_rspace(qs_env, v_rspace, para_env, calculate_forces, local_rho_set, local_rho_set_2nd, atener, kforce)
...
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...
routines that build the integrals of the Vxc potential calculated for the atomic density in the basis...
subroutine, public calculate_xc_2nd_deriv_atom(rho_atom_set, rho1_atom_set, qs_env, xc_section, para_env, do_tddft, do_tddfpt2, do_triplet, kind_set_external)
...
represent a group ofunctional derivatives
subroutine, public xc_dset_release(derivative_set)
releases a derivative set
subroutine, public xc_rho_set_release(rho_set, pw_pool)
releases the given rho_set
Exchange and Correlation functional calculations.
subroutine, public xc_calc_2nd_deriv(v_xc, v_xc_tau, deriv_set, rho_set, rho1_r, rho1_g, tau1_r, pw_pool, xc_section, gapw, vxg, lsd_singlets, do_excitations, do_triplet, do_tddft, compute_virial, virial_xc)
Caller routine to calculate the second order potential in the direction of rho1_r.
subroutine, public xc_prep_2nd_deriv(deriv_set, rho_set, rho_r, pw_pool, xc_section, tau_r)
Prepare objects for the calculation of the 2nd derivatives of the density functional....
stores some data used in wavefunction fitting
Provides all information about an atomic kind.
type of a logger, at the moment it contains just a print level starting at which level it should be l...
stores all the informations relevant to an mpi environment
contained for different pw related things
environment for the poisson solver
Manages a pool of grids (to be used for example as tmp objects), but can also be used to instantiate ...
environment that keeps the informations and temporary val to build the kpp1 kernel matrix
Represent a qs system that is perturbed. Can calculate the linear operator and the rhs of the system ...
keeps the density in various representations, keeping track of which ones are valid.