56 SUBROUTINE prepare_gapw_den(qs_env, local_rho_set, do_rho0, kind_set_external, pw_env_sub)
60 LOGICAL,
INTENT(IN),
OPTIONAL :: do_rho0
62 POINTER :: kind_set_external
65 CHARACTER(len=*),
PARAMETER :: routinen =
'prepare_gapw_den'
67 INTEGER :: handle, ikind, ispin, natom, nspins, &
69 INTEGER,
DIMENSION(:),
POINTER :: atom_list
70 LOGICAL :: extern, my_do_rho0, paw_atom
71 REAL(
dp) :: rho0_h_tot, tot_rs_int
72 REAL(
dp),
DIMENSION(:),
POINTER :: rho1_h_tot, rho1_s_tot
81 POINTER :: my_rs_descs
88 CALL timeset(routinen, handle)
90 NULLIFY (atomic_kind_set)
93 NULLIFY (gapw_control)
98 NULLIFY (rho1_h_tot, rho1_s_tot)
99 NULLIFY (rho_atom_set)
100 NULLIFY (rho0_atom_set)
103 IF (
PRESENT(do_rho0)) my_do_rho0 = do_rho0
107 CALL get_qs_env(qs_env=qs_env, dft_control=dft_control, &
109 qs_charges=qs_charges, &
110 qs_kind_set=my_kind_set, &
111 atomic_kind_set=atomic_kind_set, &
112 rho0_mpole=rho0_mpole, &
113 rho_atom_set=rho_atom_set, &
114 rho0_atom_set=rho0_atom_set, &
115 rhoz_cneo_set=rhoz_cneo_set)
117 gapw_control => dft_control%qs_control%gapw_control
120 IF (
PRESENT(local_rho_set))
THEN
121 rho_atom_set => local_rho_set%rho_atom_set
122 rhoz_cneo_set => local_rho_set%rhoz_cneo_set
124 rho0_mpole => local_rho_set%rho0_mpole
125 rho0_atom_set => local_rho_set%rho0_atom_set
130 IF (
PRESENT(kind_set_external))
THEN
131 cpassert(
ASSOCIATED(kind_set_external))
132 my_kind_set => kind_set_external
136 nspins = dft_control%nspins
139 ALLOCATE (rho1_h_tot(1:nspins), rho1_s_tot(1:nspins))
143 DO ikind = 1,
SIZE(atomic_kind_set)
144 CALL get_atomic_kind(atomic_kind_set(ikind), atom_list=atom_list, natom=natom)
145 CALL get_qs_kind(my_kind_set(ikind), paw_atom=paw_atom)
150 atom_list, natom, nspins, rho1_h_tot, rho1_s_tot)
156 rho0_mpole, atom_list, natom, ikind, my_kind_set(ikind), &
162 IF (.NOT. extern)
THEN
163 CALL para_env%sum(rho1_h_tot)
164 CALL para_env%sum(rho1_s_tot)
166 qs_charges%total_rho1_hard(ispin) = -rho1_h_tot(ispin)
167 qs_charges%total_rho1_soft(ispin) = -rho1_s_tot(ispin)
171 rho0_mpole%total_rho0_h = -rho0_h_tot
174 IF (
PRESENT(pw_env_sub))
THEN
176 NULLIFY (my_pools, my_rs_grids, my_rs_descs)
177 CALL pw_env_get(pw_env=pw_env_sub, rs_grids=my_rs_grids, &
178 rs_descs=my_rs_descs, pw_pools=my_pools)
181 my_rs_grids=my_rs_grids, my_rs_descs=my_rs_descs)
187 IF (abs(rho0_h_tot) .GE. 1.0e-5_dp)
THEN
188 IF (abs(1.0_dp - abs(tot_rs_int/rho0_h_tot)) .GT. 1.0e-3_dp)
THEN
189 IF (output_unit > 0)
THEN
190 WRITE (output_unit,
'(/,72("*"))')
191 WRITE (output_unit,
'(T2,A,T66,1E20.8)') &
192 "WARNING: rho0 calculated on the local grid is :", -rho0_h_tot, &
193 " rho0 calculated on the global grid is :", tot_rs_int
194 WRITE (output_unit,
'(T2,A)') &
196 WRITE (output_unit,
'(72("*"),/)')
200 qs_charges%total_rho0_soft_rspace = tot_rs_int
201 qs_charges%total_rho0_hard_lebedev = rho0_h_tot
202 IF (rho0_mpole%do_cneo)
THEN
205 IF (abs(rho0_mpole%tot_rhoz_cneo_s) .GE. 1.0e-5_dp)
THEN
206 IF (abs(1.0_dp - abs(tot_rs_int/rho0_mpole%tot_rhoz_cneo_s)) .GT. 1.0e-3_dp)
THEN
207 IF (output_unit > 0)
THEN
208 WRITE (output_unit,
'(/,72("*"))')
209 WRITE (output_unit,
'(T2,A,T66,1E20.8)') &
210 "WARNING: rhoz_cneo_s calculated on the local grid is :", &
211 rho0_mpole%tot_rhoz_cneo_s, &
212 " rhoz_cneo_s calculated on the global grid is :", tot_rs_int
213 WRITE (output_unit,
'(T2,A)') &
215 WRITE (output_unit,
'(72("*"),/)')
219 qs_charges%total_rho1_soft_nuc_rspace = tot_rs_int
220 qs_charges%total_rho1_soft_nuc_lebedev = rho0_mpole%tot_rhoz_cneo_s
222 qs_charges%total_rho1_soft_nuc_rspace = 0.0_dp
225 qs_charges%total_rho0_hard_lebedev = 0.0_dp
229 DEALLOCATE (rho1_h_tot, rho1_s_tot)
231 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, 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.
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.