19 USE dbcsr_api,
ONLY: dbcsr_p_type
41 #include "./base/base_uses.f90"
50 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'xc_adiabatic_utils'
69 hf_energy, just_energy, calculate_forces, use_virial)
71 TYPE(qs_environment_type),
POINTER :: qs_env
72 TYPE(dbcsr_p_type),
DIMENSION(:, :),
POINTER :: ks_matrix
73 TYPE(qs_rho_type),
POINTER :: rho
74 TYPE(qs_energy_type),
POINTER :: energy
75 TYPE(pw_r3d_rs_type),
DIMENSION(:),
POINTER :: v_rspace_new, v_tau_rspace
76 REAL(
dp),
DIMENSION(:) :: hf_energy
77 LOGICAL,
INTENT(in) :: just_energy, calculate_forces, use_virial
79 CHARACTER(LEN=*),
PARAMETER :: routinen =
'rescale_xc_potential'
81 INTEGER :: adiabatic_functional, adiabatic_model, &
82 handle, n_rep_hf, nimages
83 LOGICAL :: do_adiabatic_rescaling, do_hfx, gapw, &
85 REAL(
dp) :: adiabatic_lambda, adiabatic_omega, &
86 scale_ddfa, scale_ddw0, scale_dex1, &
87 scale_dex2, total_energy_xc
88 TYPE(dbcsr_p_type),
DIMENSION(:),
POINTER :: rho_ao_resp
89 TYPE(dbcsr_p_type),
DIMENSION(:, :),
POINTER :: rho_ao
90 TYPE(dft_control_type),
POINTER :: dft_control
91 TYPE(hfx_type),
DIMENSION(:, :),
POINTER :: x_data
92 TYPE(mp_para_env_type),
POINTER :: para_env
93 TYPE(qs_ks_env_type),
POINTER :: ks_env
94 TYPE(qs_rho_type),
POINTER :: rho_xc
95 TYPE(section_vals_type),
POINTER :: adiabatic_rescaling_section, &
96 hfx_sections, input, xc_section
98 CALL timeset(routinen, handle)
99 NULLIFY (para_env, dft_control, adiabatic_rescaling_section, hfx_sections, &
100 input, xc_section, rho_xc, ks_env, rho_ao, rho_ao_resp, x_data)
103 dft_control=dft_control, &
110 IF (x_data(1, 1)%do_hfx_ri) cpabort(
"RI-HFX not compatible with this kinf of functionals")
111 nimages = dft_control%nimages
112 cpassert(nimages == 1)
117 CALL section_vals_get(adiabatic_rescaling_section, explicit=do_adiabatic_rescaling)
122 gapw = dft_control%qs_control%gapw
123 gapw_xc = dft_control%qs_control%gapw_xc
126 i_val=adiabatic_functional)
128 i_val=adiabatic_model)
130 r_val=adiabatic_lambda)
132 r_val=adiabatic_omega)
133 SELECT CASE (adiabatic_functional)
135 SELECT CASE (adiabatic_model)
138 CALL cp_abort(__location__, &
139 "For this kind of adiababatic hybrid functional 2 HF sections have to be provided. "// &
140 "Please check your input file.")
142 adiabatic_omega, scale_dex1, scale_ddw0, scale_ddfa, &
143 scale_dex2, total_energy_xc)
152 IF (calculate_forces)
THEN
153 cpassert(.NOT. use_virial)
156 para_env, 1, use_virial, &
157 adiabatic_rescale_factor=scale_dex1)
159 para_env, 2, use_virial, &
160 adiabatic_rescale_factor=scale_dex2)
166 CALL qs_vxc_create(ks_env=ks_env, rho_struct=rho_xc, xc_section=xc_section, &
167 vxc_rho=v_rspace_new, vxc_tau=v_tau_rspace, exc=energy%exc, &
168 just_energy=just_energy, adiabatic_rescale_factor=scale_ddfa)
170 CALL qs_vxc_create(ks_env=ks_env, rho_struct=rho, xc_section=xc_section, &
171 vxc_rho=v_rspace_new, vxc_tau=v_tau_rspace, exc=energy%exc, &
172 just_energy=just_energy, adiabatic_rescale_factor=scale_ddfa)
176 IF (gapw .OR. gapw_xc)
THEN
177 CALL calculate_vxc_atom(qs_env, just_energy, energy%exc1, adiabatic_rescale_factor=scale_ddfa)
182 energy%exc = total_energy_xc
186 CALL timestop(handle)
Defines control structures, which contain the parameters and the settings for the DFT-based calculati...
Routines for data exchange between MPI processes.
subroutine, public scale_and_add_fock_to_ks_matrix(para_env, qs_env, ks_matrix, irep, scaling_factor)
Distributes the local full Kohn-Sham matrix to all CPUS. Is called in case of adiabatic rescaling....
Routines to calculate derivatives with respect to basis function origin.
subroutine, public derivatives_four_center(qs_env, rho_ao, rho_ao_resp, hfx_section, para_env, irep, use_virial, adiabatic_rescale_factor, resp_only, external_x_data)
computes four center derivatives for a full basis set and updates the forcesfock_4c arrays....
Types and set/get functions for HFX.
Defines the basic variable types.
integer, parameter, public dp
Interface to the message passing library MPI.
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...
routines that build the integrals of the Vxc potential calculated for the atomic density in the basis...
subroutine, public calculate_vxc_atom(qs_env, energy_only, exc1, gradient_atom_set, adiabatic_rescale_factor, kind_set_external, rho_atom_set_external, xc_section_external)
...
subroutine, public qs_vxc_create(ks_env, rho_struct, xc_section, vxc_rho, vxc_tau, exc, just_energy, edisp, dispersion_env, adiabatic_rescale_factor, pw_env_external)
calculates and allocates the xc potential, already reducing it to the dependence on rho and the one o...
Contains some functions used in the context of adiabatic hybrid functionals.
subroutine, public rescale_mcy3_pade(qs_env, hf_energy, energy, adiabatic_lambda, adiabatic_omega, scale_dEx1, scale_ddW0, scale_dDFA, scale_dEx2, total_energy_xc)
Calculates rescaling factors for XC potentials and energy expression
subroutine, public rescale_xc_potential(qs_env, ks_matrix, rho, energy, v_rspace_new, v_tau_rspace, hf_energy, just_energy, calculate_forces, use_virial)