58#include "./base/base_uses.f90"
63 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'se_fock_matrix'
64 LOGICAL,
PARAMETER,
PRIVATE :: debug_this_module = .false.
65 LOGICAL,
PARAMETER,
PRIVATE :: debug_energy_coulomb_lr = .false.
82 LOGICAL,
INTENT(in) :: calculate_forces, just_energy
84 CHARACTER(len=*),
PARAMETER :: routinen =
'build_se_fock_matrix'
86 INTEGER :: handle, ispin, natom, ncol_global, &
88 LOGICAL :: s_mstruct_changed
89 REAL(kind=
dp) :: ecoul, qmmm_el
90 REAL(kind=
dp),
DIMENSION(:),
POINTER :: occupation_numbers
94 TYPE(
dbcsr_p_type),
DIMENSION(:),
POINTER :: ks_matrix, matrix_h, matrix_p, mo_derivs
97 TYPE(
mo_set_type),
DIMENSION(:),
POINTER :: mo_array
107 CALL timeset(routinen, handle)
108 NULLIFY (matrix_h, dft_control, logger, scf_section, store_int_env, se_control)
109 NULLIFY (atomic_kind_set, atprop)
110 NULLIFY (ks_env, ks_matrix, rho, energy)
112 cpassert(
ASSOCIATED(qs_env))
115 dft_control=dft_control, &
118 se_store_int_env=store_int_env, &
120 atomic_kind_set=atomic_kind_set, &
121 s_mstruct_changed=s_mstruct_changed, &
123 matrix_ks=ks_matrix, &
127 SELECT CASE (dft_control%qs_control%method_id)
130 cpabort(
"Fock Matrix not available for the chosen parameterization! ")
136 nspins = dft_control%nspins
137 cpassert(((nspins >= 1) .AND. (nspins <= 2)))
138 cpassert(
ASSOCIATED(matrix_h))
139 cpassert(
ASSOCIATED(rho))
140 cpassert(
SIZE(ks_matrix) > 0)
142 se_control => dft_control%qs_control%se_control
146 energy%qmmm_el = 0.0_dp
147 energy%total = 0.0_dp
151 CALL dbcsr_copy(ks_matrix(ispin)%matrix, matrix_h(1)%matrix)
155 IF (atprop%energy)
THEN
156 CALL get_qs_env(qs_env=qs_env, particle_set=particle_set)
157 natom =
SIZE(particle_set)
169 IF (debug_energy_coulomb_lr .AND. se_control%do_ewald)
THEN
171 calculate_forces, store_int_env)
175 IF (se_control%do_ewald)
THEN
181 IF (se_control%do_ewald_r3)
THEN
188 IF (atprop%energy)
THEN
189 atprop%atecoul = 0.5_dp*atprop%atecoul
195 CALL dbcsr_dot(ks_matrix(ispin)%matrix, matrix_p(ispin)%matrix, ecoul)
196 energy%hartree = energy%hartree + ecoul
202 IF (qs_env%qmmm)
THEN
205 CALL dbcsr_add(ks_matrix(ispin)%matrix, qs_env%ks_qmmm_env%matrix_h(1)%matrix, &
208 CALL dbcsr_dot(qs_env%ks_qmmm_env%matrix_h(1)%matrix, &
209 matrix_p(ispin)%matrix, qmmm_el)
210 energy%qmmm_el = energy%qmmm_el + qmmm_el
216 energy%mulliken = 0.0_dp
218 energy%total = energy%total + energy%core + &
219 energy%core_overlap + &
220 0.5_dp*energy%hartree + &
222 energy%dispersion + &
229 IF (output_unit > 0)
THEN
230 WRITE (unit=output_unit, fmt=
"(/,(T3,A,T60,F20.10))") &
231 "Core Hamiltonian energy: ", energy%core, &
232 "Two-electron integral energy: ", energy%hartree
233 IF (qs_env%qmmm)
THEN
234 WRITE (unit=output_unit, fmt=
"(T3,A,T60,F20.10)") &
235 "QM/MM Electrostatic energy: ", energy%qmmm_el
240 "PRINT%DETAILED_ENERGY")
243 IF (qs_env%requires_mo_derivs .AND. .NOT. just_energy)
THEN
244 CALL get_qs_env(qs_env, mo_derivs=mo_derivs, mos=mo_array)
245 DO ispin = 1,
SIZE(mo_derivs)
247 mo_coeff_b=mo_coeff, occupation_numbers=occupation_numbers)
248 IF (.NOT. mo_array(ispin)%use_mo_coeff_b)
THEN
252 CALL dbcsr_multiply(
'n',
'n', 1.0_dp, ks_matrix(ispin)%matrix, mo_coeff, &
253 0.0_dp, mo_derivs(ispin)%matrix)
259 CALL timestop(handle)
Define the atomic kind types and their sub types.
Holds information on atomic properties.
subroutine, public atprop_array_init(atarray, natom)
...
Defines control structures, which contain the parameters and the settings for the DFT-based calculati...
subroutine, public dbcsr_copy(matrix_b, matrix_a, name, keep_sparsity, keep_imaginary)
...
subroutine, public dbcsr_multiply(transa, transb, alpha, matrix_a, matrix_b, beta, matrix_c, first_row, last_row, first_column, last_column, first_k, last_k, retain_sparsity, filter_eps, flop)
...
subroutine, public dbcsr_get_info(matrix, nblkrows_total, nblkcols_total, nfullrows_total, nfullcols_total, nblkrows_local, nblkcols_local, nfullrows_local, nfullcols_local, my_prow, my_pcol, local_rows, local_cols, proc_row_dist, proc_col_dist, row_blk_size, col_blk_size, row_blk_offset, col_blk_offset, distribution, name, matrix_type, group)
...
subroutine, public dbcsr_add(matrix_a, matrix_b, alpha_scalar, beta_scalar)
...
subroutine, public dbcsr_dot(matrix_a, matrix_b, trace)
Computes the dot product of two matrices, also known as the trace of their matrix product.
various routines to log and control the output. The idea is that decisions about where to log should ...
type(cp_logger_type) function, pointer, public cp_get_default_logger()
returns the default logger
routines to handle the output, The idea is to remove the decision of wheter to output and what to out...
integer function, public cp_print_key_unit_nr(logger, basis_section, print_key_path, extension, middle_name, local, log_filename, ignore_should_output, file_form, file_position, file_action, file_status, do_backup, on_file, is_new_file, mpi_io, fout)
...
subroutine, public cp_print_key_finished_output(unit_nr, logger, basis_section, print_key_path, local, ignore_should_output, on_file, mpi_io)
should be called after you finish working with a unit obtained with cp_print_key_unit_nr,...
Defines the basic variable types.
integer, parameter, public dp
Interface to the message passing library MPI.
Define the data structure for the particle information.
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.
Definition and initialisation of the mo data type.
subroutine, public get_mo_set(mo_set, maxocc, homo, lfomo, nao, nelectron, n_el_f, nmo, eigenvalues, occupation_numbers, mo_coeff, mo_coeff_b, uniform_occupation, kts, mu, flexible_electron_count)
Get the components of a MO set data structure.
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...
Module that collects all Coulomb parts of the fock matrix construction.
subroutine, public build_fock_matrix_coulomb(qs_env, ks_matrix, matrix_p, energy, calculate_forces, store_int_env)
Construction of the Coulomb part of the Fock matrix.
subroutine, public build_fock_matrix_coul_lr_r3(qs_env, ks_matrix, matrix_p, energy, calculate_forces)
Construction of the residual part (1/R^3) of the Coulomb long-range term of the Fock matrix The 1/R^3...
subroutine, public build_fock_matrix_coulomb_lr(qs_env, ks_matrix, matrix_p, energy, calculate_forces, store_int_env)
Long-Range part for SE Coulomb interactions.
subroutine, public dbg_energy_coulomb_lr(energy, ks_matrix, nspins, qs_env, matrix_p, calculate_forces, store_int_env)
Debug routine for long-range energy (debug value of EWALD vs VALUE KS)
Construction of the Exchange part of the Fock Matrix.
subroutine, public build_fock_matrix_exchange(qs_env, ks_matrix, matrix_p, calculate_forces, store_int_env)
Construction of the Exchange part of the Fock matrix.
Calculation of the Fock matrix for SE methods.
subroutine, public build_se_fock_matrix(qs_env, calculate_forces, just_energy)
Construction of the Fock matrix for NDDO methods.
Type to store integrals for semi-empirical calculations.
subroutine, public semi_empirical_si_finalize(store_int_env, geometry_did_change)
Deallocate the semi-empirical store integrals type.
subroutine, public semi_empirical_si_initialize(store_int_env, geometry_did_change)
Deallocate the semi-empirical store integrals type.
Provides all information about an atomic kind.
type for the atomic properties
type of a logger, at the moment it contains just a print level starting at which level it should be l...
stores all the informations relevant to an mpi environment
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.
Semi-empirical store integrals type.