78 integrate_v_rspace_diagonal,&
79 integrate_v_rspace_one_center
107#include "./base/base_uses.f90"
119 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'qs_linres_kernel'
136 TYPE(
cp_fm_type),
DIMENSION(:),
INTENT(IN) :: c0
137 TYPE(
cp_fm_type),
DIMENSION(:),
INTENT(INOUT) :: av
139 INTEGER :: ispin, ncol
142 CALL get_qs_env(qs_env=qs_env, dft_control=dft_control)
143 IF (dft_control%qs_control%semi_empirical)
THEN
144 cpabort(
"Linear response not available with SE methods")
145 ELSEIF (dft_control%qs_control%dftb)
THEN
146 cpabort(
"Linear response not available with DFTB")
147 ELSEIF (dft_control%qs_control%xtb)
THEN
148 CALL apply_op_2_xtb(qs_env, p_env)
150 CALL apply_op_2_dft(qs_env, p_env)
156 DO ispin = 1,
SIZE(c0)
161 ncol=ncol, alpha=1.0_dp, beta=1.0_dp)
171 SUBROUTINE apply_op_2_dft(qs_env, p_env)
175 CHARACTER(len=*),
PARAMETER :: routinen =
'apply_op_2_dft'
177 INTEGER :: handle, ikind, ispin, nkind, ns, nspins
178 LOGICAL :: deriv2_analytic, gapw, gapw_xc, &
180 REAL(kind=
dp) :: alpha, ekin_mol, energy_hartree, &
185 TYPE(
dbcsr_p_type),
DIMENSION(:),
POINTER :: k1mat, matrix_s, rho1_ao, rho_ao
186 TYPE(
dbcsr_p_type),
DIMENSION(:, :),
POINTER :: ksmat, psmat
200 TYPE(
pw_r3d_rs_type),
DIMENSION(:),
POINTER :: rho1_r, rho_r, tau1_r, v_rspace_new, &
204 TYPE(
qs_rho_type),
POINTER :: rho, rho0, rho1, rho1_xc, rho1a, &
206 TYPE(
rho_atom_type),
DIMENSION(:),
POINTER :: rho1_atom_set, rho_atom_set
209 CALL timeset(routinen, handle)
211 NULLIFY (auxbas_pw_pool, pw_env, v_rspace_new, para_env, rho1_r, &
212 v_xc, rho1_ao, rho_ao, poisson_env, input, rho, dft_control, &
213 logger, rho1_g, v_xc_tau)
216 energy_hartree = 0.0_dp
217 energy_hartree_1c = 0.0_dp
219 cpassert(
ASSOCIATED(p_env%kpp1))
220 cpassert(
ASSOCIATED(p_env%kpp1_env))
221 kpp1_env => p_env%kpp1_env
231 linres_control=linres_control, &
232 dft_control=dft_control)
234 gapw = dft_control%qs_control%gapw
235 gapw_xc = dft_control%qs_control%gapw_xc
236 lr_triplet = linres_control%lr_triplet
239 rho1_xc => p_env%rho1_xc
240 cpassert(
ASSOCIATED(rho1))
242 cpassert(
ASSOCIATED(rho1_xc))
245 CALL qs_rho_get(rho, rho_ao=rho_ao, rho_r=rho_r)
246 CALL pw_env_get(pw_env, auxbas_pw_pool=auxbas_pw_pool)
248 nspins =
SIZE(p_env%kpp1)
249 lrigpw = dft_control%qs_control%lrigpw
253 lri_density=lri_density, &
254 atomic_kind_set=atomic_kind_set)
257 IF (.NOT.
ASSOCIATED(kpp1_env%v_ao))
THEN
261 ALLOCATE (kpp1_env%v_ao(ispin)%matrix)
262 CALL dbcsr_copy(kpp1_env%v_ao(ispin)%matrix, matrix_s(1)%matrix, &
267 IF (dft_control%do_admm)
THEN
268 xc_section => admm_env%xc_section_primary
274 cpassert(
ASSOCIATED(pw_env))
275 CALL pw_env_get(pw_env, auxbas_pw_pool=auxbas_pw_pool, &
276 poisson_env=poisson_env)
277 CALL auxbas_pw_pool%create_pw(v_hartree_gspace)
278 CALL auxbas_pw_pool%create_pw(v_hartree_rspace)
280 IF (gapw .OR. gapw_xc) &
284 CALL auxbas_pw_pool%create_pw(rho1_tot_gspace)
287 CALL pw_copy(rho1_g(1), rho1_tot_gspace)
289 CALL pw_axpy(rho1_g(ispin), rho1_tot_gspace)
292 CALL pw_axpy(p_env%local_rho_set%rho0_mpole%rho0_s_gs, rho1_tot_gspace)
293 IF (
ASSOCIATED(p_env%local_rho_set%rho0_mpole%rhoz_cneo_s_gs))
THEN
294 CALL pw_axpy(p_env%local_rho_set%rho0_mpole%rhoz_cneo_s_gs, rho1_tot_gspace)
298 IF (.NOT. (nspins == 1 .AND. lr_triplet))
THEN
302 CALL pw_transfer(v_hartree_gspace, v_hartree_rspace)
305 CALL auxbas_pw_pool%give_back_pw(rho1_tot_gspace)
319 IF (deriv2_analytic)
THEN
320 CALL qs_rho_get(rho1a, rho_r=rho1_r, tau_r=tau1_r)
321 CALL qs_fxc_analytic(rho0, rho1_r, tau1_r, xc_section, auxbas_pw_pool, lr_triplet, v_xc, v_xc_tau)
322 IF (gapw .OR. gapw_xc)
THEN
323 CALL get_qs_env(qs_env, rho_atom_set=rho_atom_set)
324 rho1_atom_set => p_env%local_rho_set%rho_atom_set
326 do_triplet=lr_triplet)
329 CALL qs_fxc_fdiff(ks_env, rho0, rho1a, xc_section, 6, lr_triplet, v_xc, v_xc_tau)
330 cpassert((.NOT. gapw) .AND. (.NOT. gapw_xc))
336 CALL pw_scale(v_hartree_rspace, v_hartree_rspace%pw_grid%dvol)
338 CALL pw_scale(v_rspace_new(ispin), v_rspace_new(ispin)%pw_grid%dvol)
339 IF (
ASSOCIATED(v_xc_tau))
CALL pw_scale(v_xc_tau(ispin), v_xc_tau(ispin)%pw_grid%dvol)
343 IF (dft_control%do_admm)
THEN
345 IF (.NOT.
ASSOCIATED(kpp1_env%deriv_set_admm))
THEN
346 cpassert(.NOT. lr_triplet)
347 xc_section_aux => admm_env%xc_section_aux
350 ALLOCATE (kpp1_env%deriv_set_admm, kpp1_env%rho_set_admm)
352 rho_r, auxbas_pw_pool, &
353 xc_section=xc_section_aux)
362 CALL dbcsr_set(kpp1_env%v_ao(ispin)%matrix, 0.0_dp)
368 IF (nspins == 1)
THEN
370 IF (.NOT. (lr_triplet))
THEN
371 CALL pw_scale(v_rspace_new(1), 2.0_dp)
372 IF (
ASSOCIATED(v_xc_tau))
CALL pw_scale(v_xc_tau(1), 2.0_dp)
376 CALL integrate_v_rspace(v_rspace=v_rspace_new(ispin), &
377 pmat=rho1_ao(ispin), &
378 hmat=kpp1_env%v_ao(ispin), &
380 calculate_forces=.false., gapw=gapw_xc)
382 IF (
ASSOCIATED(v_xc_tau))
THEN
383 CALL integrate_v_rspace(v_rspace=v_xc_tau(ispin), &
384 pmat=rho1_ao(ispin), &
385 hmat=kpp1_env%v_ao(ispin), &
387 compute_tau=.true., &
388 calculate_forces=.false., gapw=gapw_xc)
392 IF (.NOT. lr_triplet)
THEN
393 CALL pw_axpy(v_hartree_rspace, v_rspace_new(1), 2.0_dp, 0.0_dp)
395 CALL integrate_v_rspace(v_rspace=v_rspace_new(ispin), &
396 pmat=rho_ao(ispin), &
397 hmat=kpp1_env%v_ao(ispin), &
399 calculate_forces=.false., gapw=gapw)
403 CALL integrate_v_rspace(v_rspace=v_rspace_new(ispin), &
404 pmat=rho_ao(ispin), &
405 hmat=kpp1_env%v_ao(ispin), &
407 calculate_forces=.false., gapw=gapw_xc)
409 IF (
ASSOCIATED(v_xc_tau))
THEN
410 CALL integrate_v_rspace(v_rspace=v_xc_tau(ispin), &
411 pmat=rho_ao(ispin), &
412 hmat=kpp1_env%v_ao(ispin), &
414 compute_tau=.true., &
415 calculate_forces=.false., gapw=gapw_xc)
418 CALL pw_copy(v_hartree_rspace, v_rspace_new(ispin))
419 CALL integrate_v_rspace(v_rspace=v_rspace_new(ispin), &
420 pmat=rho_ao(ispin), &
421 hmat=kpp1_env%v_ao(ispin), &
423 calculate_forces=.false., gapw=gapw)
428 IF (nspins == 1)
THEN
429 IF (.NOT. (lr_triplet))
THEN
430 CALL pw_scale(v_rspace_new(1), 2.0_dp)
431 IF (
ASSOCIATED(v_xc_tau))
CALL pw_scale(v_xc_tau(1), 2.0_dp)
435 IF (.NOT. lr_triplet)
THEN
436 CALL pw_axpy(v_hartree_rspace, v_rspace_new(1), 2.0_dp)
439 CALL pw_axpy(v_hartree_rspace, v_rspace_new(ispin), 1.0_dp)
443 IF (
ASSOCIATED(v_xc_tau)) &
444 cpabort(
"metaGGA-functionals not supported with LRI!")
446 lri_v_int => lri_density%lri_coefs(ispin)%lri_kinds
449 lri_v_int(ikind)%v_int = 0.0_dp
451 CALL integrate_v_rspace_one_center(v_rspace_new(ispin), qs_env, &
452 lri_v_int, .false.,
"LRI_AUX")
454 CALL para_env%sum(lri_v_int(ikind)%v_int)
457 k1mat(1)%matrix => kpp1_env%v_ao(ispin)%matrix
458 IF (lri_env%exact_1c_terms)
THEN
459 CALL integrate_v_rspace_diagonal(v_rspace_new(ispin), k1mat(1)%matrix, &
460 rho_ao(ispin)%matrix, qs_env, .false.,
"ORB")
465 CALL integrate_v_rspace(v_rspace=v_rspace_new(ispin), &
466 pmat=rho_ao(ispin), &
467 hmat=kpp1_env%v_ao(ispin), &
469 calculate_forces=.false., gapw=gapw)
471 IF (
ASSOCIATED(v_xc_tau))
THEN
472 CALL integrate_v_rspace(v_rspace=v_xc_tau(ispin), &
473 pmat=rho_ao(ispin), &
474 hmat=kpp1_env%v_ao(ispin), &
476 compute_tau=.true., &
477 calculate_forces=.false., gapw=gapw)
483 CALL dbcsr_copy(p_env%kpp1(ispin)%matrix, kpp1_env%v_ao(ispin)%matrix)
487 IF (.NOT. ((nspins == 1 .AND. lr_triplet)))
THEN
489 p_env%hartree_local%ecoul_1c, &
490 p_env%local_rho_set, &
491 para_env, tddft=.true., core_2nd=.true.)
494 calculate_forces=.false., &
495 local_rho_set=p_env%local_rho_set)
499 ns =
SIZE(p_env%kpp1)
500 ksmat(1:ns, 1:1) => p_env%kpp1(1:ns)
502 psmat(1:ns, 1:1) => rho_ao(1:ns)
503 CALL update_ks_atom(qs_env, ksmat, psmat, forces=.false., tddft=.true., &
504 rho_atom_external=p_env%local_rho_set%rho_atom_set)
505 ELSEIF (gapw_xc)
THEN
506 ns =
SIZE(p_env%kpp1)
507 ksmat(1:ns, 1:1) => p_env%kpp1(1:ns)
509 psmat(1:ns, 1:1) => rho_ao(1:ns)
510 CALL update_ks_atom(qs_env, ksmat, psmat, forces=.false., tddft=.true., &
511 rho_atom_external=p_env%local_rho_set%rho_atom_set)
515 IF (dft_control%qs_control%do_kg .AND. .NOT. (lr_triplet .OR. gapw .OR. gapw_xc))
THEN
524 ks_matrix=p_env%kpp1, &
526 calc_force=.false., &
532 CALL auxbas_pw_pool%give_back_pw(v_hartree_gspace)
533 CALL auxbas_pw_pool%give_back_pw(v_hartree_rspace)
535 CALL auxbas_pw_pool%give_back_pw(v_rspace_new(ispin))
537 DEALLOCATE (v_rspace_new)
538 IF (
ASSOCIATED(v_xc_tau))
THEN
540 CALL auxbas_pw_pool%give_back_pw(v_xc_tau(ispin))
542 DEALLOCATE (v_xc_tau)
545 CALL timestop(handle)
547 END SUBROUTINE apply_op_2_dft
554 SUBROUTINE apply_op_2_xtb(qs_env, p_env)
558 CHARACTER(len=*),
PARAMETER :: routinen =
'apply_op_2_xtb'
560 INTEGER :: atom_a, handle, iatom, ikind, is, ispin, &
561 na, natom, natorb, nkind, ns, nsgf, &
563 INTEGER,
DIMENSION(25) :: lao
564 INTEGER,
DIMENSION(5) :: occ
565 LOGICAL :: lr_triplet
566 REAL(
dp),
ALLOCATABLE,
DIMENSION(:) :: mcharge, mcharge1
567 REAL(
dp),
ALLOCATABLE,
DIMENSION(:, :) :: aocg, aocg1, charges, charges1
570 TYPE(
dbcsr_p_type),
DIMENSION(:, :),
POINTER :: matrix_p, matrix_p1, matrix_s
576 TYPE(
qs_kind_type),
DIMENSION(:),
POINTER :: qs_kind_set
581 CALL timeset(routinen, handle)
583 cpassert(
ASSOCIATED(p_env%kpp1_env))
584 cpassert(
ASSOCIATED(p_env%kpp1))
585 kpp1_env => p_env%kpp1_env
588 cpassert(
ASSOCIATED(rho1))
594 linres_control=linres_control, &
595 dft_control=dft_control)
599 lr_triplet = linres_control%lr_triplet
600 cpassert(.NOT. lr_triplet)
602 nspins =
SIZE(p_env%kpp1)
605 CALL dbcsr_set(p_env%kpp1(ispin)%matrix, 0.0_dp)
608 IF (dft_control%qs_control%xtb_control%coulomb_interaction)
THEN
610 CALL get_qs_env(qs_env, particle_set=particle_set, matrix_s_kp=matrix_s)
611 natom =
SIZE(particle_set)
614 ALLOCATE (mcharge(natom), charges(natom, 5))
615 ALLOCATE (mcharge1(natom), charges1(natom, 5))
618 CALL get_qs_env(qs_env, atomic_kind_set=atomic_kind_set, qs_kind_set=qs_kind_set)
619 nkind =
SIZE(atomic_kind_set)
621 ALLOCATE (aocg(nsgf, natom))
623 ALLOCATE (aocg1(nsgf, natom))
625 CALL ao_charges(matrix_p, matrix_s, aocg, para_env)
626 CALL ao_charges(matrix_p1, matrix_s, aocg1, para_env)
629 CALL get_qs_kind(qs_kind_set(ikind), xtb_parameter=xtb_kind)
632 atom_a = atomic_kind_set(ikind)%atom_list(iatom)
633 charges(atom_a, :) = real(occ(:), kind=
dp)
636 charges(atom_a, ns) = charges(atom_a, ns) - aocg(is, atom_a)
637 charges1(atom_a, ns) = charges1(atom_a, ns) - aocg1(is, atom_a)
641 DEALLOCATE (aocg, aocg1)
643 mcharge(iatom) = sum(charges(iatom, :))
644 mcharge1(iatom) = sum(charges1(iatom, :))
649 DEALLOCATE (charges, mcharge, charges1, mcharge1)
652 CALL timestop(handle)
654 END SUBROUTINE apply_op_2_xtb
667 CHARACTER(LEN=*),
PARAMETER :: routinen =
'apply_hfx'
669 INTEGER :: handle, ispin, nspins
671 REAL(kind=
dp) :: alpha
673 TYPE(
dbcsr_p_type),
DIMENSION(:),
POINTER :: h1_mat, matrix_s, rho1_ao, work
677 CALL timeset(routinen, handle)
684 dft_control=dft_control)
685 nspins = dft_control%nspins
692 IF (dft_control%do_admm)
THEN
694 cpabort(
"ADMM: Linear Response needs purification_method=none")
697 cpabort(
"ADMM: Linear Response needs scaling_model=none")
700 cpabort(
"ADMM: Linear Response needs admm_method=basis_projection")
703 rho1_ao => p_env%p1_admm
704 h1_mat => p_env%kpp1_admm
713 ALLOCATE (work(ispin)%matrix)
714 CALL dbcsr_create(work(ispin)%matrix, template=h1_mat(ispin)%matrix)
715 CALL dbcsr_copy(work(ispin)%matrix, h1_mat(ispin)%matrix)
716 CALL dbcsr_set(work(ispin)%matrix, 0.0_dp)
719 CALL hfx_matrix(work, rho1_ao, qs_env, hfx_section)
722 IF (nspins == 2) alpha = 1.0_dp
725 CALL dbcsr_add(h1_mat(ispin)%matrix, work(ispin)%matrix, 1.0_dp, alpha)
732 CALL timestop(handle)
748 SUBROUTINE hfx_matrix(matrix_ks, rho_ao, qs_env, hfx_sections, external_x_data, ex)
749 TYPE(
dbcsr_p_type),
DIMENSION(:),
TARGET :: matrix_ks, rho_ao
752 TYPE(
hfx_type),
DIMENSION(:, :),
OPTIONAL,
TARGET :: external_x_data
753 REAL(kind=
dp),
OPTIONAL :: ex
755 CHARACTER(LEN=*),
PARAMETER :: routinen =
'hfx_matrix'
757 INTEGER :: handle, irep, ispin, mspin, n_rep_hf, &
759 LOGICAL :: distribute_fock_matrix, &
760 hfx_treat_lsd_in_core, &
762 REAL(kind=
dp) :: eh1, ehfx
763 TYPE(
dbcsr_p_type),
DIMENSION(:, :),
POINTER :: matrix_ks_kp, rho_ao_kp
765 TYPE(
hfx_type),
DIMENSION(:, :),
POINTER :: x_data
768 CALL timeset(routinen, handle)
770 NULLIFY (dft_control, para_env, matrix_ks_kp, rho_ao_kp, x_data)
773 dft_control=dft_control, &
775 s_mstruct_changed=s_mstruct_changed, &
778 IF (
PRESENT(external_x_data)) x_data => external_x_data
780 cpassert(dft_control%nimages == 1)
781 nspins = dft_control%nspins
788 distribute_fock_matrix = .true.
791 IF (hfx_treat_lsd_in_core) mspin = nspins
793 matrix_ks_kp(1:nspins, 1:1) => matrix_ks(1:nspins)
794 rho_ao_kp(1:nspins, 1:1) => rho_ao(1:nspins)
796 DO irep = 1, n_rep_hf
799 IF (x_data(irep, 1)%do_hfx_ri)
THEN
800 CALL hfx_ri_update_ks(qs_env, x_data(irep, 1)%ri_data, matrix_ks_kp, ehfx, &
801 rho_ao=rho_ao_kp, geometry_did_change=s_mstruct_changed, &
802 nspins=nspins, hf_fraction=x_data(irep, 1)%general_parameter%fraction)
808 s_mstruct_changed, irep, distribute_fock_matrix, ispin=ispin)
816 IF (
PRESENT(ex)) ex = ehfx
818 CALL timestop(handle)
831 CHARACTER(len=*),
PARAMETER :: routinen =
'apply_xc_admm'
833 CHARACTER(LEN=default_string_length) :: basis_type
834 INTEGER :: handle, ispin, ns, nspins
835 INTEGER,
DIMENSION(2, 3) :: bo
837 REAL(kind=
dp) :: alpha
841 TYPE(
dbcsr_p_type),
DIMENSION(:, :),
POINTER :: ksmat, psmat
846 POINTER :: sab_aux_fit
850 TYPE(
pw_r3d_rs_type),
DIMENSION(:),
POINTER :: rho1_aux_r, tau_pw, v_xc, v_xc_tau
851 TYPE(
rho_atom_type),
DIMENSION(:),
POINTER :: rho1_atom_set, rho_atom_set
857 CALL timeset(routinen, handle)
859 CALL get_qs_env(qs_env=qs_env, dft_control=dft_control)
861 IF (dft_control%do_admm)
THEN
865 CALL get_qs_env(qs_env=qs_env, linres_control=linres_control)
866 cpassert(.NOT. dft_control%qs_control%lrigpw)
867 cpassert(.NOT. linres_control%lr_triplet)
869 nspins = dft_control%nspins
873 cpassert(
ASSOCIATED(pw_env))
874 CALL pw_env_get(pw_env, auxbas_pw_pool=auxbas_pw_pool)
878 CALL get_admm_env(qs_env%admm_env, matrix_s_aux_fit=matrix_s)
879 ALLOCATE (xcmat%matrix)
880 CALL dbcsr_create(xcmat%matrix, template=matrix_s(1)%matrix)
883 gapw = admm_env%do_gapw
885 CALL qs_rho_get(p_env%rho1_admm, rho_r=rho1_aux_r, rho_g=rho1_aux_g)
886 xc_section => admm_env%xc_section_aux
887 bo = rho1_aux_r(1)%pw_grid%bounds_local
902 CALL xc_calc_2nd_deriv(v_xc, v_xc_tau, p_env%kpp1_env%deriv_set_admm, p_env%kpp1_env%rho_set_admm, &
903 rho1_aux_r, rho1_aux_g, tau_pw, auxbas_pw_pool, gapw=.false., &
904 xc_section=xc_section)
905 IF (
ASSOCIATED(v_xc_tau))
THEN
906 cpabort(
"Meta-GGA ADMM functionals not yet supported!")
910 basis_type =
"AUX_FIT"
912 CALL get_admm_env(admm_env, task_list_aux_fit=task_list)
913 IF (admm_env%do_gapw)
THEN
915 do_rho0=.false., kind_set_external=admm_env%admm_gapw_env%admm_kind_set)
916 rho_atom_set => admm_env%admm_gapw_env%local_rho_set%rho_atom_set
917 rho1_atom_set => p_env%local_rho_set_admm%rho_atom_set
919 kind_set_external=admm_env%admm_gapw_env%admm_kind_set)
920 basis_type =
"AUX_FIT_SOFT"
921 task_list => admm_env%admm_gapw_env%task_list
925 IF (nspins == 1) alpha = 2.0_dp
928 CALL pw_scale(v_xc(ispin), v_xc(ispin)%pw_grid%dvol)
929 CALL dbcsr_copy(xcmat%matrix, matrix_s(1)%matrix)
931 CALL integrate_v_rspace(v_rspace=v_xc(ispin), hmat=xcmat, qs_env=qs_env, &
932 calculate_forces=.false., basis_type=basis_type, &
933 task_list_external=task_list)
934 CALL dbcsr_add(p_env%kpp1_admm(ispin)%matrix, xcmat%matrix, 1.0_dp, alpha)
937 IF (admm_env%do_gapw)
THEN
939 ns =
SIZE(p_env%kpp1_admm)
940 ksmat(1:ns, 1:1) => p_env%kpp1_admm(1:ns)
941 psmat(1:ns, 1:1) => p_env%p1_admm(1:ns)
942 CALL update_ks_atom(qs_env, ksmat, psmat, forces=.false., tddft=.true., &
943 rho_atom_external=p_env%local_rho_set_admm%rho_atom_set, &
944 kind_set_external=admm_env%admm_gapw_env%admm_kind_set, &
945 oce_external=admm_env%admm_gapw_env%oce, &
946 sab_external=sab_aux_fit)
950 CALL auxbas_pw_pool%give_back_pw(v_xc(ispin))
958 CALL timestop(handle)
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.
subroutine, public get_atomic_kind(atomic_kind, fist_potential, element_symbol, name, mass, kind_number, natom, atom_list, rcov, rvdw, z, qeff, apol, cpol, mm_radius, shell, shell_active, damping)
Get attributes of an atomic kind.
Defines control structures, which contain the parameters and the settings for the DFT-based calculati...
subroutine, public dbcsr_deallocate_matrix(matrix)
...
subroutine, public dbcsr_copy(matrix_b, matrix_a, name, keep_sparsity, keep_imaginary)
...
subroutine, public dbcsr_set(matrix, alpha)
...
subroutine, public dbcsr_add(matrix_a, matrix_b, alpha_scalar, beta_scalar)
...
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
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
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
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...
Routines to calculate HFX energy and potential.
subroutine, public integrate_four_center(qs_env, x_data, ks_matrix, ehfx, rho_ao, hfx_section, para_env, geometry_did_change, irep, distribute_fock_matrix, ispin, nspins)
computes four center integrals for a full basis set and updates the Kohn-Sham-Matrix and energy....
subroutine, public hfx_ri_update_ks(qs_env, ri_data, ks_matrix, ehfx, mos, rho_ao, geometry_did_change, nspins, hf_fraction)
...
Types and set/get functions for HFX.
Routines for a Kim-Gordon-like partitioning into molecular subunits.
subroutine, public kg_ekin_subset(qs_env, ks_matrix, ekin_mol, calc_force, do_kernel, pmat_ext)
Calculates the subsystem Hohenberg-Kohn kinetic energy and the forces.
Types needed for a Kim-Gordon-like partitioning into molecular subunits.
Defines the basic variable types.
integer, parameter, public dp
integer, parameter, public default_string_length
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.
compute mulliken charges we (currently) define them as c_i = 1/2 [ (PS)_{ii} + (SP)_{ii} ]
Define the data structure for the particle information.
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 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_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, 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.
https://en.wikipedia.org/wiki/Finite_difference_coefficient
subroutine, public qs_fxc_fdiff(ks_env, rho0_struct, rho1_struct, xc_section, accuracy, is_triplet, fxc_rho, fxc_tau)
...
subroutine, public qs_fxc_analytic(rho0, rho1_r, tau1_r, xc_section, auxbas_pw_pool, is_triplet, v_xc, v_xc_tau, spinflip)
...
subroutine, public prepare_gapw_den(qs_env, local_rho_set, do_rho0, kind_set_external, pw_env_sub)
...
Integrate single or product functions over a potential on a RS grid.
Define the quickstep kind type and their sub types.
subroutine, public get_qs_kind(qs_kind, basis_set, basis_type, ncgf, nsgf, all_potential, tnadd_potential, gth_potential, sgp_potential, upf_potential, cneo_potential, se_parameter, dftb_parameter, xtb_parameter, dftb3_param, zatom, zeff, elec_conf, mao, lmax_dftb, alpha_core_charge, ccore_charge, core_charge, core_charge_radius, paw_proj_set, paw_atom, hard_radius, hard0_radius, max_rad_local, covalent_radius, vdw_radius, gpw_type_forced, harmonics, max_iso_not0, max_s_harm, grid_atom, ngrid_ang, ngrid_rad, lmax_rho0, dft_plus_u_atom, l_of_dft_plus_u, n_of_dft_plus_u, u_minus_j, u_of_dft_plus_u, j_of_dft_plus_u, alpha_of_dft_plus_u, beta_of_dft_plus_u, j0_of_dft_plus_u, occupation_of_dft_plus_u, dispersion, bs_occupation, magnetization, no_optimize, addel, laddel, naddel, orbitals, max_scf, eps_scf, smear, u_ramping, u_minus_j_target, eps_u_ramping, init_u_ramping_each_scf, reltmat, ghost, floating, name, element_symbol, pao_basis_size, pao_model_file, pao_potentials, pao_descriptors, nelec)
Get attributes of an atomic kind.
subroutine, public get_qs_kind_set(qs_kind_set, all_potential_present, tnadd_potential_present, gth_potential_present, sgp_potential_present, paw_atom_present, dft_plus_u_atom_present, maxcgf, maxsgf, maxco, maxco_proj, maxgtops, maxlgto, maxlprj, maxnset, maxsgf_set, ncgf, npgf, nset, nsgf, nshell, maxpol, maxlppl, maxlppnl, maxppnl, nelectron, maxder, max_ngrid_rad, max_sph_harm, maxg_iso_not0, lmax_rho0, basis_rcut, basis_type, total_zeff_corr, npgf_seg, cneo_potential_present, nkind_q, natom_q)
Get attributes of an atomic kind set.
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...
subroutine, public apply_op_2(qs_env, p_env, c0, av)
...
subroutine, public apply_xc_admm(qs_env, p_env)
...
subroutine, public hfx_matrix(matrix_ks, rho_ao, qs_env, hfx_sections, external_x_data, ex)
Add the hfx contributions to the Hamiltonian.
subroutine, public apply_hfx(qs_env, p_env)
Update action of TDDFPT operator on trial vectors by adding exact-exchange term.
Type definitiona for linear response calculations.
Define the neighbor list data types and the corresponding functionality.
Utility functions for the perturbation calculations.
subroutine, public p_env_finish_kpp1(qs_env, p_env)
...
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, my_pools, my_rs_descs)
...
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_tddfpt2, do_triplet, do_sf, kind_set_external)
...
type(xc_rho_cflags_type) function, public xc_functionals_get_needs(functionals, lsd, calc_potential)
...
subroutine, public xc_rho_set_create(rho_set, local_bounds, rho_cutoff, drho_cutoff, tau_cutoff)
allocates and does (minimal) initialization of a rho_set
subroutine, public xc_rho_set_release(rho_set, pw_pool)
releases the given rho_set
subroutine, public xc_rho_set_update(rho_set, rho_r, rho_g, tau, needs, xc_deriv_method_id, xc_rho_smooth_id, pw_pool, spinflip)
updates the given rho set with the density given by rho_r (and rho_g). The rho set will contain the c...
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, do_excitations, do_sf, do_triplet, 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....
Calculation of Coulomb Hessian contributions in xTB.
subroutine, public xtb_coulomb_hessian(qs_env, ks_matrix, charges1, mcharge1, mcharge)
...
Definition of the xTB parameter types.
subroutine, public get_xtb_atom_param(xtb_parameter, symbol, aname, typ, defined, z, zeff, natorb, lmax, nao, lao, rcut, rcov, kx, eta, xgamma, alpha, zneff, nshell, nval, lval, kpoly, kappa, hen, zeta, xi, kappa0, alpg, occupation, electronegativity, chmax, en, kqat2, kcn, kq)
...
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 some data used in construction of Kohn-Sham matrix
Contains all the info needed for KG runs...
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 ...
Provides all information about a quickstep kind.
environment that keeps the informations and temporary val to build the kpp1 kernel matrix
calculation environment to calculate the ks matrix, holds all the needed vars. assumes that the core ...
General settings for linear response calculations.
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.
contains a flag for each component of xc_rho_set, so that you can use it to tell which components you...
represent a density, with all the representation and data needed to perform a functional evaluation