66#include "./base/base_uses.f90"
75 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'qs_fxc'
93 SUBROUTINE qs_fxc_analytic(rho0, rho1_r, tau1_r, xc_section, auxbas_pw_pool, is_triplet, v_xc, v_xc_tau, spinflip)
99 LOGICAL,
INTENT(IN) :: is_triplet
101 LOGICAL,
OPTIONAL :: spinflip
103 CHARACTER(len=*),
PARAMETER :: routinen =
'qs_fxc_analytic'
105 INTEGER :: handle, nspins
106 INTEGER,
DIMENSION(2, 3) :: bo
107 LOGICAL :: do_sf, lsd
116 CALL timeset(routinen, handle)
118 cpassert(.NOT.
ASSOCIATED(v_xc))
119 cpassert(.NOT.
ASSOCIATED(v_xc_tau))
122 IF (
PRESENT(spinflip)) do_sf = spinflip
124 CALL qs_rho_get(rho0, rho_r=rho0_r, rho_g=rho0_g, tau_r=tau0_r)
125 nspins =
SIZE(rho0_r)
129 IF (is_triplet .AND. nspins == 1)
fac = -1.0_dp
132 bo = rho1_r(1)%pw_grid%bounds_local
136 CALL xc_prep_2nd_deriv(deriv_set, rho0_set, rho0_r, auxbas_pw_pool, xc_section=xc_section, tau_r=tau0_r)
138 CALL xc_calc_2nd_deriv(v_xc, v_xc_tau, deriv_set, rho0_set, rho1_r, rho1_g, tau1_r, &
139 auxbas_pw_pool, xc_section=xc_section, gapw=.false., do_triplet=is_triplet, &
144 CALL timestop(handle)
159 SUBROUTINE qs_fxc_fdiff(ks_env, rho0_struct, rho1_struct, xc_section, accuracy, is_triplet, &
163 TYPE(
qs_rho_type),
POINTER :: rho0_struct, rho1_struct
165 INTEGER,
INTENT(IN) :: accuracy
166 LOGICAL,
INTENT(IN) :: is_triplet
169 CHARACTER(len=*),
PARAMETER :: routinen =
'qs_fxc_fdiff'
170 REAL(kind=
dp),
PARAMETER :: epsrho = 5.e-4_dp
172 INTEGER :: handle, ispin, istep, nspins, nstep
173 REAL(kind=
dp) :: alpha, beta, exc, oeps1
174 REAL(kind=
dp),
DIMENSION(-4:4) :: ak
178 TYPE(
pw_r3d_rs_type),
DIMENSION(:),
POINTER :: v_tau_rspace, vxc00
181 CALL timeset(routinen, handle)
183 cpassert(.NOT.
ASSOCIATED(fxc_rho))
184 cpassert(.NOT.
ASSOCIATED(fxc_tau))
185 cpassert(
ASSOCIATED(rho0_struct))
186 cpassert(
ASSOCIATED(rho1_struct))
189 SELECT CASE (accuracy)
192 ak(-2:2) = (/1.0_dp, -8.0_dp, 0.0_dp, 8.0_dp, -1.0_dp/)/12.0_dp
195 ak(-3:3) = (/-1.0_dp, 9.0_dp, -45.0_dp, 0.0_dp, 45.0_dp, -9.0_dp, 1.0_dp/)/60.0_dp
198 ak(-4:4) = (/1.0_dp, -32.0_dp/3.0_dp, 56.0_dp, -224.0_dp, 0.0_dp, &
199 224.0_dp, -56.0_dp, 32.0_dp/3.0_dp, -1.0_dp/)/280.0_dp
202 CALL get_ks_env(ks_env, dft_control=dft_control, pw_env=pw_env)
203 CALL pw_env_get(pw_env, auxbas_pw_pool=auxbas_pw_pool)
205 nspins = dft_control%nspins
208 DO istep = -nstep, nstep
210 IF (ak(istep) /= 0.0_dp)
THEN
212 beta = real(istep, kind=
dp)*epsrho
216 NULLIFY (vxc00, v_tau_rspace)
218 cpassert(nspins == 1)
220 CALL qs_rho_copy(rho0_struct, rhoin, auxbas_pw_pool, 2)
223 CALL qs_vxc_create(ks_env=ks_env, rho_struct=rhoin, xc_section=xc_section, &
224 vxc_rho=vxc00, vxc_tau=v_tau_rspace, exc=exc, just_energy=.false.)
225 CALL pw_axpy(vxc00(2), vxc00(1), -1.0_dp)
226 IF (
ASSOCIATED(v_tau_rspace))
CALL pw_axpy(v_tau_rspace(2), v_tau_rspace(1), -1.0_dp)
228 CALL qs_rho_copy(rho0_struct, rhoin, auxbas_pw_pool, nspins)
230 CALL qs_vxc_create(ks_env=ks_env, rho_struct=rhoin, xc_section=xc_section, &
231 vxc_rho=vxc00, vxc_tau=v_tau_rspace, exc=exc, just_energy=.false.)
235 IF (.NOT.
ASSOCIATED(fxc_rho))
THEN
236 ALLOCATE (fxc_rho(nspins))
238 CALL auxbas_pw_pool%create_pw(fxc_rho(ispin))
243 CALL pw_axpy(vxc00(ispin), fxc_rho(ispin), ak(istep))
245 DO ispin = 1,
SIZE(vxc00)
246 CALL auxbas_pw_pool%give_back_pw(vxc00(ispin))
249 IF (
ASSOCIATED(v_tau_rspace))
THEN
250 IF (.NOT.
ASSOCIATED(fxc_tau))
THEN
251 ALLOCATE (fxc_tau(nspins))
253 CALL auxbas_pw_pool%create_pw(fxc_tau(ispin))
258 CALL pw_axpy(v_tau_rspace(ispin), fxc_tau(ispin), ak(istep))
260 DO ispin = 1,
SIZE(v_tau_rspace)
261 CALL auxbas_pw_pool%give_back_pw(v_tau_rspace(ispin))
263 DEALLOCATE (v_tau_rspace)
269 oeps1 = 1.0_dp/epsrho
271 CALL pw_scale(fxc_rho(ispin), oeps1)
273 IF (
ASSOCIATED(fxc_tau))
THEN
275 CALL pw_scale(fxc_tau(ispin), oeps1)
279 CALL timestop(handle)
301 fxc_rho, fxc_tau, gxc_rho, gxc_tau, spinflip)
303 TYPE(
qs_rho_type),
POINTER :: rho0_struct, rho1_struct
306 TYPE(
pw_r3d_rs_type),
DIMENSION(:),
POINTER :: fxc_rho, fxc_tau, gxc_rho, gxc_tau
307 LOGICAL,
INTENT(IN),
OPTIONAL :: spinflip
309 CHARACTER(len=*),
PARAMETER :: routinen =
'qs_fgxc_analytic'
311 INTEGER :: handle, ispin, nspins, spindim
312 INTEGER,
DIMENSION(2, 3) :: bo
313 LOGICAL :: do_sf, lsd
316 TYPE(
pw_r3d_rs_type),
DIMENSION(:),
POINTER :: rho0_r, rho1_r, tau0_r, tau1_r
322 CALL timeset(routinen, handle)
325 cpassert(.NOT.
ASSOCIATED(fxc_rho))
326 cpassert(.NOT.
ASSOCIATED(fxc_tau))
327 cpassert(.NOT.
ASSOCIATED(gxc_rho))
328 cpassert(.NOT.
ASSOCIATED(gxc_tau))
329 cpassert(
ASSOCIATED(rho0_struct))
330 cpassert(
ASSOCIATED(rho1_struct))
334 IF (
PRESENT(spinflip)) do_sf = spinflip
337 CALL qs_rho_get(rho0_struct, rho_r=rho0_r, rho_g=rho0_g, tau_r=tau0_r)
338 nspins =
SIZE(rho0_r)
348 IF (nspins == 1)
THEN
357 ALLOCATE (fxc_rho(spindim), gxc_rho(nspins))
358 DO ispin = 1, spindim
359 CALL pw_pool%create_pw(fxc_rho(ispin))
363 CALL pw_pool%create_pw(gxc_rho(ispin))
367 IF (needs%tau .OR. needs%tau_spin)
THEN
368 IF (.NOT.
ASSOCIATED(tau1_r)) &
369 cpabort(
"Tau-dependent functionals requires allocated kinetic energy density grid")
370 ALLOCATE (fxc_tau(spindim), gxc_tau(nspins))
371 DO ispin = 1, spindim
372 CALL pw_pool%create_pw(fxc_tau(ispin))
376 CALL pw_pool%create_pw(gxc_tau(ispin))
390 CALL xc_prep_3rd_deriv(deriv_set, rho0_set, rho0_r, pw_pool, xc_section, tau_r=tau0_r, &
395 CALL qs_rho_get(rho1_struct, rho_r=rho1_r, rho_g=rho1_g, tau_r=tau1_r)
396 bo = rho1_r(1)%pw_grid%bounds_local
414 pw_pool, spinflip=do_sf)
425 xc_section, .false., spinflip=do_sf, tddfpt_fac=
fac)
428 xc_section, spinflip=do_sf)
434 CALL timestop(handle)
453 SUBROUTINE qs_fgxc_gdiff(ks_env, rho0_struct, rho1_struct, xc_section, accuracy, epsrho, &
454 is_triplet, fxc_rho, fxc_tau, gxc_rho, gxc_tau, spinflip)
457 TYPE(
qs_rho_type),
POINTER :: rho0_struct, rho1_struct
459 INTEGER,
INTENT(IN) :: accuracy
460 REAL(kind=
dp),
INTENT(IN) :: epsrho
461 LOGICAL,
INTENT(IN) :: is_triplet
462 TYPE(
pw_r3d_rs_type),
DIMENSION(:),
POINTER :: fxc_rho, fxc_tau, gxc_rho, gxc_tau
463 LOGICAL,
OPTIONAL :: spinflip
465 CHARACTER(len=*),
PARAMETER :: routinen =
'qs_fgxc_gdiff'
467 INTEGER :: handle, ispin, istep, nspins, nstep
469 REAL(kind=
dp) :: alpha, beta, exc, oeps1
470 REAL(kind=
dp),
DIMENSION(-4:4) :: ak
474 TYPE(
pw_r3d_rs_type),
DIMENSION(:),
POINTER :: rho1_r, tau1_r, v_tau_rspace, vxc00, &
478 CALL timeset(routinen, handle)
480 cpassert(.NOT.
ASSOCIATED(fxc_rho))
481 cpassert(.NOT.
ASSOCIATED(fxc_tau))
482 cpassert(.NOT.
ASSOCIATED(gxc_rho))
483 cpassert(.NOT.
ASSOCIATED(gxc_tau))
484 cpassert(
ASSOCIATED(rho0_struct))
485 cpassert(
ASSOCIATED(rho1_struct))
488 IF (
PRESENT(spinflip)) do_sf = spinflip
491 SELECT CASE (accuracy)
494 ak(-2:2) = (/1.0_dp, -8.0_dp, 0.0_dp, 8.0_dp, -1.0_dp/)/12.0_dp
497 ak(-3:3) = (/-1.0_dp, 9.0_dp, -45.0_dp, 0.0_dp, 45.0_dp, -9.0_dp, 1.0_dp/)/60.0_dp
500 ak(-4:4) = (/1.0_dp, -32.0_dp/3.0_dp, 56.0_dp, -224.0_dp, 0.0_dp, &
501 224.0_dp, -56.0_dp, 32.0_dp/3.0_dp, -1.0_dp/)/280.0_dp
504 CALL get_ks_env(ks_env, dft_control=dft_control, pw_env=pw_env)
505 CALL pw_env_get(pw_env, auxbas_pw_pool=auxbas_pw_pool)
507 nspins = dft_control%nspins
511 CALL qs_rho_get(rho1_struct, rho_r=rho1_r, tau_r=tau1_r)
513 auxbas_pw_pool, is_triplet, fxc_rho, fxc_tau, spinflip=do_sf)
515 CALL qs_fxc_fdiff(ks_env, rho0_struct, rho1_struct, xc_section, accuracy, is_triplet, &
519 DO istep = -nstep, nstep
521 IF (ak(istep) /= 0.0_dp)
THEN
523 beta = real(istep, kind=
dp)*epsrho
527 NULLIFY (vxc00, vxc00b, v_tau_rspace)
528 CALL qs_rho_copy(rho0_struct, rhoin, auxbas_pw_pool, nspins)
533 xc_section, auxbas_pw_pool, is_triplet, &
534 vxc00, v_tau_rspace, spinflip=do_sf)
536 CALL qs_rho_copy(rho0_struct, rhoin, auxbas_pw_pool, nspins)
539 xc_section, auxbas_pw_pool, is_triplet, &
540 vxc00b, v_tau_rspace, spinflip=do_sf)
542 CALL qs_fxc_fdiff(ks_env=ks_env, rho0_struct=rhoin, rho1_struct=rho1_struct, &
543 xc_section=xc_section, accuracy=accuracy, is_triplet=is_triplet, &
544 fxc_rho=vxc00, fxc_tau=v_tau_rspace)
548 IF (.NOT.
ASSOCIATED(gxc_rho))
THEN
549 ALLOCATE (gxc_rho(nspins))
551 CALL auxbas_pw_pool%create_pw(gxc_rho(ispin))
556 CALL pw_axpy(vxc00(1), gxc_rho(1), ak(istep))
557 CALL pw_axpy(vxc00b(1), gxc_rho(2), ak(istep))
560 CALL pw_axpy(vxc00(ispin), gxc_rho(ispin), ak(istep))
563 DO ispin = 1,
SIZE(vxc00)
564 CALL auxbas_pw_pool%give_back_pw(vxc00(ispin))
567 IF (
ASSOCIATED(vxc00b))
THEN
568 CALL auxbas_pw_pool%give_back_pw(vxc00b(1))
571 IF (
ASSOCIATED(v_tau_rspace))
THEN
572 IF (.NOT.
ASSOCIATED(gxc_tau))
THEN
573 ALLOCATE (gxc_tau(nspins))
575 CALL auxbas_pw_pool%create_pw(gxc_tau(ispin))
580 CALL pw_axpy(v_tau_rspace(ispin), gxc_tau(ispin), ak(istep))
582 DO ispin = 1,
SIZE(v_tau_rspace)
583 CALL auxbas_pw_pool%give_back_pw(v_tau_rspace(ispin))
585 DEALLOCATE (v_tau_rspace)
591 oeps1 = 1.0_dp/epsrho
593 CALL pw_scale(gxc_rho(ispin), oeps1)
595 IF (
ASSOCIATED(gxc_tau))
THEN
597 CALL pw_scale(gxc_tau(ispin), oeps1)
601 CALL timestop(handle)
618 SUBROUTINE qs_fgxc_create(ks_env, rho0_struct, rho1_struct, xc_section, accuracy, is_triplet, &
619 fxc_rho, fxc_tau, gxc_rho, gxc_tau)
622 TYPE(
qs_rho_type),
POINTER :: rho0_struct, rho1_struct
624 INTEGER,
INTENT(IN) :: accuracy
625 LOGICAL,
INTENT(IN) :: is_triplet
626 TYPE(
pw_r3d_rs_type),
DIMENSION(:),
POINTER :: fxc_rho, fxc_tau, gxc_rho, gxc_tau
628 CHARACTER(len=*),
PARAMETER :: routinen =
'qs_fgxc_create'
629 REAL(kind=
dp),
PARAMETER :: epsrho = 5.e-4_dp
631 INTEGER :: handle, ispin, istep, nspins, nstep
632 REAL(kind=
dp) :: alpha, beta, exc, oeps1, oeps2
633 REAL(kind=
dp),
DIMENSION(-4:4) :: ak, bl
637 TYPE(
pw_r3d_rs_type),
DIMENSION(:),
POINTER :: v_tau_rspace, vxc00
640 CALL timeset(routinen, handle)
642 cpassert(.NOT.
ASSOCIATED(fxc_rho))
643 cpassert(.NOT.
ASSOCIATED(fxc_tau))
644 cpassert(.NOT.
ASSOCIATED(gxc_rho))
645 cpassert(.NOT.
ASSOCIATED(gxc_tau))
646 cpassert(
ASSOCIATED(rho0_struct))
647 cpassert(
ASSOCIATED(rho1_struct))
651 SELECT CASE (accuracy)
654 ak(-2:2) = (/1.0_dp, -8.0_dp, 0.0_dp, 8.0_dp, -1.0_dp/)/12.0_dp
655 bl(-2:2) = (/-1.0_dp, 16.0_dp, -30.0_dp, 16.0_dp, -1.0_dp/)/12.0_dp
658 ak(-3:3) = (/-1.0_dp, 9.0_dp, -45.0_dp, 0.0_dp, 45.0_dp, -9.0_dp, 1.0_dp/)/60.0_dp
659 bl(-3:3) = (/2.0_dp, -27.0_dp, 270.0_dp, -490.0_dp, 270.0_dp, -27.0_dp, 2.0_dp/)/180.0_dp
662 ak(-4:4) = (/1.0_dp, -32.0_dp/3.0_dp, 56.0_dp, -224.0_dp, 0.0_dp, &
663 224.0_dp, -56.0_dp, 32.0_dp/3.0_dp, -1.0_dp/)/280.0_dp
664 bl(-4:4) = (/-1.0_dp, 128.0_dp/9.0_dp, -112.0_dp, 896.0_dp, -14350.0_dp/9.0_dp, &
665 896.0_dp, -112.0_dp, 128.0_dp/9.0_dp, -1.0_dp/)/560.0_dp
668 CALL get_ks_env(ks_env, dft_control=dft_control, pw_env=pw_env)
669 CALL pw_env_get(pw_env, auxbas_pw_pool=auxbas_pw_pool)
671 nspins = dft_control%nspins
674 DO istep = -nstep, nstep
677 beta = real(istep, kind=
dp)*epsrho
681 NULLIFY (vxc00, v_tau_rspace)
683 cpassert(nspins == 1)
685 CALL qs_rho_copy(rho0_struct, rhoin, auxbas_pw_pool, 2)
688 CALL qs_vxc_create(ks_env=ks_env, rho_struct=rhoin, xc_section=xc_section, &
689 vxc_rho=vxc00, vxc_tau=v_tau_rspace, exc=exc, just_energy=.false.)
690 CALL pw_axpy(vxc00(2), vxc00(1), -1.0_dp)
692 CALL qs_rho_copy(rho0_struct, rhoin, auxbas_pw_pool, nspins)
694 CALL qs_vxc_create(ks_env=ks_env, rho_struct=rhoin, xc_section=xc_section, &
695 vxc_rho=vxc00, vxc_tau=v_tau_rspace, exc=exc, just_energy=.false.)
699 IF (.NOT.
ASSOCIATED(fxc_rho))
THEN
700 ALLOCATE (fxc_rho(nspins))
702 CALL auxbas_pw_pool%create_pw(fxc_rho(ispin))
706 IF (.NOT.
ASSOCIATED(gxc_rho))
THEN
707 ALLOCATE (gxc_rho(nspins))
709 CALL auxbas_pw_pool%create_pw(gxc_rho(ispin))
713 cpassert(.NOT.
ASSOCIATED(v_tau_rspace))
715 IF (ak(istep) /= 0.0_dp)
THEN
716 CALL pw_axpy(vxc00(ispin), fxc_rho(ispin), ak(istep))
718 IF (bl(istep) /= 0.0_dp)
THEN
719 CALL pw_axpy(vxc00(ispin), gxc_rho(ispin), bl(istep))
722 DO ispin = 1,
SIZE(vxc00)
723 CALL auxbas_pw_pool%give_back_pw(vxc00(ispin))
729 oeps1 = 1.0_dp/epsrho
730 oeps2 = 1.0_dp/(epsrho**2)
732 CALL pw_scale(fxc_rho(ispin), oeps1)
733 CALL pw_scale(gxc_rho(ispin), oeps2)
736 CALL timestop(handle)
751 TYPE(
pw_r3d_rs_type),
DIMENSION(:),
POINTER :: fxc_rho, fxc_tau, gxc_rho, gxc_tau
758 CALL pw_env_get(pw_env, auxbas_pw_pool=auxbas_pw_pool)
760 IF (
ASSOCIATED(fxc_rho))
THEN
761 DO ispin = 1,
SIZE(fxc_rho)
762 CALL auxbas_pw_pool%give_back_pw(fxc_rho(ispin))
766 IF (
ASSOCIATED(fxc_tau))
THEN
767 DO ispin = 1,
SIZE(fxc_tau)
768 CALL auxbas_pw_pool%give_back_pw(fxc_tau(ispin))
772 IF (
ASSOCIATED(gxc_rho))
THEN
773 DO ispin = 1,
SIZE(gxc_rho)
774 CALL auxbas_pw_pool%give_back_pw(gxc_rho(ispin))
778 IF (
ASSOCIATED(gxc_tau))
THEN
779 DO ispin = 1,
SIZE(gxc_tau)
780 CALL auxbas_pw_pool%give_back_pw(gxc_tau(ispin))
static GRID_HOST_DEVICE double fac(const int i)
Factorial function, e.g. fac(5) = 5! = 120.
Defines control structures, which contain the parameters and the settings for the DFT-based calculati...
Defines the basic variable types.
integer, parameter, public dp
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
Manages a pool of grids (to be used for example as tmp objects), but can also be used to instantiate ...
https://en.wikipedia.org/wiki/Finite_difference_coefficient
subroutine, public qs_fgxc_create(ks_env, rho0_struct, rho1_struct, xc_section, accuracy, is_triplet, fxc_rho, fxc_tau, gxc_rho, gxc_tau)
...
subroutine, public qs_fgxc_gdiff(ks_env, rho0_struct, rho1_struct, xc_section, accuracy, epsrho, is_triplet, fxc_rho, fxc_tau, gxc_rho, gxc_tau, spinflip)
...
subroutine, public qs_fgxc_release(ks_env, fxc_rho, fxc_tau, gxc_rho, gxc_tau)
...
subroutine, public qs_fxc_fdiff(ks_env, rho0_struct, rho1_struct, xc_section, accuracy, is_triplet, fxc_rho, fxc_tau)
...
subroutine, public qs_fgxc_analytic(rho0_struct, rho1_struct, xc_section, pw_pool, fxc_rho, fxc_tau, gxc_rho, gxc_tau, spinflip)
Calculates the values at the grid points in real space (r_i), of the second and third functional deri...
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 get_ks_env(ks_env, v_hartree_rspace, s_mstruct_changed, rho_changed, potential_changed, forces_up_to_date, complex_ks, matrix_h, matrix_h_im, matrix_ks, matrix_ks_im, matrix_vxc, kinetic, matrix_s, matrix_s_ri_aux, matrix_w, matrix_p_mp2, matrix_p_mp2_admm, matrix_h_kp, matrix_h_im_kp, matrix_ks_kp, matrix_vxc_kp, kinetic_kp, matrix_s_kp, matrix_w_kp, matrix_s_ri_aux_kp, matrix_ks_im_kp, rho, rho_xc, vppl, rho_core, rho_nlcc, rho_nlcc_g, vee, neighbor_list_id, sab_orb, sab_all, sac_ae, sac_ppl, sac_lri, sap_ppnl, sap_oce, sab_lrc, sab_se, sab_xtbe, sab_tbe, sab_core, sab_xb, sab_xtb_pp, sab_xtb_nonbond, sab_vdw, sab_scp, sab_almo, sab_kp, sab_kp_nosym, sab_cneo, task_list, task_list_soft, kpoints, do_kpoints, atomic_kind_set, qs_kind_set, cell, cell_ref, use_ref_cell, particle_set, energy, force, local_particles, local_molecules, molecule_kind_set, molecule_set, subsys, cp_subsys, virial, results, atprop, nkind, natom, dft_control, dbcsr_dist, distribution_2d, pw_env, para_env, blacs_env, nelectron_total, nelectron_spin)
...
methods of the rho structure (defined in qs_rho_types)
subroutine, public qs_rho_scale_and_add_b(rhoa, rhob, alpha, beta)
rhoa(2) = alpha*rhoa(2)+beta*rhob(1)
subroutine, public qs_rho_copy(rho_input, rho_output, auxbas_pw_pool, mspin)
Allocate a density structure and fill it with data from an input structure SIZE(rho_input) == mspin =...
subroutine, public qs_rho_scale_and_add(rhoa, rhob, alpha, beta)
rhoa = alpha*rhoa+beta*rhob
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...
subroutine, public qs_rho_create(rho)
Allocates a new instance of rho.
subroutine, public qs_rho_release(rho_struct)
releases a rho_struct by decreasing the reference count by one and deallocating if it reaches 0 (to b...
subroutine, public qs_vxc_create(ks_env, rho_struct, xc_section, vxc_rho, vxc_tau, exc, just_energy, edisp, dispersion_env, adiabatic_rescale_factor, pw_env_external)
calculates and allocates the xc potential, already reducing it to the dependence on rho and the one o...
represent a group ofunctional derivatives
subroutine, public xc_dset_release(derivative_set)
releases a derivative set
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_analytical(v_xc, v_xc_tau, deriv_set, rho_set, rho1_set, pw_pool, xc_section, gapw, vxg, tddfpt_fac, compute_virial, virial_xc, spinflip)
Calculates the second derivative of E_xc at rho in the direction rho1 (if you see the second derivati...
subroutine, public xc_prep_3rd_deriv(deriv_set, rho_set, rho_r, pw_pool, xc_section, tau_r, do_sf)
Prepare deriv_set for the calculation of the 3rd derivatives of the density functional....
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_calc_3rd_deriv_analytical(v_xc, v_xc_tau, deriv_set, rho_set, rho1_set, pw_pool, xc_section, spinflip)
Calculates the third functional derivative of the exchange-correlation functional,...
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....
contained for different pw related things
Manages a pool of grids (to be used for example as tmp objects), but can also be used to instantiate ...
calculation environment to calculate the ks matrix, holds all the needed vars. assumes that the core ...
keeps the density in various representations, keeping track of which ones are valid.
A derivative set contains the different derivatives of a xc-functional in form of a linked list.
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