55#include "./base/base_uses.f90"
60 LOGICAL,
PRIVATE,
PARAMETER :: debug_this_module = .true.
61 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'qs_update_s_mstruct'
82 CHARACTER(len=*),
PARAMETER :: routinen =
'qs_env_update_s_mstruct'
86 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:) :: cw
91 CALL timeset(routinen, handle)
93 cpassert(
ASSOCIATED(qs_env))
97 dft_control=dft_control)
102 IF (dft_control%qs_control%gapw)
THEN
103 qs_env%qs_charges%total_rho_core_rspace = qs_env%local_rho_set%rhoz_tot
106 qs_env%qs_charges%total_rho1_hard_nuc = qs_env%local_rho_set%rhoz_cneo_tot
107 IF (dft_control%qs_control%gapw_control%nopaw_as_gpw)
THEN
108 cpassert(
ASSOCIATED(rho_core))
110 qs_env%qs_charges%total_rho_core_rspace, qs_env, only_nopaw=.true.)
112 IF (
ASSOCIATED(rho_core))
THEN
113 CALL rho_core%release()
114 DEALLOCATE (rho_core)
119 ELSE IF (dft_control%qs_control%semi_empirical)
THEN
121 ELSE IF (dft_control%qs_control%dftb)
THEN
123 ELSE IF (dft_control%qs_control%xtb)
THEN
126 cpassert(
ASSOCIATED(rho_core))
128 qs_env%qs_charges%total_rho_core_rspace, qs_env)
132 do_ppl = dft_control%qs_control%do_ppl_method ==
do_ppl_grid
136 cpassert(
ASSOCIATED(vppl))
141 NULLIFY (rho_nlcc, rho_nlcc_g)
142 CALL get_qs_env(qs_env, rho_nlcc=rho_nlcc, rho_nlcc_g=rho_nlcc_g)
143 IF (
ASSOCIATED(rho_nlcc))
THEN
149 IF (dft_control%qs_control%gapw .OR. dft_control%qs_control%gapw_xc)
THEN
150 IF (dft_control%qs_control%gapw_control%accurate_xcint)
THEN
151 CALL get_qs_env(qs_env, xcint_weights=xcint_weights, nkind=nk)
155 dft_control%qs_control%gapw_control%oweights, &
156 dft_control%qs_control%gapw_control%aw, cw)
157 xcint_weights%array = 1.0_dp + xcint_weights%array
163 CALL qs_create_task_list(qs_env)
166 IF (
ASSOCIATED(qs_env%cp_ddapc_env))
THEN
168 DEALLOCATE (qs_env%cp_ddapc_env)
176 CALL qs_env_rebuild_rho(qs_env=qs_env)
179 IF (
ASSOCIATED(qs_env%scf_env))
THEN
183 CALL timestop(handle)
191 SUBROUTINE qs_create_task_list(qs_env)
194 CHARACTER(len=*),
PARAMETER :: routinen =
'qs_create_task_list'
196 CHARACTER(LEN=default_string_length) :: basis_type
197 INTEGER :: handle, isub
198 LOGICAL :: composite_direct_ao, composite_reference, native_grid_diagnostics, &
199 paw_one_center, skip_load_balance_distributed, soft_valid
205 CALL timeset(routinen, handle)
206 NULLIFY (ks_env, dft_control, gauxc_section, input, xc_section)
207 CALL get_qs_env(qs_env, ks_env=ks_env, dft_control=dft_control, input=input)
209 soft_valid = (dft_control%qs_control%gapw .OR. dft_control%qs_control%gapw_xc)
212 composite_direct_ao = composite_reference .AND. &
215 native_grid_diagnostics = .false.
217 IF (
ASSOCIATED(gauxc_section))
THEN
219 l_val=native_grid_diagnostics)
221 skip_load_balance_distributed = dft_control%qs_control%skip_load_balance_distributed
222 IF (.NOT. (dft_control%qs_control%semi_empirical &
223 .OR. dft_control%qs_control%xtb &
224 .OR. dft_control%qs_control%dftb))
THEN
226 IF (.NOT. dft_control%qs_control%gapw .OR. composite_direct_ao .OR. &
227 ((composite_reference .OR. paw_one_center) .AND. native_grid_diagnostics))
THEN
229 IF (.NOT.
ASSOCIATED(task_list))
THEN
234 reorder_rs_grid_ranks=.true., &
235 skip_load_balance_distributed=skip_load_balance_distributed)
238 IF (dft_control%qs_control%gapw .OR. dft_control%qs_control%gapw_xc)
THEN
239 CALL get_ks_env(ks_env, task_list_soft=task_list)
240 IF (.NOT.
ASSOCIATED(task_list))
THEN
242 CALL set_ks_env(ks_env, task_list_soft=task_list)
245 reorder_rs_grid_ranks=.true., &
246 skip_load_balance_distributed=skip_load_balance_distributed)
250 IF (dft_control%qs_control%do_kg)
THEN
255 IF (
ASSOCIATED(qs_env%kg_env%subset))
THEN
256 DO isub = 1, qs_env%kg_env%nsubsets
257 IF (
ASSOCIATED(qs_env%kg_env%subset(isub)%task_list))
THEN
262 ALLOCATE (qs_env%kg_env%subset(qs_env%kg_env%nsubsets))
266 basis_type =
"ORB_SOFT"
271 DO isub = 1, qs_env%kg_env%nsubsets
275 basis_type=basis_type, &
276 reorder_rs_grid_ranks=.false., &
277 skip_load_balance_distributed=skip_load_balance_distributed, &
278 sab_orb_external=qs_env%kg_env%subset(isub)%sab_orb)
285 CALL timestop(handle)
287 END SUBROUTINE qs_create_task_list
305 SUBROUTINE qs_env_rebuild_rho(qs_env, rebuild_ao, rebuild_grids)
307 LOGICAL,
INTENT(in),
OPTIONAL :: rebuild_ao, rebuild_grids
309 CHARACTER(len=*),
PARAMETER :: routinen =
'qs_env_rebuild_rho'
312 LOGICAL :: do_admm, gapw_xc
314 TYPE(
qs_rho_type),
POINTER :: rho, rho_external, rho_xc
317 CALL timeset(routinen, handle)
320 dft_control=dft_control, &
323 rho_external=rho_external)
325 gapw_xc = dft_control%qs_control%gapw_xc
326 do_admm = dft_control%do_admm
328 rebuild_ao=rebuild_ao, rebuild_grids=rebuild_grids)
332 rebuild_ao=rebuild_ao, rebuild_grids=rebuild_grids)
336 IF (dft_control%apply_external_density)
THEN
337 IF (.NOT.
ASSOCIATED(rho_external))
THEN
338 ALLOCATE (rho_external)
340 CALL set_qs_env(qs_env, rho_external=rho_external)
343 rebuild_grids=rebuild_grids)
344 dft_control%read_external_density = .true.
347 CALL timestop(handle)
349 END SUBROUTINE qs_env_rebuild_rho
subroutine, public weight_function_pwgrid(rho_core, qs_env, order, calpha, ccore)
computes the weight function on the PW grid
Defines control structures, which contain the parameters and the settings for the DFT-based calculati...
contains information regarding the decoupling/recoupling method of Bloechl
subroutine, public cp_ddapc_release(cp_ddapc_env)
...
Density Derived atomic point charges from a QM calculation (see Bloechl, J. Chem. Phys....
subroutine, public cp_ddapc_init(qs_env)
Initialize the cp_ddapc_environment.
Defines the basic variable types.
integer, parameter, public dp
integer, parameter, public default_string_length
Calculate the plane wave density by collocating the primitive Gaussian functions (pgf).
subroutine, public calculate_rho_nlcc(rho_nlcc, qs_env)
computes the density of the non-linear core correction on the grid
subroutine, public calculate_ppl_grid(vppl, qs_env)
computes the local pseudopotential (without erf term) on the grid
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 set_qs_env(qs_env, super_cell, mos, qmmm, qmmm_periodic, mimic, ewald_env, ewald_pw, mpools, rho_external, external_vxc, mask, scf_control, rel_control, qs_charges, ks_env, ks_qmmm_env, wf_history, scf_env, active_space, input, oce, rho_atom_set, rho0_atom_set, rho0_mpole, run_rtp, rtp, rhoz_set, rhoz_tot, ecoul_1c, has_unit_metric, requires_mo_derivs, mo_derivs, mo_loc_history, efield, rhoz_cneo_set, linres_control, xas_env, cp_ddapc_env, cp_ddapc_ewald, outer_scf_history, outer_scf_ihistory, x_data, et_coupling, dftb_potential, se_taper, se_store_int_env, se_nddo_mpole, se_nonbond_env, admm_env, ls_scf_env, do_transport, transport_env, lri_env, lri_density, exstate_env, ec_env, dispersion_env, harris_env, gcp_env, mp2_env, bs_env, kg_env, force, kpoints, wanniercentres, almo_scf_env, gradient_history, variable_history, embed_pot, spin_embed_pot, polar_env, mos_last_converged, eeq, rhs, do_rixs, tb_tblite)
Set the QUICKSTEP environment.
subroutine, public set_ks_env(ks_env, v_hartree_rspace, s_mstruct_changed, rho_changed, exc_accint, potential_changed, forces_up_to_date, complex_ks, matrix_h, matrix_h_im, matrix_ks, matrix_ks_im, matrix_vxc, kinetic, matrix_s, matrix_s_ri_aux, matrix_w, matrix_p_mp2, matrix_p_mp2_admm, matrix_vhxc, matrix_h_kp, matrix_h_im_kp, matrix_ks_kp, matrix_vxc_kp, kinetic_kp, matrix_s_kp, matrix_w_kp, matrix_s_ri_aux_kp, matrix_ks_im_kp, vppl, xcint_weights, rho_core, rho_nlcc, rho_nlcc_g, vee, neighbor_list_id, kpoints, sab_orb, sab_all, sac_ae, sac_ppl, sac_lri, sap_ppnl, sap_oce, sab_lrc, sab_se, sab_xtbe, sab_tbe, sab_core, sab_xb, sab_xtb_pp, sab_xtb_nonbond, sab_vdw, sab_scp, sab_almo, sab_kp, sab_kp_nosym, sab_cneo, task_list, task_list_soft, subsys, dft_control, dbcsr_dist, distribution_2d, pw_env, para_env, blacs_env)
...
subroutine, public qs_ks_did_change(ks_env, s_mstruct_changed, rho_changed, potential_changed, full_reset)
tells that some of the things relevant to the ks calculation did change. has to be called when change...
subroutine, public get_ks_env(ks_env, v_hartree_rspace, s_mstruct_changed, rho_changed, exc_accint, potential_changed, forces_up_to_date, complex_ks, matrix_h, matrix_h_im, matrix_ks, matrix_ks_im, matrix_vxc, kinetic, matrix_s, matrix_s_ri_aux, matrix_w, matrix_p_mp2, matrix_p_mp2_admm, matrix_vhxc, matrix_h_kp, matrix_h_im_kp, matrix_ks_kp, matrix_vxc_kp, kinetic_kp, matrix_s_kp, matrix_w_kp, matrix_s_ri_aux_kp, matrix_ks_im_kp, rho, rho_xc, vppl, xcint_weights, rho_core, rho_nlcc, rho_nlcc_g, vee, neighbor_list_id, sab_orb, sab_all, sac_ae, sac_ppl, sac_lri, sap_ppnl, sap_oce, sab_lrc, sab_se, sab_xtbe, sab_tbe, sab_core, sab_xb, sab_xtb_pp, sab_xtb_nonbond, sab_vdw, sab_scp, sab_almo, sab_kp, sab_kp_nosym, sab_cneo, task_list, task_list_soft, kpoints, do_kpoints, atomic_kind_set, qs_kind_set, cell, cell_ref, use_ref_cell, particle_set, energy, force, local_particles, local_molecules, molecule_kind_set, molecule_set, subsys, cp_subsys, virial, results, atprop, nkind, natom, dft_control, dbcsr_dist, distribution_2d, pw_env, para_env, blacs_env, nelectron_total, nelectron_spin)
...
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_create(rho)
Allocates a new instance of rho.
module that contains the definitions of the scf types
subroutine, public scf_env_did_change(scf_env)
function to be called to inform the scf_env about changes
qs_environment methods that use many other modules
subroutine, public qs_env_update_s_mstruct(qs_env)
updates the s_mstruct to reflect the new overlap structure, and also updates rho_core distribution....
Experimental CP2K-native GPW real-space-grid path for SKALA TorchScript models.
logical function, public native_skala_gapw_composite_direct_ao(xc_section)
Return true if the GAPW composite reference uses direct full-ORB collocation.
integer function, public skala_gapw_representation(xc_section)
Return the pseudopotential GAPW representation selected for an active model.
type(section_vals_type) function, pointer, public get_gauxc_section(xc_section)
Return the first GAUXC functional subsection, if present.
logical function, public native_skala_gapw_composite_reference(xc_section)
Return true if native SKALA should use the full GAPW ORB density on one common grid.
generate the tasks lists used by collocate and integrate routines
subroutine, public generate_qs_task_list(ks_env, task_list, basis_type, reorder_rs_grid_ranks, skip_load_balance_distributed, pw_env_external, sab_orb_external, ext_kpoints)
...
subroutine, public deallocate_task_list(task_list)
deallocates the components and the object itself
subroutine, public allocate_task_list(task_list)
allocates and initialised the components of the task_list_type
calculation environment to calculate the ks matrix, holds all the needed vars. assumes that the core ...
keeps the density in various representations, keeping track of which ones are valid.