73 SUBROUTINE fxc_atom_calc(qs_env, rho_atom_set, rho1_atom_set, xc_section, para_env_ext, &
74 do_scale, do_triplet, do_sf, kind_set_external)
77 TYPE(
rho_atom_type),
DIMENSION(:),
POINTER :: rho_atom_set, rho1_atom_set
80 LOGICAL,
INTENT(IN),
OPTIONAL :: do_scale, do_triplet, do_sf
82 POINTER :: kind_set_external
84 CHARACTER(LEN=*),
PARAMETER :: routinen =
'fxc_atom_calc'
86 INTEGER ::
atom, handle, iatom, ikind, ir, na, &
88 INTEGER,
DIMENSION(2) :: local_loop_limit
89 INTEGER,
DIMENSION(2, 3) :: bounds
90 INTEGER,
DIMENSION(:),
POINTER :: atom_list
91 LOGICAL :: accint, donlcc, gradient_functional, &
92 lsd, my_do_sf, nlcc, paw_atom, &
94 REAL(kind=
dp) :: agr, alpha, density_cut, gradient_cut, &
96 REAL(kind=
dp),
CONTIGUOUS,
DIMENSION(:, :, :), &
97 POINTER :: vtau_h, vtau_s, vxc_h, vxc_s
98 REAL(kind=
dp),
DIMENSION(1, 1, 1) :: rtau
99 REAL(kind=
dp),
DIMENSION(1, 1, 1, 1) :: rrho
100 REAL(kind=
dp),
DIMENSION(:, :),
POINTER :: rho_nlcc, weight_h, weight_s
101 REAL(kind=
dp),
DIMENSION(:, :, :),
POINTER :: rho1_h, rho1_s, rho_h, rho_s, tau1_h, &
103 REAL(kind=
dp),
DIMENSION(:, :, :, :),
POINTER :: drho1_h, drho1_s, drho_h, drho_s, vxg_h, &
111 TYPE(
qs_kind_type),
DIMENSION(:),
POINTER :: my_kind_set, qs_kind_set
112 TYPE(
rho_atom_coeff),
DIMENSION(:),
POINTER :: dr1_h, dr1_s, dr_h, dr_s, int_hh, &
113 int_ss, r1_h, r1_s, r_h, r_s
114 TYPE(
rho_atom_coeff),
DIMENSION(:, :),
POINTER :: r1_h_d, r1_s_d, r_h_d, r_s_d
125 CALL timeset(routinen, handle)
127 NULLIFY (qs_kind_set)
128 NULLIFY (rho_h, rho_s, drho_h, drho_s, weight_h, weight_s)
129 NULLIFY (rho1_h, rho1_s, drho1_h, drho1_s)
130 NULLIFY (vxc_h, vxc_s, vxg_h, vxg_s)
131 NULLIFY (tau_h, tau_s, tau1_h, tau1_s, vtau_h, vtau_s)
136 dft_control=dft_control, &
138 qs_kind_set=qs_kind_set, &
139 atomic_kind_set=atomic_kind_set)
141 IF (
PRESENT(kind_set_external))
THEN
142 my_kind_set => kind_set_external
144 my_kind_set => qs_kind_set
148 accint = dft_control%qs_control%gapw_control%accurate_xcint
159 IF (
PRESENT(do_sf)) my_do_sf = do_sf
170 IF (
PRESENT(do_scale))
THEN
174 cpassert(
PRESENT(do_triplet))
176 cpassert(nspins == 1)
179 IF (
PRESENT(do_triplet))
THEN
180 IF (nspins == 1 .AND. do_triplet) lsd = .true.
184 calc_potential=.true.)
185 gradient_functional = needs%drho .OR. needs%drho_spin
186 tau_f = (needs%tau .OR. needs%tau_spin)
187 IF (.NOT. tau_f) rtau = 0.0_dp
190 DO ikind = 1,
SIZE(atomic_kind_set)
192 NULLIFY (atom_list, harmonics, grid_atom)
193 CALL get_atomic_kind(atomic_kind_set(ikind), atom_list=atom_list, natom=natom)
194 CALL get_qs_kind(my_kind_set(ikind), paw_atom=paw_atom, &
195 harmonics=harmonics, grid_atom=grid_atom)
196 CALL get_qs_kind(my_kind_set(ikind), basis_set=basis_1c, basis_type=
"GAPW_1C")
197 IF (.NOT. paw_atom) cycle
200 na = grid_atom%ng_sphere
204 weight_h => grid_atom%weight
205 alpha = dft_control%qs_control%gapw_control%aw(ikind)
206 IF (
ASSOCIATED(grid_atom%gapw_weight_s))
THEN
207 IF (grid_atom%gapw_weight_alpha /= alpha)
DEALLOCATE (grid_atom%gapw_weight_s)
209 IF (.NOT.
ASSOCIATED(grid_atom%gapw_weight_s))
THEN
210 ALLOCATE (grid_atom%gapw_weight_s(na, nr))
212 agr = 1.0_dp - exp(-alpha*grid_atom%rad2(ir))
213 grid_atom%gapw_weight_s(:, ir) = grid_atom%weight(:, ir)*agr
215 grid_atom%gapw_weight_alpha = alpha
217 weight_s => grid_atom%gapw_weight_s
219 weight_h => grid_atom%weight
220 weight_s => grid_atom%weight
232 drho_cutoff=gradient_cut, tau_cutoff=tau_cut)
234 drho_cutoff=gradient_cut, tau_cutoff=tau_cut)
236 drho_cutoff=gradient_cut, tau_cutoff=tau_cut)
238 drho_cutoff=gradient_cut, tau_cutoff=tau_cut)
241 IF (nspins == 1 .AND. .NOT. lsd)
THEN
253 ALLOCATE (rho_h(1:na, 1:nr, 1:nspins), rho1_h(1:na, 1:nr, 1:nspins), &
254 rho_s(1:na, 1:nr, 1:nspins), rho1_s(1:na, 1:nr, 1:nspins))
256 ALLOCATE (vxc_h(1:na, 1:nr, 1:nspins), vxc_s(1:na, 1:nr, 1:nspins))
262 ALLOCATE (tau_h(1:na, 1:nr, 1:nspins), tau1_h(1:na, 1:nr, 1:nspins), &
263 tau_s(1:na, 1:nr, 1:nspins), tau1_s(1:na, 1:nr, 1:nspins))
264 ALLOCATE (vtau_h(1:na, 1:nr, 1:nspins), vtau_s(1:na, 1:nr, 1:nspins))
267 IF (gradient_functional)
THEN
268 ALLOCATE (drho_h(1:4, 1:na, 1:nr, 1:nspins), drho1_h(1:4, 1:na, 1:nr, 1:nspins), &
269 drho_s(1:4, 1:na, 1:nr, 1:nspins), drho1_s(1:4, 1:na, 1:nr, 1:nspins))
270 ALLOCATE (vxg_h(1:3, 1:na, 1:nr, 1:nspins), vxg_s(1:3, 1:na, 1:nr, 1:nspins))
272 ALLOCATE (drho_h(1, 1, 1, 1), drho1_h(1, 1, 1, 1), &
273 drho_s(1, 1, 1, 1), drho1_s(1, 1, 1, 1))
274 ALLOCATE (vxg_h(1, 1, 1, 1), vxg_s(1, 1, 1, 1))
284 rho_nlcc => my_kind_set(ikind)%nlcc_pot
285 IF (
ASSOCIATED(rho_nlcc)) donlcc = .true.
289 IF (
PRESENT(para_env_ext))
THEN
290 local_loop_limit =
get_limit(natom, para_env_ext%num_pe, para_env_ext%mepos)
292 local_loop_limit =
get_limit(natom, para_env%num_pe, para_env%mepos)
295 DO iatom = local_loop_limit(1), local_loop_limit(2)
296 atom = atom_list(iatom)
298 rho_atom_set(
atom)%exc_h = 0.0_dp
299 rho_atom_set(
atom)%exc_s = 0.0_dp
300 rho1_atom_set(
atom)%exc_h = 0.0_dp
301 rho1_atom_set(
atom)%exc_s = 0.0_dp
303 rho_atom => rho_atom_set(
atom)
304 rho1_atom => rho1_atom_set(
atom)
305 NULLIFY (r_h, r_s, dr_h, dr_s, r_h_d, r_s_d)
306 NULLIFY (r1_h, r1_s, dr1_h, dr1_s, r1_h_d, r1_s_d)
311 IF (gradient_functional)
THEN
313 rho_rad_h=r_h, rho_rad_s=r_s, &
314 drho_rad_h=dr_h, drho_rad_s=dr_s, &
315 rho_rad_h_d=r_h_d, rho_rad_s_d=r_s_d)
317 rho_rad_h=r1_h, rho_rad_s=r1_s, &
318 drho_rad_h=dr1_h, drho_rad_s=dr1_s, &
319 rho_rad_h_d=r1_h_d, rho_rad_s_d=r1_s_d)
320 drho_h = 0.0_dp; drho_s = 0.0_dp
321 drho1_h = 0.0_dp; drho1_s = 0.0_dp
324 rho_rad_h=r_h, rho_rad_s=r_s)
326 rho_rad_h=r1_h, rho_rad_s=r1_s)
333 ir, r_h, r_s, rho_h, rho_s, dr_h, dr_s, r_h_d, r_s_d, &
337 ir, rho_nlcc(:, 1), rho_h, rho_s, rho_nlcc(:, 2), drho_h, drho_s)
340 ir, r1_h, r1_s, rho1_h, rho1_s, dr1_h, dr1_s, r1_h_d, r1_s_d, &
344 CALL calc_tau_atom(tau_h, tau_s, rho_atom, tau_basis_cache, nspins)
345 CALL calc_tau_atom(tau1_h, tau1_s, rho1_atom, tau_basis_cache, nspins)
350 IF (gradient_functional)
THEN
351 drho_h = 2.0_dp*drho_h
352 drho_s = 2.0_dp*drho_s
362 CALL fill_rho_set(rho_set_h, lsd, nspins, needs, rho_h, drho_h, tau_h, na, ir)
363 CALL fill_rho_set(rho1_set_h, lsd, nspins, needs, rho1_h, drho1_h, tau1_h, na, ir)
364 CALL fill_rho_set(rho_set_s, lsd, nspins, needs, rho_s, drho_s, tau_s, na, ir)
365 CALL fill_rho_set(rho1_set_s, lsd, nspins, needs, rho1_s, drho1_s, tau1_s, na, ir)
366 ELSE IF (gradient_functional)
THEN
367 CALL fill_rho_set(rho_set_h, lsd, nspins, needs, rho_h, drho_h, rtau, na, ir)
368 CALL fill_rho_set(rho1_set_h, lsd, nspins, needs, rho1_h, drho1_h, rtau, na, ir)
369 CALL fill_rho_set(rho_set_s, lsd, nspins, needs, rho_s, drho_s, rtau, na, ir)
370 CALL fill_rho_set(rho1_set_s, lsd, nspins, needs, rho1_s, drho1_s, rtau, na, ir)
372 CALL fill_rho_set(rho_set_h, lsd, nspins, needs, rho_h, rrho, rtau, na, ir)
373 CALL fill_rho_set(rho1_set_h, lsd, nspins, needs, rho1_h, rrho, rtau, na, ir)
374 CALL fill_rho_set(rho_set_s, lsd, nspins, needs, rho_s, rrho, rtau, na, ir)
375 CALL fill_rho_set(rho1_set_s, lsd, nspins, needs, rho1_s, rrho, rtau, na, ir)
380 rho_set=rho_set_h, rho1_set=rho1_set_h, &
381 deriv_set=deriv_set, &
382 w=weight_h, vxc=vxc_h, vxg=vxg_h, vtau=vtau_h, do_triplet=do_triplet, &
385 rho_set=rho_set_s, rho1_set=rho1_set_s, &
386 deriv_set=deriv_set, &
387 w=weight_s, vxc=vxc_s, vxg=vxg_s, vtau=vtau_s, do_triplet=do_triplet, &
390 CALL get_rho_atom(rho_atom=rho1_atom, ga_vlocal_gb_h=int_hh, ga_vlocal_gb_s=int_ss)
391 IF (gradient_functional)
THEN
392 CALL gavxcgb_gc(vxc_h, vxc_s, vxg_h, vxg_s, int_hh, int_ss, &
393 grid_atom, basis_1c, harmonics, nspins)
396 grid_atom, basis_1c, harmonics, nspins)
399 CALL dgavtaudgb(vtau_h, vtau_s, int_hh, int_ss, &
400 tau_basis_cache, nspins)
403 NULLIFY (r_h, r_s, dr_h, dr_s)
408 DEALLOCATE (rho_h, rho_s, rho1_h, rho1_s, vxc_h, vxc_s)
409 DEALLOCATE (drho_h, drho_s, vxg_h, vxg_s)
410 DEALLOCATE (drho1_h, drho1_s)
412 DEALLOCATE (tau_h, tau_s, tau1_h, tau1_s)
413 DEALLOCATE (vtau_h, vtau_s)
424 CALL timestop(handle)
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, matrix_vhxc, 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.
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, hund_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, proj_shell_charge, lr_atom, do_mtlr, u_j_loop, ao_coef, init_u_ramping_each_scf, reltmat, ghost, monovalent, floating, name, element_symbol, pao_basis_size, pao_model_file, pao_potentials, pao_descriptors, nelec)
Get attributes of an atomic kind.