11 USE dbcsr_api,
ONLY: dbcsr_distribution_type,&
42#include "./base/base_uses.f90"
48 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'qs_kernel_methods'
50 LOGICAL,
PARAMETER,
PRIVATE :: debug_this_module = .false.
72 lsd_singlets, do_excitations, sub_env, qs_env)
75 LOGICAL,
INTENT(in) :: is_rks_triplets
77 LOGICAL,
INTENT(in),
OPTIONAL :: lsd_singlets, do_excitations
83 CHARACTER(LEN=*),
PARAMETER :: routinen =
'create_kernel_env'
85 INTEGER :: handle, ispin, nspins
86 LOGICAL :: lsd, my_excitations, my_singlets
87 TYPE(dbcsr_distribution_type),
POINTER :: dbcsr_dist
88 TYPE(dbcsr_p_type),
DIMENSION(:),
POINTER :: matrix_s, rho_ia_ao
94 TYPE(
pw_r3d_rs_type),
DIMENSION(:),
POINTER :: rho_ij_r, rho_ij_r2, tau_ij_r, tau_ij_r2
97 CALL timeset(routinen, handle)
99 IF (
PRESENT(sub_env))
THEN
100 pw_env => sub_env%pw_env
101 dbcsr_dist => sub_env%dbcsr_dist
102 sab_orb => sub_env%sab_orb
104 nspins =
SIZE(sub_env%mos_occ)
106 cpassert(
PRESENT(qs_env))
110 dbcsr_dist=dbcsr_dist, &
112 dft_control=dft_control)
114 nspins = dft_control%nspins
116 IF (.NOT.
ASSOCIATED(rho_struct_sub))
THEN
121 CALL dbcsr_init_p(rho_ia_ao(ispin)%matrix)
123 dbcsr_dist=dbcsr_dist, sab=sab_orb)
126 ALLOCATE (rho_struct_sub)
128 CALL qs_rho_set(rho_struct_sub, rho_ao=rho_ia_ao)
130 rebuild_grids=.true., pw_env_external=pw_env)
134 lsd = (nspins > 1) .OR. is_rks_triplets
136 CALL pw_env_get(pw_env, auxbas_pw_pool=auxbas_pw_pool)
138 CALL qs_rho_get(rho_struct_sub, rho_r=rho_ij_r, tau_r=tau_ij_r)
140 NULLIFY (kernel_env%xc_rho_set, kernel_env%xc_rho1_set)
142 ALLOCATE (kernel_env%xc_rho_set)
143 IF (is_rks_triplets)
THEN
146 ALLOCATE (rho_ij_r2(2))
147 rho_ij_r2(1) = rho_ij_r(1)
148 rho_ij_r2(2) = rho_ij_r(1)
150 IF (
ASSOCIATED(tau_ij_r))
THEN
151 ALLOCATE (tau_ij_r2(2))
152 tau_ij_r2(1) = tau_ij_r(1)
153 tau_ij_r2(2) = tau_ij_r(1)
156 CALL xc_prep_2nd_deriv(kernel_env%xc_deriv_set, kernel_env%xc_rho_set, rho_ij_r2, &
157 auxbas_pw_pool, xc_section=xc_section, tau_r=tau_ij_r2)
159 IF (
ASSOCIATED(tau_ij_r))
DEALLOCATE (tau_ij_r2)
161 DEALLOCATE (rho_ij_r2)
163 CALL xc_prep_2nd_deriv(kernel_env%xc_deriv_set, kernel_env%xc_rho_set, rho_ij_r, &
164 auxbas_pw_pool, xc_section=xc_section, tau_r=tau_ij_r)
168 kernel_env%xc_section => xc_section
169 kernel_env%deriv_method_id =
section_get_ival(xc_section,
"XC_GRID%XC_DERIV")
170 kernel_env%rho_smooth_id =
section_get_ival(xc_section,
"XC_GRID%XC_SMOOTH_RHO")
174 calc_potential=.true.)
176 IF (.NOT.
ASSOCIATED(kernel_env%xc_rho1_set))
THEN
177 NULLIFY (kernel_env%xc_rho1_set)
178 ALLOCATE (kernel_env%xc_rho1_set)
180 CALL xc_rho_set_create(kernel_env%xc_rho1_set, auxbas_pw_pool%pw_grid%bounds_local, &
185 my_excitations = .true.
186 IF (
PRESENT(do_excitations)) my_excitations = do_excitations
188 my_singlets = .false.
189 IF (
PRESENT(lsd_singlets)) my_singlets = lsd_singlets
191 kernel_env%alpha = 1.0_dp
192 kernel_env%beta = 0.0_dp
195 IF (nspins == 1 .AND. my_excitations)
THEN
196 IF (is_rks_triplets)
THEN
198 kernel_env%beta = -1.0_dp
203 kernel_env%alpha = 2.0_dp
205 IF (my_singlets)
THEN
206 kernel_env%beta = 1.0_dp
212 kernel_env%deriv2_analytic =
section_get_lval(xc_section,
"2ND_DERIV_ANALYTICAL")
213 kernel_env%deriv3_analytic =
section_get_lval(xc_section,
"3RD_DERIV_ANALYTICAL")
215 CALL timestop(handle)
228 SUBROUTINE create_fxc_kernel(rho_struct, fxc_rspace, xc_section, is_rks_triplets, sub_env, qs_env)
232 LOGICAL,
INTENT(IN) :: is_rks_triplets
236 CHARACTER(LEN=*),
PARAMETER :: routinen =
'create_fxc_kernel'
238 INTEGER :: handle, ispin, nspins
239 LOGICAL :: rho_g_valid, tau_r_valid
240 REAL(kind=
dp) :: factor
249 CALL timeset(routinen, handle)
251 pw_env => sub_env%pw_env
252 CALL pw_env_get(pw_env, auxbas_pw_pool=auxbas_pw_pool)
254 NULLIFY (rho_r, rho_g, tau_r)
256 tau_r_valid=tau_r_valid, &
257 rho_g_valid=rho_g_valid, &
262 IF (.NOT. tau_r_valid)
NULLIFY (tau_r)
263 IF (.NOT. rho_g_valid)
NULLIFY (rho_g)
267 NULLIFY (rho_nlcc, rho_nlcc_g)
270 rho_nlcc_g=rho_nlcc_g)
272 IF (
ASSOCIATED(rho_nlcc))
THEN
275 CALL pw_axpy(rho_nlcc, rho_r(ispin), factor)
276 CALL pw_axpy(rho_nlcc_g, rho_g(ispin), factor)
280 DO ispin = 1,
SIZE(fxc_rspace)
281 CALL pw_zero(fxc_rspace(ispin))
286 xc_kernel, is_rks_triplets, auxbas_pw_pool)
289 IF (
ASSOCIATED(rho_nlcc))
THEN
292 CALL pw_axpy(rho_nlcc, rho_r(ispin), factor)
293 CALL pw_axpy(rho_nlcc_g, rho_g(ispin), factor)
297 CALL timestop(handle)
Defines control structures, which contain the parameters and the settings for the DFT-based calculati...
DBCSR operations in CP2K.
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 ...
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 create_fxc_kernel(rho_struct, fxc_rspace, xc_section, is_rks_triplets, sub_env, qs_env)
Create the xc kernel potential for the approximate Fxc kernel model.
subroutine, public create_kernel_env(kernel_env, xc_section, is_rks_triplets, rho_struct_sub, lsd_singlets, do_excitations, sub_env, qs_env)
Create kernel environment.
Define the neighbor list data types and the corresponding functionality.
methods of the rho structure (defined in qs_rho_types)
subroutine, public qs_rho_rebuild(rho, qs_env, rebuild_ao, rebuild_grids, admm, pw_env_external)
rebuilds rho (if necessary allocating and initializing it)
superstucture that hold various representations of the density and keeps track of which ones are vali...
subroutine, public qs_rho_set(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)
...
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 tddfpt_dbcsr_create_by_dist(matrix, template, dbcsr_dist, sab)
Create a DBCSR matrix based on a template matrix, distribution object, and the list of neighbours.
type(xc_rho_cflags_type) function, public xc_functionals_get_needs(functionals, lsd, calc_potential)
...
Exchange and Correlation kernel functionals.
subroutine, public calc_fxc_kernel(fxc_rspace, rho_r, rho_g, tau_r, xc_kernel, triplet, pw_pool)
Exchange and Correlation kernel functional calculations.
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
Exchange and Correlation functional calculations.
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 ...
Collection of variables required to evaluate adiabatic TDDFPT kernel.
keeps the density in various representations, keeping track of which ones are valid.
Parallel (sub)group environment.