15 USE dbcsr_api,
ONLY: dbcsr_p_type
33 #include "./base/base_uses.f90"
39 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'qs_elf_methods'
55 TYPE(qs_environment_type),
POINTER :: qs_env
56 TYPE(pw_r3d_rs_type),
DIMENSION(:),
INTENT(IN) :: elf_r
57 REAL(kind=
dp),
INTENT(IN) :: rho_cutoff
59 CHARACTER(len=*),
PARAMETER :: routinen =
'qs_elf_calc'
60 INTEGER,
DIMENSION(3, 3),
PARAMETER :: nd = reshape((/1, 0, 0, 0, 1, 0, 0, 0, 1/), (/3, 3/))
61 REAL(kind=
dp),
PARAMETER :: elfcut = 0.0001_dp, &
62 f18 = (1.0_dp/8.0_dp), &
63 f23 = (2.0_dp/3.0_dp), &
66 INTEGER :: handle, i, idir, ispin, j, k, nspin
67 INTEGER,
DIMENSION(2, 3) :: bo
68 LOGICAL :: deriv_pw, drho_r_valid, tau_r_valid
69 REAL(kind=
dp) :: cfermi, elf_kernel, norm_drho, rho_53, &
71 TYPE(dbcsr_p_type),
DIMENSION(:),
POINTER :: rho_ao
72 TYPE(dbcsr_p_type),
DIMENSION(:, :),
POINTER :: rho_struct_ao
73 TYPE(pw_c1d_gs_type) :: tmp_g
74 TYPE(pw_env_type),
POINTER :: pw_env
75 TYPE(pw_pool_p_type),
DIMENSION(:),
POINTER :: pw_pools
76 TYPE(pw_pool_type),
POINTER :: auxbas_pw_pool
77 TYPE(pw_r3d_rs_type),
DIMENSION(3) :: drho_r
78 TYPE(pw_r3d_rs_type),
DIMENSION(:),
POINTER :: rho_struct_r, tau_struct_r
79 TYPE(pw_r3d_rs_type),
DIMENSION(:, :),
POINTER :: drho_struct_r
80 TYPE(pw_r3d_rs_type),
POINTER :: rho_r, tau_r
81 TYPE(qs_ks_env_type),
POINTER :: ks_env
82 TYPE(qs_rho_type),
POINTER :: rho_struct
84 CALL timeset(routinen, handle)
86 NULLIFY (rho_struct, rho_r, tau_r, pw_env, auxbas_pw_pool, pw_pools, ks_env)
87 NULLIFY (rho_struct_ao, rho_struct_r, tau_struct_r, drho_struct_r)
89 CALL get_qs_env(qs_env, ks_env=ks_env, pw_env=pw_env, rho=rho_struct)
92 rho_ao_kp=rho_struct_ao, &
95 drho_r=drho_struct_r, &
96 tau_r_valid=tau_r_valid, &
97 drho_r_valid=drho_r_valid)
99 CALL pw_env_get(pw_env, auxbas_pw_pool=auxbas_pw_pool, &
101 nspin =
SIZE(rho_struct_r)
102 bo = rho_struct_r(1)%pw_grid%bounds_local
103 cfermi = (3.0_dp/10.0_dp)*(
pi*
pi*3.0_dp)**f23
107 IF (.NOT. tau_r_valid)
THEN
109 CALL auxbas_pw_pool%create_pw(tau_r)
111 IF (.NOT. tau_r_valid .OR. .NOT. drho_r_valid)
THEN
112 CALL auxbas_pw_pool%create_pw(tmp_g)
114 IF (.NOT. drho_r_valid)
THEN
116 CALL auxbas_pw_pool%create_pw(drho_r(idir))
121 rho_r => rho_struct_r(ispin)
122 IF (tau_r_valid)
THEN
123 tau_r => tau_struct_r(ispin)
125 rho_ao => rho_struct_ao(ispin, :)
130 ks_env=ks_env, soft_valid=.false., &
134 IF (drho_r_valid)
THEN
135 drho_r(:) = drho_struct_r(:, ispin)
139 udvol = 1.0_dp/rho_r%pw_grid%dvol
141 CALL pw_transfer(rho_r, tmp_g)
143 CALL pw_transfer(tmp_g, drho_r(idir))
148 rho_ao => rho_struct_ao(ispin, :)
152 ks_env=ks_env, soft_valid=.false., &
153 compute_tau=.false., compute_grad=.true., idir=idir)
162 DO k = bo(1, 3), bo(2, 3)
163 DO j = bo(1, 2), bo(2, 2)
164 DO i = bo(1, 1), bo(2, 1)
165 norm_drho = drho_r(1)%array(i, j, k)**2 + &
166 drho_r(2)%array(i, j, k)**2 + &
167 drho_r(3)%array(i, j, k)**2
168 norm_drho = norm_drho/max(rho_r%array(i, j, k), rho_cutoff)
169 rho_53 = cfermi*max(rho_r%array(i, j, k), rho_cutoff)**f53
170 elf_kernel = (tau_r%array(i, j, k) - f18*norm_drho) + 2.87e-5_dp
171 elf_kernel = (elf_kernel/rho_53)**2
172 elf_r(ispin)%array(i, j, k) = 1.0_dp/(1.0_dp + elf_kernel)
173 IF (elf_r(ispin)%array(i, j, k) < elfcut) elf_r(ispin)%array(i, j, k) = 0.0_dp
179 IF (.NOT. drho_r_valid)
THEN
181 CALL auxbas_pw_pool%give_back_pw(drho_r(idir))
184 IF (.NOT. tau_r_valid)
THEN
185 CALL auxbas_pw_pool%give_back_pw(tau_r)
188 IF (.NOT. tau_r_valid .OR. .NOT. drho_r_valid)
THEN
189 CALL auxbas_pw_pool%give_back_pw(tmp_g)
192 CALL timestop(handle)
Defines the basic variable types.
integer, parameter, public dp
Definition of mathematical constants and functions.
real(kind=dp), parameter, public pi
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
subroutine, public pw_derive(pw, n)
Calculate the derivative of a plane wave vector.
Manages a pool of grids (to be used for example as tmp objects), but can also be used to instantiate ...
Calculate the plane wave density by collocating the primitive Gaussian functions (pgf).
subroutine, public calculate_rho_elec(matrix_p, matrix_p_kp, rho, rho_gspace, total_rho, ks_env, soft_valid, compute_tau, compute_grad, basis_type, der_type, idir, task_list_external, pw_env_external)
computes the density corresponding to a given density matrix on the grid
Does all kind of post scf calculations for GPW/GAPW.
subroutine, public qs_elf_calc(qs_env, elf_r, rho_cutoff)
...
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.
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...