65#include "./base/base_uses.f90"
71 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'xtb_qresp'
85 REAL(kind=
dp),
DIMENSION(:),
INTENT(INOUT) :: qresp
90 CALL get_qs_env(qs_env=qs_env, dft_control=dft_control)
91 gfn_type = dft_control%qs_control%xtb_control%gfn_type
94 SELECT CASE (gfn_type)
96 CALL build_gfn0_qresp(qs_env, qresp)
98 cpabort(
"QRESP: gfn_type = 1 not available")
100 cpabort(
"QRESP: gfn_type = 2 not available")
102 cpabort(
"QRESP: Unknown gfn_type")
112 SUBROUTINE build_gfn0_qresp(qs_env, qresp)
115 REAL(kind=
dp),
DIMENSION(:),
INTENT(INOUT) :: qresp
117 CHARACTER(LEN=*),
PARAMETER :: routinen =
'build_gfn0_qresp'
119 INTEGER :: atom_a, atom_b, handle, i, iatom, ic, icol, ikind, img, irow, iset, j, jatom, &
120 jkind, jset, ldsab, lmaxa, lmaxb, maxder, n1, n2, na, natom, natorb_a, natorb_b, nb, &
121 ncoa, ncob, nderivatives, nimg, nkind, nsa, nsb, nseta, nsetb, sgfa, sgfb, za, zb
122 INTEGER,
ALLOCATABLE,
DIMENSION(:) :: atom_of_kind, kind_of
123 INTEGER,
DIMENSION(25) :: laoa, laob, naoa, naob
124 INTEGER,
DIMENSION(3) :: cell
125 INTEGER,
DIMENSION(:),
POINTER :: la_max, la_min, lb_max, lb_min, npgfa, &
127 INTEGER,
DIMENSION(:, :),
POINTER :: first_sgfa, first_sgfb
128 INTEGER,
DIMENSION(:, :, :),
POINTER :: cell_to_index
129 LOGICAL :: defined, diagblock, do_nonbonded, found
130 REAL(kind=
dp) :: dr, drx, eeq_energy, ef_energy, etaa, &
131 etab, f2, fqa, fqb, hij, qlambda, &
132 rcova, rcovab, rcovb, rrab
133 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:) :: charges, cnumbers, dcharges
134 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:, :) :: dhuckel, dqhuckel, huckel, owork
135 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:, :, :) :: oint, sint
136 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:, :, :, :) :: kijab
137 REAL(kind=
dp),
DIMENSION(3) :: rij
138 REAL(kind=
dp),
DIMENSION(5) :: hena, henb, kpolya, kpolyb, pia, pib
139 REAL(kind=
dp),
DIMENSION(:),
POINTER :: set_radius_a, set_radius_b
140 REAL(kind=
dp),
DIMENSION(:, :),
POINTER :: pblock, rpgfa, rpgfb, scon_a, scon_b, &
144 TYPE(
dbcsr_p_type),
DIMENSION(:, :),
POINTER :: matrix_p
145 TYPE(
dcnum_type),
ALLOCATABLE,
DIMENSION(:) :: dcnum
153 DIMENSION(:),
POINTER :: nl_iterator
159 TYPE(
qs_kind_type),
DIMENSION(:),
POINTER :: qs_kind_set
165 CALL timeset(routinen, handle)
170 NULLIFY (matrix_p, atomic_kind_set, qs_kind_set, sab_orb, ks_env)
174 atomic_kind_set=atomic_kind_set, &
175 qs_kind_set=qs_kind_set, &
177 dft_control=dft_control, &
180 nkind =
SIZE(atomic_kind_set)
181 xtb_control => dft_control%qs_control%xtb_control
182 do_nonbonded = xtb_control%do_nonbonded
183 nimg = dft_control%nimages
185 maxder =
ncoset(nderivatives)
187 NULLIFY (particle_set)
188 CALL get_qs_env(qs_env=qs_env, particle_set=particle_set)
189 natom =
SIZE(particle_set)
191 atom_of_kind=atom_of_kind, kind_of=kind_of)
197 IF (
SIZE(matrix_p, 1) == 2)
THEN
199 CALL dbcsr_add(matrix_p(1, img)%matrix, matrix_p(2, img)%matrix, &
200 alpha_scalar=1.0_dp, beta_scalar=1.0_dp)
204 NULLIFY (cell_to_index)
206 CALL get_ks_env(ks_env=ks_env, kpoints=kpoints)
211 ALLOCATE (basis_set_list(nkind))
219 ALLOCATE (charges(natom), dcharges(natom))
221 CALL xtb_eeq_calculation(qs_env, charges, cnumbers, eeq_sparam, eeq_energy, ef_energy, qlambda)
222 dcharges = qlambda/real(para_env%num_pe, kind=
dp)
224 CALL get_qs_env(qs_env=qs_env, dispersion_env=dispersion_env)
225 IF (dispersion_env%pp_type ==
vdw_pairpot_dftd4 .AND. dispersion_env%ext_charges)
THEN
226 IF (
ASSOCIATED(dispersion_env%dcharges))
THEN
227 dcharges(1:natom) = dcharges(1:natom) + dispersion_env%dcharges(1:natom)
229 cpwarn(
"gfn0-xTB variational dipole DFTD4 contribution missing")
234 CALL gfn0_huckel(qs_env, cnumbers, charges, huckel, dhuckel, dqhuckel, .true.)
243 iatom=iatom, jatom=jatom, r=rij, cell=cell)
244 CALL get_qs_kind(qs_kind_set(ikind), xtb_parameter=xtb_atom_a)
246 IF (.NOT. defined .OR. natorb_a < 1) cycle
247 CALL get_qs_kind(qs_kind_set(jkind), xtb_parameter=xtb_atom_b)
249 IF (.NOT. defined .OR. natorb_b < 1) cycle
251 dr = sqrt(sum(rij(:)**2))
255 lmax=lmaxa, nshell=nsa, kpoly=kpolya, hen=hena)
257 lmax=lmaxb, nshell=nsb, kpoly=kpolyb, hen=henb)
262 ic = cell_to_index(cell(1), cell(2), cell(3))
266 icol = max(iatom, jatom)
267 irow = min(iatom, jatom)
271 row=irow, col=icol, block=pblock, found=found)
272 cpassert(
ASSOCIATED(pblock))
275 basis_set_a => basis_set_list(ikind)%gto_basis_set
276 IF (.NOT.
ASSOCIATED(basis_set_a)) cycle
277 basis_set_b => basis_set_list(jkind)%gto_basis_set
278 IF (.NOT.
ASSOCIATED(basis_set_b)) cycle
279 atom_a = atom_of_kind(iatom)
280 atom_b = atom_of_kind(jatom)
282 first_sgfa => basis_set_a%first_sgf
283 la_max => basis_set_a%lmax
284 la_min => basis_set_a%lmin
285 npgfa => basis_set_a%npgf
286 nseta = basis_set_a%nset
287 nsgfa => basis_set_a%nsgf_set
288 rpgfa => basis_set_a%pgf_radius
289 set_radius_a => basis_set_a%set_radius
290 scon_a => basis_set_a%scon
291 zeta => basis_set_a%zet
293 first_sgfb => basis_set_b%first_sgf
294 lb_max => basis_set_b%lmax
295 lb_min => basis_set_b%lmin
296 npgfb => basis_set_b%npgf
297 nsetb = basis_set_b%nset
298 nsgfb => basis_set_b%nsgf_set
299 rpgfb => basis_set_b%pgf_radius
300 set_radius_b => basis_set_b%set_radius
301 scon_b => basis_set_b%scon
302 zetb => basis_set_b%zet
305 ALLOCATE (oint(ldsab, ldsab, maxder), owork(ldsab, ldsab))
306 ALLOCATE (sint(natorb_a, natorb_b, maxder))
310 ncoa = npgfa(iset)*
ncoset(la_max(iset))
311 n1 = npgfa(iset)*(
ncoset(la_max(iset)) -
ncoset(la_min(iset) - 1))
312 sgfa = first_sgfa(1, iset)
314 IF (set_radius_a(iset) + set_radius_b(jset) < dr) cycle
315 ncob = npgfb(jset)*
ncoset(lb_max(jset))
316 n2 = npgfb(jset)*(
ncoset(lb_max(jset)) -
ncoset(lb_min(jset) - 1))
317 sgfb = first_sgfb(1, jset)
318 CALL overlap_ab(la_max(iset), la_min(iset), npgfa(iset), rpgfa(:, iset), zeta(:, iset), &
319 lb_max(jset), lb_min(jset), npgfb(jset), rpgfb(:, jset), zetb(:, jset), &
320 rij, sab=oint(:, :, 1))
322 CALL contraction(oint(:, :, 1), owork, ca=scon_a(:, sgfa:), na=n1, ma=nsgfa(iset), &
323 cb=scon_b(:, sgfb:), nb=n2, mb=nsgfb(jset), fscale=1.0_dp, trans=.false.)
324 CALL block_add(
"IN", owork, nsgfa(iset), nsgfb(jset), sint(:, :, 1), sgfa, sgfb, trans=.false.)
329 rcovab = rcova + rcovb
330 rrab = sqrt(dr/rcovab)
331 pia(1:nsa) = 1._dp + kpolya(1:nsa)*rrab
332 pib(1:nsb) = 1._dp + kpolyb(1:nsb)*rrab
336 IF (iatom == jatom .AND. dr < 0.001_dp) diagblock = .true.
339 IF (iatom /= jatom) f2 = 2.0_dp
346 fqa = fqa + pblock(i, i)*dqhuckel(na, iatom)
348 dcharges(iatom) = dcharges(iatom) + fqa
354 hij = 0.5_dp*pia(na)*pib(nb)
355 drx = f2*hij*kijab(i, j, ikind, jkind)*sint(i, j, 1)
356 IF (iatom <= jatom)
THEN
357 fqa = fqa + drx*pblock(i, j)*dqhuckel(na, iatom)
358 fqb = fqb + drx*pblock(i, j)*dqhuckel(nb, jatom)
360 fqa = fqa + drx*pblock(j, i)*dqhuckel(na, iatom)
361 fqb = fqb + drx*pblock(j, i)*dqhuckel(nb, jatom)
365 dcharges(iatom) = dcharges(iatom) + fqa
366 dcharges(jatom) = dcharges(jatom) + fqb
369 DEALLOCATE (oint, owork, sint)
375 CALL para_env%sum(dcharges)
382 DEALLOCATE (huckel, dhuckel, dqhuckel)
387 DEALLOCATE (charges, dcharges)
389 DEALLOCATE (basis_set_list)
390 IF (
SIZE(matrix_p, 1) == 2)
THEN
392 CALL dbcsr_add(matrix_p(1, img)%matrix, matrix_p(2, img)%matrix, alpha_scalar=1.0_dp, &
397 CALL timestop(handle)
399 END SUBROUTINE build_gfn0_qresp
Set of routines to: Contract integrals over primitive Gaussians Decontract (density) matrices Trace m...
Calculation of the overlap integrals over Cartesian Gaussian-type functions.
subroutine, public overlap_ab(la_max, la_min, npgfa, rpgfa, zeta, lb_max, lb_min, npgfb, rpgfb, zetb, rab, sab, dab, ddab)
Calculation of the two-center overlap integrals [a|b] over Cartesian Gaussian-type functions....
Define the atomic kind types and their sub types.
subroutine, public get_atomic_kind_set(atomic_kind_set, atom_of_kind, kind_of, natom_of_kind, maxatom, natom, nshell, fist_potential_present, shell_present, shell_adiabatic, shell_check_distance, damping_present)
Get attributes of an atomic kind set.
Defines control structures, which contain the parameters and the settings for the DFT-based calculati...
subroutine, public dbcsr_get_block_p(matrix, row, col, block, found, row_size, col_size)
...
subroutine, public dbcsr_add(matrix_a, matrix_b, alpha_scalar, beta_scalar)
...
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
Defines the basic variable types.
integer, parameter, public dp
Types and basic routines needed for a kpoint calculation.
subroutine, public get_kpoint_info(kpoint, kp_scheme, nkp_grid, kp_shift, symmetry, verbose, full_grid, use_real_wfn, eps_geo, parallel_group_size, kp_range, nkp, xkp, wkp, para_env, blacs_env_all, para_env_kp, para_env_inter_kp, blacs_env, kp_env, kp_aux_env, mpools, iogrp, nkp_groups, kp_dist, cell_to_index, index_to_cell, sab_nl, sab_nl_nosym, inversion_symmetry_only, symmetry_backend, symmetry_reduction_method)
Retrieve information from a kpoint environment.
Interface to the message passing library MPI.
Provides Cartesian and spherical orbital pointers and indices.
integer, dimension(:), allocatable, public ncoset
Define the data structure for the particle information.
Coordination number routines for dispersion pairpotentials.
subroutine, public cnumber_release(cnumbers, dcnum, derivatives)
...
subroutine, public cnumber_init(qs_env, cnumbers, dcnum, ftype, derivatives, disp_env)
...
Definition of disperson types for DFT calculations.
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, mimic, 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, sab_cneo, 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, xcint_weights, 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, rhoz_cneo_set, ecoul_1c, rho0_s_rs, rho0_s_gs, rhoz_cneo_s_rs, rhoz_cneo_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, do_rixs, tb_tblite)
Get the QUICKSTEP environment.
Some utility functions for the calculation of integrals.
subroutine, public basis_set_list_setup(basis_set_list, basis_type, qs_kind_set)
Set up an easy accessible list of the basis sets for all kinds.
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, cneo_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, monovalent, floating, name, element_symbol, pao_basis_size, pao_model_file, pao_potentials, pao_descriptors, nelec)
Get attributes of an atomic kind.
subroutine, public get_ks_env(ks_env, v_hartree_rspace, s_mstruct_changed, rho_changed, exc_accint, 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, rho, rho_xc, vppl, xcint_weights, rho_core, rho_nlcc, rho_nlcc_g, vee, neighbor_list_id, 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, sab_cneo, task_list, task_list_soft, kpoints, do_kpoints, atomic_kind_set, qs_kind_set, cell, cell_ref, use_ref_cell, particle_set, energy, force, local_particles, local_molecules, molecule_kind_set, molecule_set, subsys, cp_subsys, virial, results, atprop, nkind, natom, dft_control, dbcsr_dist, distribution_2d, pw_env, para_env, blacs_env, nelectron_total, nelectron_spin)
...
Define the neighbor list data types and the corresponding functionality.
subroutine, public neighbor_list_iterator_create(iterator_set, nl, search, nthread)
Neighbor list iterator functions.
subroutine, public neighbor_list_iterator_release(iterator_set)
...
integer function, public neighbor_list_iterate(iterator_set, mepos)
...
subroutine, public get_iterator_info(iterator_set, mepos, ikind, jkind, nkind, ilist, nlist, inode, nnode, iatom, jatom, r, cell)
...
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...
Calculation of charge equilibration in xTB.
subroutine, public xtb_eeq_lagrange(qs_env, dcharges, qlagrange, eeq_sparam)
...
subroutine, public xtb_eeq_calculation(qs_env, charges, cnumbers, eeq_sparam, eeq_energy, ef_energy, lambda)
...
Calculation of EHT matrix elements in xTB Reference: Stefan Grimme, Christoph Bannwarth,...
subroutine, public gfn0_kpair(qs_env, kijab)
...
subroutine, public gfn0_huckel(qs_env, cnumbers, charges, huckel, dhuckel, dqhuckel, calculate_forces)
...
Calculation of charge response in xTB (EEQ only) Reference: Stefan Grimme, Christoph Bannwarth,...
subroutine, public build_xtb_qresp(qs_env, qresp)
...
Definition of the xTB parameter types.
subroutine, public get_xtb_atom_param(xtb_parameter, symbol, aname, typ, defined, z, zeff, natorb, lmax, nao, lao, rcut, rcov, kx, eta, xgamma, alpha, zneff, nshell, nval, lval, kpoly, kappa, hen, zeta, xi, kappa0, alpg, occupation, electronegativity, chmax, en, kqat2, kcn, kq)
...
Provides all information about an atomic kind.
type of a logger, at the moment it contains just a print level starting at which level it should be l...
Contains information about kpoints.
stores all the informations relevant to an mpi environment
Provides all information about a quickstep kind.
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.