22 USE dbcsr_api,
ONLY: dbcsr_copy,&
23 dbcsr_deallocate_matrix,&
58 tddfpt_subgroup_env_type
59 #include "./base/base_uses.f90"
65 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'qs_tddfpt2_lri_utils'
80 TYPE(qs_environment_type),
INTENT(IN),
POINTER :: qs_env
81 TYPE(kernel_env_type) :: kernel_env
82 TYPE(section_vals_type),
INTENT(IN),
POINTER :: lri_section, tddfpt_print_section
84 CHARACTER(len=*),
PARAMETER :: routinen =
'tddfpt2_lri_init'
86 INTEGER :: basis_sort, handle, ikind, lmax_sphere, &
87 maxl, maxlgto, maxlgto_lri, nkind
88 LOGICAL :: explicit, mic, molecule_only, &
89 redefine_interaction_radii
90 LOGICAL,
ALLOCATABLE,
DIMENSION(:) :: orb_present
92 REAL(
dp),
ALLOCATABLE,
DIMENSION(:) :: orb_radius
93 REAL(
dp),
ALLOCATABLE,
DIMENSION(:, :) :: pair_radius
94 TYPE(atomic_kind_type),
DIMENSION(:),
POINTER :: atomic_kind_set
95 TYPE(cell_type),
POINTER :: cell
96 TYPE(dft_control_type),
POINTER :: dft_control
97 TYPE(distribution_1d_type),
POINTER :: distribution_1d
98 TYPE(distribution_2d_type),
POINTER :: distribution_2d
99 TYPE(gto_basis_set_type),
POINTER :: orb_basis_set, p_lri_aux_basis
100 TYPE(local_atoms_type),
ALLOCATABLE,
DIMENSION(:) :: atom2d
101 TYPE(lri_environment_type),
POINTER :: lri_env
102 TYPE(molecule_type),
DIMENSION(:),
POINTER :: molecule_set
103 TYPE(mp_para_env_type),
POINTER :: para_env
104 TYPE(neighbor_list_set_p_type),
DIMENSION(:), &
106 TYPE(particle_type),
DIMENSION(:),
POINTER :: particle_set
107 TYPE(qs_kind_type),
DIMENSION(:),
POINTER :: qs_kind_set
108 TYPE(qs_kind_type),
POINTER :: qs_kind
109 TYPE(section_vals_type),
POINTER :: neighbor_list_section, print_section
110 TYPE(tddfpt2_control_type),
POINTER :: tddfpt2_control
112 CALL timeset(routinen, handle)
114 CALL get_qs_env(qs_env, dft_control=dft_control)
115 tddfpt2_control => dft_control%tddfpt2_control
117 NULLIFY (kernel_env%full_kernel%lri_env)
119 CALL lri_env_init(kernel_env%full_kernel%lri_env, lri_section)
121 lri_env => kernel_env%full_kernel%lri_env
122 redefine_interaction_radii = .false.
125 IF (lri_env%exact_1c_terms)
THEN
126 cpabort(
"TDDFT with LRI and exact one-center terms not implemented")
130 CALL get_qs_env(qs_env, qs_kind_set=qs_kind_set)
131 nkind =
SIZE(qs_kind_set)
133 NULLIFY (p_lri_aux_basis)
134 qs_kind => qs_kind_set(ikind)
135 CALL get_qs_kind(qs_kind, basis_set=p_lri_aux_basis, basis_type=
"P_LRI_AUX")
136 IF (.NOT. (
ASSOCIATED(p_lri_aux_basis)))
THEN
138 redefine_interaction_radii = .true.
140 dft_control%auto_basis_p_lri_aux, lri_env%exact_1c_terms, &
146 IF (redefine_interaction_radii)
THEN
148 CALL get_qs_kind(qs_kind_set(ikind), basis_set=p_lri_aux_basis, basis_type=
"P_LRI_AUX")
149 IF (
ASSOCIATED(p_lri_aux_basis))
THEN
166 CALL get_qs_kind_set(qs_kind_set, maxlgto=maxlgto_lri, basis_type=
"P_LRI_AUX")
168 maxlgto = max(maxlgto, maxlgto_lri)
169 lmax_sphere = 2*maxlgto
170 maxl = max(2*maxlgto, lmax_sphere) + 1
187 NULLIFY (cell, para_env, particle_set)
188 CALL get_qs_env(qs_env, para_env=para_env, cell=cell, particle_set=particle_set)
190 NULLIFY (distribution_1d, distribution_2d, atomic_kind_set, molecule_set)
191 CALL get_qs_env(qs_env, local_particles=distribution_1d, distribution_2d=distribution_2d, &
192 atomic_kind_set=atomic_kind_set, molecule_set=molecule_set)
194 ALLOCATE (atom2d(nkind))
195 molecule_only = .false.
196 CALL atom2d_build(atom2d, distribution_1d, distribution_2d, atomic_kind_set, &
197 molecule_set, molecule_only, particle_set=particle_set)
199 ALLOCATE (orb_present(nkind), orb_radius(nkind), pair_radius(nkind, nkind))
200 orb_radius(:) = 0.0_dp
201 pair_radius(:, :) = 0.0_dp
202 orb_present(:) = .false.
204 CALL get_qs_kind(qs_kind_set(ikind), basis_set=orb_basis_set, basis_type=
"ORB")
205 IF (
ASSOCIATED(orb_basis_set))
THEN
206 orb_present(ikind) = .true.
207 CALL get_gto_basis_set(gto_basis_set=orb_basis_set, kind_radius=orb_radius(ikind))
209 orb_present(ikind) = .false.
213 CALL pair_radius_setup(orb_present, orb_present, orb_radius, orb_radius, pair_radius)
216 soo_list => lri_env%soo_list
220 mic=mic, molecular=molecule_only, subcells=subcells, nlname=
"soo_list")
225 "/SOO_LIST",
"soo_list",
"ORBITAL ORBITAL (RI)")
226 lri_env%soo_list => soo_list
230 DEALLOCATE (orb_present, orb_radius, pair_radius)
233 lri_env%ppl_ri = .false.
235 kernel_env%full_kernel%lri_env => lri_env
239 CALL timestop(handle)
251 TYPE(qs_environment_type),
INTENT(IN),
POINTER :: qs_env
252 TYPE(tddfpt_subgroup_env_type),
INTENT(IN) :: sub_env
253 TYPE(lri_environment_type),
INTENT(IN),
POINTER :: lri_env
254 TYPE(lri_kind_type),
DIMENSION(:),
INTENT(IN), &
256 TYPE(dbcsr_p_type),
DIMENSION(:),
POINTER :: a_ia_munu_sub
258 CHARACTER(len=*),
PARAMETER :: routinen =
'tddfpt2_lri_Amat'
260 INTEGER :: handle, ispin, nspins
261 TYPE(atomic_kind_type),
DIMENSION(:),
POINTER :: atomic_kind_set
262 TYPE(dbcsr_p_type),
DIMENSION(:),
POINTER :: dummymat, matrix_s
264 CALL timeset(routinen, handle)
265 NULLIFY (atomic_kind_set)
267 CALL get_qs_env(qs_env, atomic_kind_set=atomic_kind_set, matrix_s=matrix_s)
268 nspins =
SIZE(a_ia_munu_sub)
274 dbcsr_dist=sub_env%dbcsr_dist, sab=sub_env%sab_orb)
276 CALL dbcsr_copy(a_ia_munu_sub(ispin)%matrix, dummymat(1)%matrix)
280 CALL dbcsr_copy(a_ia_munu_sub(ispin)%matrix, dummymat(1)%matrix)
282 CALL dbcsr_deallocate_matrix(dummymat(1)%matrix)
283 DEALLOCATE (dummymat)
285 CALL timestop(handle)
Define the atomic kind types and their sub types.
Automatic generation of auxiliary basis sets of different kind.
subroutine, public create_lri_aux_basis_set(lri_aux_basis_set, qs_kind, basis_cntrl, exact_1c_terms, tda_kernel)
Create a LRI_AUX basis set using some heuristics.
subroutine, public add_basis_set_to_container(container, basis_set, basis_set_type)
...
Print basis sets in CP2K format.
subroutine, public print_basis_set_file(qs_env, base_section)
...
subroutine, public sort_gto_basis_set(basis_set, sort_method)
sort basis sets w.r.t. radius
subroutine, public init_orb_basis_set(gto_basis_set)
Initialise a Gaussian-type orbital (GTO) basis set data set.
subroutine, public get_gto_basis_set(gto_basis_set, name, aliases, norm_type, kind_radius, ncgf, nset, nsgf, cgf_symbol, sgf_symbol, norm_cgf, set_radius, lmax, lmin, lx, ly, lz, m, ncgf_set, npgf, nsgf_set, nshell, cphi, pgf_radius, sphi, scon, zet, first_cgf, first_sgf, l, last_cgf, last_sgf, n, gcc, maxco, maxl, maxpgf, maxsgf_set, maxshell, maxso, nco_sum, npgf_sum, nshell_sum, maxder, short_kind_radius)
...
Handles all functions related to the CELL.
Defines control structures, which contain the parameters and the settings for the DFT-based calculati...
DBCSR operations in CP2K.
stores a lists of integer that are local to a processor. The idea is that these integers represent ob...
stores a mapping of 2D info (e.g. matrix) on a 2D processor distribution (i.e. blacs grid) where cpus...
Defines the basic variable types.
integer, parameter, public dp
initializes the environment for lri lri : local resolution of the identity
subroutine, public lri_env_init(lri_env, lri_section)
initializes the lri env
subroutine, public lri_env_basis(ri_type, qs_env, lri_env, qs_kind_set)
initializes the lri env
Calculates integral matrices for LRIGPW method lri : local resolution of the identity.
subroutine, public build_lri_matrices(lri_env, qs_env)
creates and initializes an lri_env
contains the types and subroutines for dealing with the lri_env lri : local resolution of the identit...
routines that build the Kohn-Sham matrix for the LRIGPW and xc parts
subroutine, public calculate_lri_ks_matrix(lri_env, lri_v_int, h_matrix, atomic_kind_set, cell_to_index)
update of LRIGPW KS matrix
Interface to the message passing library MPI.
Define the data structure for the molecule information.
Provides Cartesian and spherical orbital pointers and indices.
subroutine, public init_orbital_pointers(maxl)
Initialize or update the orbital pointers.
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.
Calculate the interaction radii for the operator matrix calculation.
subroutine, public init_interaction_radii_orb_basis(orb_basis_set, eps_pgf_orb, eps_pgf_short)
...
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, 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_r3d_rs_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_potentials, pao_descriptors, nelec)
Get attributes of an atomic kind.
subroutine, public get_qs_kind_set(qs_kind_set, all_potential_present, tnadd_potential_present, gth_potential_present, sgp_potential_present, paw_atom_present, dft_plus_u_atom_present, maxcgf, maxsgf, maxco, maxco_proj, maxgtops, maxlgto, maxlprj, maxnset, maxsgf_set, ncgf, npgf, nset, nsgf, nshell, maxpol, maxlppl, maxlppnl, maxppnl, nelectron, maxder, max_ngrid_rad, max_sph_harm, maxg_iso_not0, lmax_rho0, basis_rcut, basis_type, total_zeff_corr)
Get attributes of an atomic kind set.
Define the neighbor list data types and the corresponding functionality.
Generate the atomic neighbor lists.
subroutine, public atom2d_cleanup(atom2d)
free the internals of atom2d
subroutine, public pair_radius_setup(present_a, present_b, radius_a, radius_b, pair_radius, prmin)
...
subroutine, public build_neighbor_lists(ab_list, particle_set, atom, cell, pair_radius, subcells, mic, symmetric, molecular, subset_of_mol, current_subset, operator_type, nlname, atomb_to_keep)
Build simple pair neighbor lists.
subroutine, public write_neighbor_lists(ab, particle_set, cell, para_env, neighbor_list_section, nl_type, middle_name, nlname)
Write a set of neighbor lists to the output unit.
subroutine, public atom2d_build(atom2d, distribution_1d, distribution_2d, atomic_kind_set, molecule_set, molecule_only, particle_set)
Build some distribution structure of atoms, refactored from build_qs_neighbor_lists.
subroutine, public tddfpt2_lri_amat(qs_env, sub_env, lri_env, lri_v_int, A_ia_munu_sub)
Calculate contribution to response vector for LRI.
subroutine, public tddfpt2_lri_init(qs_env, kernel_env, lri_section, tddfpt_print_section)
Initialize LRI environment, basis, neighborlists and matrices.
subroutine, public tddfpt_dbcsr_create_by_dist(matrix, template, dbcsr_dist, sab)
Create a DBCSR matrix based on a template matrix, distribution object, and the list of neighbours.