66#include "./base/base_uses.f90"
72 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'qmmm_se_energy'
95 CHARACTER(len=*),
PARAMETER :: routinen =
'build_se_qmmm_matrix'
97 INTEGER :: handle, i, iatom, ikind, itype, iw, &
98 natom, natorb_a, nkind
99 INTEGER,
DIMENSION(:),
POINTER ::
list
100 LOGICAL :: anag, defined, found
101 REAL(kind=
dp) :: enuclear
102 REAL(kind=
dp),
DIMENSION(:, :),
POINTER :: h_block_a
111 TYPE(
qs_kind_type),
DIMENSION(:),
POINTER :: qs_kind_set
118 CALL timeset(routinen, handle)
122 NULLIFY (matrix_s, atomic_kind_set, qs_kind_set, energy)
123 NULLIFY (se_kind_a, se_kind_mm, se_taper, particles_qm, ks_env, sab_orb)
132 matrix_name=
"OVERLAP", &
133 basis_type_a=
"ORB", &
134 basis_type_b=
"ORB", &
140 atomic_kind_set=atomic_kind_set, &
141 qs_kind_set=qs_kind_set, &
142 ks_qmmm_env=ks_qmmm_env_loc, &
143 dft_control=dft_control, &
144 particle_set=particles_qm)
146 SELECT CASE (dft_control%qs_control%method_id)
152 cpabort(
"Method not available")
154 anag = dft_control%qs_control%se_control%analytical_gradients
157 se_int_control, shortrange=.false., do_ewald_r3=.false., &
158 do_ewald_gks=.false., integral_screening=dft_control%qs_control%se_control%integral_screening, &
163 ALLOCATE (ks_qmmm_env_loc%matrix_h(1)%matrix)
165 CALL dbcsr_copy(ks_qmmm_env_loc%matrix_h(1)%matrix, matrix_s(1)%matrix, &
166 name=
"QMMM HAMILTONIAN MATRIX")
167 CALL dbcsr_set(ks_qmmm_env_loc%matrix_h(1)%matrix, 0.0_dp)
169 SELECT CASE (qmmm_env%qmmm_coupl_type)
175 nkind =
SIZE(atomic_kind_set)
177 kinds:
DO ikind = 1, nkind
179 CALL get_qs_kind(qs_kind_set(ikind), se_parameter=se_kind_a)
183 IF (.NOT. defined .OR. natorb_a < 1) cycle
184 atoms:
DO i = 1,
SIZE(
list)
189 row=iatom, col=iatom, block=h_block_a, found=found)
191 IF (
ASSOCIATED(h_block_a))
THEN
194 CALL build_se_qmmm_matrix_low(h_block_a, &
197 qmmm_env%Potentials, &
199 qmmm_env%mm_atom_chrg, &
200 qmmm_env%mm_atom_index, &
208 qmmm_env%spherical_cutoff, &
211 IF (qmmm_env%move_mm_charges .OR. qmmm_env%add_mm_charges)
THEN
212 CALL build_se_qmmm_matrix_low(h_block_a, &
215 qmmm_env%added_charges%potentials, &
216 qmmm_env%added_charges%added_particles, &
217 qmmm_env%added_charges%mm_atom_chrg, &
218 qmmm_env%added_charges%mm_atom_index, &
226 qmmm_env%spherical_cutoff, &
232 CALL para_env%sum(enuclear)
233 energy%qmmm_nu = enuclear
237 CALL dbcsr_set(ks_qmmm_env_loc%matrix_h(1)%matrix, 0.0_dp)
240 qs_env%input,
"QMMM%PRINT%QMMM_MATRIX"),
cp_p_file))
THEN
244 scale=1.0_dp, output_unit=iw)
246 "QMMM%PRINT%QMMM_MATRIX")
249 CALL timestop(handle)
273 SUBROUTINE build_se_qmmm_matrix_low(h_block_a, se_kind_a, se_kind_mm, potentials, &
274 particles_mm, mm_charges, mm_atom_index, &
275 mm_cell, IndQM, enuclear, itype, se_taper, se_int_control, anag, &
276 qmmm_spherical_cutoff, particles_qm)
278 REAL(kind=
dp),
DIMENSION(:, :),
POINTER :: h_block_a
282 REAL(kind=
dp),
DIMENSION(:),
POINTER :: mm_charges
283 INTEGER,
DIMENSION(:),
POINTER :: mm_atom_index
285 INTEGER,
INTENT(IN) :: indqm
286 REAL(kind=
dp),
INTENT(INOUT) :: enuclear
287 INTEGER,
INTENT(IN) :: itype
290 LOGICAL,
INTENT(IN) :: anag
291 REAL(kind=
dp),
INTENT(IN) :: qmmm_spherical_cutoff(2)
294 CHARACTER(len=*),
PARAMETER :: routinen =
'build_se_qmmm_matrix_low'
296 INTEGER :: handle, i1, i1l, i2, imm, imp, indmm, &
298 REAL(kind=
dp) :: enuc, rt1, rt2, rt3, sph_chrg_factor
299 REAL(kind=
dp),
DIMENSION(3) :: r_pbc, rij
300 REAL(kind=
dp),
DIMENSION(45) :: e1b
303 CALL timeset(routinen, handle)
306 mainlooppot:
DO ipot = 1,
SIZE(potentials)
307 pot => potentials(ipot)%Pot
309 loopmm:
DO imp = 1,
SIZE(pot%mm_atom_index)
310 imm = pot%mm_atom_index(imp)
311 indmm = mm_atom_index(imm)
312 r_pbc =
pbc(particles_mm(indmm)%r - particles_qm(indqm)%r, mm_cell)
316 rij = (/rt1, rt2, rt3/)
317 se_kind_mm%zeff = mm_charges(imm)
319 IF (qmmm_spherical_cutoff(1) > 0.0_dp)
THEN
321 se_kind_mm%zeff = se_kind_mm%zeff*sph_chrg_factor
323 IF (abs(se_kind_mm%zeff) <= epsilon(0.0_dp)) cycle
324 CALL rotnuc(se_kind_a, se_kind_mm, rij, itype=itype, e1b=e1b, anag=anag, &
325 se_int_control=se_int_control, se_taper=se_taper)
326 CALL corecore(se_kind_a, se_kind_mm, rij, itype=itype, enuc=enuc, anag=anag, &
327 se_int_control=se_int_control, se_taper=se_taper)
328 enuclear = enuclear + enuc
332 DO i1l = 1, se_kind_a%natorb
337 h_block_a(i1, j1) = h_block_a(i1, j1) + e1b(i2)
338 h_block_a(j1, i1) = h_block_a(i1, j1)
342 h_block_a(i1, j1) = h_block_a(i1, j1) + e1b(i2)
346 CALL timestop(handle)
347 END SUBROUTINE build_se_qmmm_matrix_low
Define the atomic kind types and their sub types.
subroutine, public get_atomic_kind(atomic_kind, fist_potential, element_symbol, name, mass, kind_number, natom, atom_list, rcov, rvdw, z, qeff, apol, cpol, mm_radius, shell, shell_active, damping)
Get attributes of an atomic kind.
Handles all functions related to the CELL.
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_get_block_p(matrix, row, col, block, found, row_size, col_size)
...
subroutine, public dbcsr_set(matrix, alpha)
...
DBCSR operations in CP2K.
subroutine, public cp_dbcsr_write_sparse_matrix(sparse_matrix, before, after, qs_env, para_env, first_row, last_row, first_col, last_col, scale, output_unit, omit_headers)
...
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,...
integer, parameter, public cp_p_file
integer function, public cp_print_key_should_output(iteration_info, basis_section, print_key_path, used_print_key, first_time)
returns what should be done with the given property if btest(res,cp_p_store) then the property should...
Defines the basic variable types.
integer, parameter, public dp
An array-based list which grows on demand. When the internal array is full, a new array of twice the ...
Interface to the message passing library MPI.
Multipole structure: for multipole (fixed and induced) in FF based MD.
integer, parameter, public do_multipole_none
Define the data structure for the particle information.
Calculation of the QMMM Hamiltonian integral matrix <a|\sum_i q_i|b> for semi-empirical methods.
subroutine, public build_se_qmmm_matrix(qs_env, qmmm_env, particles_mm, mm_cell, para_env)
Constructs the 1-el semi-empirical hamiltonian.
subroutine, public spherical_cutoff_factor(spherical_cutoff, rij, factor)
Computes a spherical cutoff factor for the QMMM interactions.
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.
Define the quickstep kind type and their sub types.
subroutine, public get_qs_kind(qs_kind, basis_set, basis_type, ncgf, nsgf, all_potential, tnadd_potential, gth_potential, sgp_potential, upf_potential, se_parameter, dftb_parameter, xtb_parameter, dftb3_param, zatom, zeff, elec_conf, mao, lmax_dftb, alpha_core_charge, ccore_charge, core_charge, core_charge_radius, paw_proj_set, paw_atom, hard_radius, hard0_radius, max_rad_local, covalent_radius, vdw_radius, gpw_type_forced, harmonics, max_iso_not0, max_s_harm, grid_atom, ngrid_ang, ngrid_rad, lmax_rho0, dft_plus_u_atom, l_of_dft_plus_u, n_of_dft_plus_u, u_minus_j, u_of_dft_plus_u, j_of_dft_plus_u, alpha_of_dft_plus_u, beta_of_dft_plus_u, j0_of_dft_plus_u, occupation_of_dft_plus_u, dispersion, bs_occupation, magnetization, no_optimize, addel, laddel, naddel, orbitals, max_scf, eps_scf, smear, u_ramping, u_minus_j_target, eps_u_ramping, init_u_ramping_each_scf, reltmat, ghost, floating, name, element_symbol, pao_basis_size, pao_model_file, pao_potentials, pao_descriptors, nelec)
Get attributes of an atomic kind.
subroutine, public set_ks_env(ks_env, v_hartree_rspace, s_mstruct_changed, rho_changed, 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_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, 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, task_list, task_list_soft, subsys, dft_control, dbcsr_dist, distribution_2d, pw_env, para_env, blacs_env)
...
Define the neighbor list data types and the corresponding functionality.
Generate the atomic neighbor lists.
subroutine, public build_qs_neighbor_lists(qs_env, para_env, molecular, force_env_section)
Build all the required neighbor lists for Quickstep.
Calculation of overlap matrix, its derivatives and forces.
subroutine, public build_overlap_matrix(ks_env, matrix_s, matrixkp_s, matrix_name, nderivative, basis_type_a, basis_type_b, sab_nl, calculate_forces, matrix_p, matrixkp_p)
Calculation of the overlap matrix over Cartesian Gaussian functions.
Arrays of parameters used in the semi-empirical calculations \References Everywhere in this module TC...
integer, dimension(9), public se_orbital_pointer
Set of wrappers for semi-empirical analytical/numerical Integrals routines.
subroutine, public rotnuc(sepi, sepj, rij, e1b, e2a, itype, anag, se_int_control, se_taper, store_int_env)
wrapper for numerical/analytical 1 center 1 electron integrals
subroutine, public corecore(sepi, sepj, rij, enuc, itype, anag, se_int_control, se_taper)
wrapper for numerical/analytical routines core-core integrals, since are evaluated only once do not n...
Definition of the semi empirical parameter types.
subroutine, public semi_empirical_create(sep)
Allocate semi-empirical type.
subroutine, public setup_se_int_control_type(se_int_control, shortrange, do_ewald_r3, do_ewald_gks, integral_screening, max_multipole, pc_coulomb_int)
Setup the Semiempirical integral control type.
subroutine, public get_se_param(sep, name, typ, defined, z, zeff, natorb, eheat, beta, sto_exponents, uss, upp, udd, uff, alp, eisol, gss, gsp, gpp, gp2, acoul, nr, de, ass, asp, app, hsp, gsd, gpd, gdd, ppddg, dpddg, ngauss)
Get info from the semi-empirical type.
subroutine, public semi_empirical_release(sep)
Deallocate the semi-empirical type.
Working with the semi empirical parameter types.
integer function, public get_se_type(se_method)
Gives back the unique semi_empirical METHOD type.
subroutine, public se_param_set_default(sep, z, method)
Initialize parameter for a semi_empirival type.
Provides all information about an atomic kind.
Type defining parameters related to the simulation cell.
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
Provides all information about a quickstep kind.
calculation environment to calculate the ks_qmmm matrix, holds the QM/MM potential and all the needed...
calculation environment to calculate the ks matrix, holds all the needed vars. assumes that the core ...
Taper type use in semi-empirical calculations.