22 semi_empirical_control_type
27 USE dbcsr_api,
ONLY: dbcsr_add,&
57 semi_empirical_si_type
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.
81 TYPE(qs_environment_type),
POINTER :: qs_env
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
91 TYPE(atomic_kind_type),
DIMENSION(:),
POINTER :: atomic_kind_set
92 TYPE(atprop_type),
POINTER :: atprop
93 TYPE(cp_logger_type),
POINTER :: logger
94 TYPE(dbcsr_p_type),
DIMENSION(:),
POINTER :: ks_matrix, matrix_h, matrix_p, mo_derivs
95 TYPE(dbcsr_type),
POINTER :: mo_coeff
96 TYPE(dft_control_type),
POINTER :: dft_control
97 TYPE(mo_set_type),
DIMENSION(:),
POINTER :: mo_array
98 TYPE(mp_para_env_type),
POINTER :: para_env
99 TYPE(particle_type),
DIMENSION(:),
POINTER :: particle_set
100 TYPE(qs_energy_type),
POINTER :: energy
101 TYPE(qs_ks_env_type),
POINTER :: ks_env
102 TYPE(qs_rho_type),
POINTER :: rho
103 TYPE(section_vals_type),
POINTER :: scf_section
104 TYPE(semi_empirical_control_type),
POINTER :: se_control
105 TYPE(semi_empirical_si_type),
POINTER :: store_int_env
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
251 CALL dbcsr_get_info(mo_coeff, nfullcols_total=ncol_global)
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...
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_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.
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.