29 #include "./base/base_uses.f90"
35 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'qs_gapw_densities'
50 TYPE(qs_environment_type),
POINTER :: qs_env
51 TYPE(local_rho_type),
OPTIONAL,
POINTER :: local_rho_set
52 LOGICAL,
INTENT(IN),
OPTIONAL :: do_rho0
53 TYPE(qs_kind_type),
DIMENSION(:),
OPTIONAL, &
54 POINTER :: kind_set_external
56 CHARACTER(len=*),
PARAMETER :: routinen =
'prepare_gapw_den'
58 INTEGER :: handle, ikind, ispin, natom, nspins, &
60 INTEGER,
DIMENSION(:),
POINTER :: atom_list
61 LOGICAL :: extern, my_do_rho0, paw_atom
62 REAL(
dp) :: rho0_h_tot, tot_rs_int
63 REAL(
dp),
DIMENSION(:),
POINTER :: rho1_h_tot, rho1_s_tot
64 TYPE(atomic_kind_type),
DIMENSION(:),
POINTER :: atomic_kind_set
65 TYPE(dft_control_type),
POINTER :: dft_control
66 TYPE(gapw_control_type),
POINTER :: gapw_control
67 TYPE(mp_para_env_type),
POINTER :: para_env
68 TYPE(qs_charges_type),
POINTER :: qs_charges
69 TYPE(qs_kind_type),
DIMENSION(:),
POINTER :: my_kind_set
70 TYPE(rho0_atom_type),
DIMENSION(:),
POINTER :: rho0_atom_set
71 TYPE(rho0_mpole_type),
POINTER :: rho0_mpole
72 TYPE(rho_atom_type),
DIMENSION(:),
POINTER :: rho_atom_set
74 CALL timeset(routinen, handle)
76 NULLIFY (atomic_kind_set)
79 NULLIFY (gapw_control)
84 NULLIFY (rho1_h_tot, rho1_s_tot)
85 NULLIFY (rho_atom_set)
86 NULLIFY (rho0_atom_set)
89 IF (
PRESENT(do_rho0)) my_do_rho0 = do_rho0
93 CALL get_qs_env(qs_env=qs_env, dft_control=dft_control, &
95 qs_charges=qs_charges, &
96 qs_kind_set=my_kind_set, &
97 atomic_kind_set=atomic_kind_set, &
98 rho0_mpole=rho0_mpole, &
99 rho_atom_set=rho_atom_set, &
100 rho0_atom_set=rho0_atom_set)
102 gapw_control => dft_control%qs_control%gapw_control
104 IF (
PRESENT(local_rho_set))
THEN
105 rho_atom_set => local_rho_set%rho_atom_set
107 rho0_mpole => local_rho_set%rho0_mpole
108 rho0_atom_set => local_rho_set%rho0_atom_set
113 IF (
PRESENT(kind_set_external))
THEN
114 cpassert(
ASSOCIATED(kind_set_external))
115 my_kind_set => kind_set_external
119 nspins = dft_control%nspins
122 ALLOCATE (rho1_h_tot(1:nspins), rho1_s_tot(1:nspins))
126 DO ikind = 1,
SIZE(atomic_kind_set)
127 CALL get_atomic_kind(atomic_kind_set(ikind), atom_list=atom_list, natom=natom)
128 CALL get_qs_kind(my_kind_set(ikind), paw_atom=paw_atom)
133 atom_list, natom, nspins, rho1_h_tot, rho1_s_tot)
139 atom_list, natom, ikind, my_kind_set(ikind), rho0_h_tot)
144 IF (.NOT. extern)
THEN
145 CALL para_env%sum(rho1_h_tot)
146 CALL para_env%sum(rho1_s_tot)
148 qs_charges%total_rho1_hard(ispin) = -rho1_h_tot(ispin)
149 qs_charges%total_rho1_soft(ispin) = -rho1_s_tot(ispin)
153 rho0_mpole%total_rho0_h = -rho0_h_tot
156 IF (abs(rho0_h_tot) .GE. 1.0e-5_dp)
THEN
157 IF (abs(1.0_dp - abs(tot_rs_int/rho0_h_tot)) .GT. 1.0e-3_dp)
THEN
158 IF (output_unit > 0)
THEN
159 WRITE (output_unit,
'(/,72("*"))')
160 WRITE (output_unit,
'(T2,A,T66,1E20.8)') &
161 "WARNING: rho0 calculated on the local grid is :", -rho0_h_tot, &
162 " rho0 calculated on the global grid is :", tot_rs_int
163 WRITE (output_unit,
'(T2,A)') &
165 WRITE (output_unit,
'(72("*"),/)')
169 qs_charges%total_rho0_soft_rspace = tot_rs_int
170 qs_charges%total_rho0_hard_lebedev = rho0_h_tot
172 qs_charges%total_rho0_hard_lebedev = 0.0_dp
176 DEALLOCATE (rho1_h_tot, rho1_s_tot)
178 CALL timestop(handle)
Define the atomic kind types and their sub types.
subroutine, public get_atomic_kind(atomic_kind, fist_potential, element_symbol, name, mass, kind_number, natom, atom_list, rcov, rvdw, z, qeff, apol, cpol, mm_radius, shell, shell_active, damping)
Get attributes of an atomic kind.
Defines control structures, which contain the parameters and the settings for the DFT-based calculati...
various routines to log and control the output. The idea is that decisions about where to log should ...
integer function, public cp_logger_get_default_io_unit(logger)
returns the unit nr for the ionode (-1 on all other processors) skips as well checks if the procs cal...
Defines the basic variable types.
integer, parameter, public dp
Interface to the message passing library MPI.
container for information about total charges on the grids
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 prepare_gapw_den(qs_env, local_rho_set, do_rho0, kind_set_external)
...
Define the quickstep kind type and their sub types.
subroutine, public get_qs_kind(qs_kind, basis_set, basis_type, ncgf, nsgf, all_potential, tnadd_potential, gth_potential, sgp_potential, upf_potential, se_parameter, dftb_parameter, xtb_parameter, dftb3_param, 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_r3d_rs_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_potentials, pao_descriptors, nelec)
Get attributes of an atomic kind.
subroutine, public put_rho0_on_grid(qs_env, rho0, tot_rs_int)
...
subroutine, public calculate_rho0_atom(gapw_control, rho_atom_set, rho0_atom_set, rho0_mp, a_list, natom, ikind, qs_kind, rho0_h_tot)
...
subroutine, public calculate_rho_atom(para_env, rho_atom_set, qs_kind, atom_list, natom, nspins, tot_rho1_h, tot_rho1_s)
...