39#include "./base/base_uses.f90"
45 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'qs_tddfpt2_densities'
47 INTEGER,
PARAMETER,
PRIVATE :: maxspins = 2
71 qs_env, sub_env, wfm_rho_orb)
72 TYPE(
qs_rho_type),
POINTER :: rho_orb_struct, rho_xc_struct
73 LOGICAL,
INTENT(in) :: is_rks_triplets
78 CHARACTER(LEN=*),
PARAMETER :: routinen =
'tddfpt_construct_ground_state_orb_density'
80 INTEGER :: handle, ispin, nao, nspins
81 INTEGER,
DIMENSION(maxspins) :: nmo_occ
86 CALL timeset(routinen, handle)
88 nspins =
SIZE(sub_env%mos_occ)
90 CALL cp_fm_get_info(sub_env%mos_occ(ispin), nrow_global=nao, ncol_global=nmo_occ(ispin))
93 CALL qs_rho_get(rho_orb_struct, rho_ao=rho_ij_ao)
95 CALL parallel_gemm(
'N',
'T', nao, nao, nmo_occ(ispin), 1.0_dp, &
96 sub_env%mos_occ(ispin), sub_env%mos_occ(ispin), &
99 CALL copy_fm_to_dbcsr(wfm_rho_orb, rho_ij_ao(ispin)%matrix, keep_sparsity=.true.)
103 IF (nspins == 1 .AND. (.NOT. is_rks_triplets)) &
106 CALL get_qs_env(qs_env, dft_control=dft_control)
108 IF (dft_control%qs_control%gapw)
THEN
110 local_rho_set=sub_env%local_rho_set, &
111 pw_env_external=sub_env%pw_env, &
112 task_list_external=sub_env%task_list_orb_soft, &
113 para_env_external=sub_env%para_env)
114 CALL prepare_gapw_den(qs_env, local_rho_set=sub_env%local_rho_set, pw_env_sub=sub_env%pw_env)
115 ELSEIF (dft_control%qs_control%gapw_xc)
THEN
117 rho_xc_external=rho_xc_struct, &
118 local_rho_set=sub_env%local_rho_set, &
119 pw_env_external=sub_env%pw_env, &
120 task_list_external=sub_env%task_list_orb, &
121 task_list_external_soft=sub_env%task_list_orb_soft, &
122 para_env_external=sub_env%para_env)
123 CALL pw_env_get(sub_env%pw_env, auxbas_pw_pool=auxbas_pw_pool)
124 CALL qs_rho_copy(rho_xc_struct, rho_orb_struct, auxbas_pw_pool, nspins)
125 CALL prepare_gapw_den(qs_env, local_rho_set=sub_env%local_rho_set, do_rho0=.false., &
126 pw_env_sub=sub_env%pw_env)
129 pw_env_external=sub_env%pw_env, &
130 task_list_external=sub_env%task_list_orb, &
131 para_env_external=sub_env%para_env)
134 CALL timestop(handle)
160 wfm_rho_orb, wfm_rho_aux_fit, wfm_aux_orb)
161 TYPE(
qs_rho_type),
POINTER :: rho_orb_struct, rho_aux_fit_struct
165 TYPE(
cp_fm_type),
INTENT(INOUT) :: wfm_rho_orb
166 TYPE(
cp_fm_type),
INTENT(IN) :: wfm_rho_aux_fit, wfm_aux_orb
168 CHARACTER(LEN=*),
PARAMETER :: routinen =
'tddfpt_construct_aux_fit_density'
170 CHARACTER(LEN=default_string_length) :: basis_type
171 INTEGER :: handle, ispin, nao, nao_aux, nspins
172 REAL(kind=
dp),
DIMENSION(:),
POINTER :: tot_rho_aux_fit_r
174 TYPE(
dbcsr_p_type),
DIMENSION(:),
POINTER :: rho_ao_aux_fit, rho_ao_orb
176 POINTER :: sab_aux_fit
182 CALL timeset(routinen, handle)
184 cpassert(
ASSOCIATED(sub_env%admm_A))
186 CALL get_qs_env(qs_env, ks_env=ks_env, admm_env=admm_env)
187 CALL qs_rho_get(rho_orb_struct, rho_ao=rho_ao_orb)
188 CALL qs_rho_get(rho_aux_fit_struct, rho_ao=rho_ao_aux_fit, rho_g=rho_aux_fit_g, &
189 rho_r=rho_aux_fit_r, tot_rho_r=tot_rho_aux_fit_r)
191 nspins =
SIZE(rho_ao_orb)
193 IF (admm_env%do_gapw)
THEN
194 basis_type =
"AUX_FIT_SOFT"
195 task_list => sub_env%task_list_aux_fit_soft
197 basis_type =
"AUX_FIT"
198 task_list => sub_env%task_list_aux_fit
201 CALL cp_fm_get_info(sub_env%admm_A, nrow_global=nao_aux, ncol_global=nao)
205 CALL parallel_gemm(
'N',
'N', nao_aux, nao, nao, 1.0_dp, sub_env%admm_A, &
206 wfm_rho_orb, 0.0_dp, wfm_aux_orb)
207 CALL parallel_gemm(
'N',
'T', nao_aux, nao_aux, nao, 1.0_dp, sub_env%admm_A, wfm_aux_orb, &
208 0.0_dp, wfm_rho_aux_fit)
209 CALL copy_fm_to_dbcsr(wfm_rho_aux_fit, rho_ao_aux_fit(ispin)%matrix, keep_sparsity=.true.)
212 rho=rho_aux_fit_r(ispin), rho_gspace=rho_aux_fit_g(ispin), &
213 total_rho=tot_rho_aux_fit_r(ispin), ks_env=ks_env, &
214 soft_valid=.false., basis_type=basis_type, &
215 pw_env_external=sub_env%pw_env, task_list_external=task_list)
217 IF (admm_env%do_gapw)
THEN
218 CALL get_admm_env(qs_env%admm_env, sab_aux_fit=sab_aux_fit)
220 rho_atom_set=local_rho_set%rho_atom_set, &
221 qs_kind_set=admm_env%admm_gapw_env%admm_kind_set, &
222 oce=admm_env%admm_gapw_env%oce, sab=sab_aux_fit, para_env=sub_env%para_env)
224 do_rho0=.false., kind_set_external=admm_env%admm_gapw_env%admm_kind_set, &
225 pw_env_sub=sub_env%pw_env)
228 CALL timestop(handle)
Types and set/get functions for auxiliary density matrix methods.
subroutine, public get_admm_env(admm_env, mo_derivs_aux_fit, mos_aux_fit, sab_aux_fit, sab_aux_fit_asymm, sab_aux_fit_vs_orb, matrix_s_aux_fit, matrix_s_aux_fit_kp, matrix_s_aux_fit_vs_orb, matrix_s_aux_fit_vs_orb_kp, task_list_aux_fit, matrix_ks_aux_fit, matrix_ks_aux_fit_kp, matrix_ks_aux_fit_im, matrix_ks_aux_fit_dft, matrix_ks_aux_fit_hfx, matrix_ks_aux_fit_dft_kp, matrix_ks_aux_fit_hfx_kp, rho_aux_fit, rho_aux_fit_buffer, admm_dm)
Get routine for the ADMM env.
Defines control structures, which contain the parameters and the settings for the DFT-based calculati...
subroutine, public dbcsr_scale(matrix, alpha_scalar)
...
DBCSR operations in CP2K.
subroutine, public copy_dbcsr_to_fm(matrix, fm)
Copy a DBCSR matrix to a BLACS matrix.
subroutine, public copy_fm_to_dbcsr(fm, matrix, keep_sparsity)
Copy a BLACS matrix to a dbcsr matrix.
represent a full matrix distributed on many processors
subroutine, public cp_fm_get_info(matrix, name, nrow_global, ncol_global, nrow_block, ncol_block, nrow_local, ncol_local, row_indices, col_indices, local_data, context, nrow_locals, ncol_locals, matrix_struct, para_env)
returns all kind of information about the full matrix
Defines the basic variable types.
integer, parameter, public dp
integer, parameter, public default_string_length
basic linear algebra operations for full matrixes
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
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
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, 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, 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)
Get the QUICKSTEP environment.
subroutine, public prepare_gapw_den(qs_env, local_rho_set, do_rho0, kind_set_external, pw_env_sub)
...
Define the neighbor list data types and the corresponding functionality.
subroutine, public calculate_rho_atom_coeff(qs_env, rho_ao, rho_atom_set, qs_kind_set, oce, sab, para_env)
...
methods of the rho structure (defined in qs_rho_types)
subroutine, public qs_rho_update_rho(rho_struct, qs_env, rho_xc_external, local_rho_set, task_list_external, task_list_external_soft, pw_env_external, para_env_external)
updates rho_r and rho_g to the rhorho_ao. if use_kinetic_energy_density also computes tau_r and tau_g...
subroutine, public qs_rho_copy(rho_input, rho_output, auxbas_pw_pool, mspin)
Allocate a density structure and fill it with data from an input structure SIZE(rho_input) == mspin =...
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...
subroutine, public tddfpt_construct_aux_fit_density(rho_orb_struct, rho_aux_fit_struct, local_rho_set, qs_env, sub_env, wfm_rho_orb, wfm_rho_aux_fit, wfm_aux_orb)
Project a charge density expressed in primary basis set into the auxiliary basis set.
subroutine, public tddfpt_construct_ground_state_orb_density(rho_orb_struct, rho_xc_struct, is_rks_triplets, qs_env, sub_env, wfm_rho_orb)
Compute the ground-state charge density expressed in primary basis set.
stores some data used in wavefunction fitting
Manages a pool of grids (to be used for example as tmp objects), but can also be used to instantiate ...
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.
Parallel (sub)group environment.