47#include "./base/base_uses.f90"
55 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'qs_elec_field'
78 REAL(
dp),
DIMENSION(3),
INTENT(IN) :: rc
80 CHARACTER(len=*),
PARAMETER :: routinen =
'build_efg_matrix'
82 INTEGER :: after, handle, i, iatom, icol, ikind, inode, irow, iset, iw, jatom, jkind, jset, &
83 last_jatom, ldai, maxco, maxlgto, maxsgf, natom, ncoa, ncob, neighbor_list_id, nkind, &
84 nseta, nsetb, sgfa, sgfb
85 INTEGER,
DIMENSION(:),
POINTER :: la_max, la_min, lb_max, lb_min, npgfa, &
87 INTEGER,
DIMENSION(:, :),
POINTER :: first_sgfa, first_sgfb
88 LOGICAL :: found, new_atom_b, omit_headers
89 REAL(kind=
dp) :: dab, rab2
90 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:, :) :: work
91 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:, :, :) :: efgab, rr_work
92 REAL(kind=
dp),
DIMENSION(3) :: ra, rab, rac, rb, rbc
93 REAL(kind=
dp),
DIMENSION(:),
POINTER :: set_radius_a, set_radius_b
94 REAL(kind=
dp),
DIMENSION(:, :),
POINTER :: rpgfa, rpgfb, sphi_a, sphi_b, zeta, zetb
102 DIMENSION(:),
POINTER :: nl_iterator
106 TYPE(
qs_kind_type),
DIMENSION(:),
POINTER :: qs_kind_set
109 CALL timeset(routinen, handle)
111 NULLIFY (cell, sab_orb, qs_kind_set, particle_set, para_env)
117 qs_kind_set=qs_kind_set, &
118 particle_set=particle_set, &
119 neighbor_list_id=neighbor_list_id, &
124 nkind =
SIZE(qs_kind_set)
125 natom =
SIZE(particle_set)
133 ldai =
ncoset(maxlgto + 2)
136 ALLOCATE (rr_work(0:2*maxlgto + 4, ldai, ldai))
138 ALLOCATE (efgab(maxco, maxco, 6))
140 ALLOCATE (work(maxco, maxsgf))
144 rr_work(:, :, :) = 0.0_dp
145 efgab(:, :, :) = 0.0_dp
148 ALLOCATE (basis_set_list(nkind))
150 qs_kind => qs_kind_set(ikind)
151 CALL get_qs_kind(qs_kind=qs_kind, basis_set=basis_set_a)
152 IF (
ASSOCIATED(basis_set_a))
THEN
153 basis_set_list(ikind)%gto_basis_set => basis_set_a
155 NULLIFY (basis_set_list(ikind)%gto_basis_set)
161 iatom=iatom, jatom=jatom, r=rab)
162 basis_set_a => basis_set_list(ikind)%gto_basis_set
163 IF (.NOT.
ASSOCIATED(basis_set_a)) cycle
164 basis_set_b => basis_set_list(jkind)%gto_basis_set
165 IF (.NOT.
ASSOCIATED(basis_set_b)) cycle
166 ra =
pbc(particle_set(iatom)%r, cell)
168 first_sgfa => basis_set_a%first_sgf
169 la_max => basis_set_a%lmax
170 la_min => basis_set_a%lmin
171 npgfa => basis_set_a%npgf
172 nseta = basis_set_a%nset
173 nsgfa => basis_set_a%nsgf_set
174 rpgfa => basis_set_a%pgf_radius
175 set_radius_a => basis_set_a%set_radius
176 sphi_a => basis_set_a%sphi
177 zeta => basis_set_a%zet
179 first_sgfb => basis_set_b%first_sgf
180 lb_max => basis_set_b%lmax
181 lb_min => basis_set_b%lmin
182 npgfb => basis_set_b%npgf
183 nsetb = basis_set_b%nset
184 nsgfb => basis_set_b%nsgf_set
185 rpgfb => basis_set_b%pgf_radius
186 set_radius_b => basis_set_b%set_radius
187 sphi_b => basis_set_b%sphi
188 zetb => basis_set_b%zet
190 IF (inode == 1) last_jatom = 0
193 rab2 = rab(1)*rab(1) + rab(2)*rab(2) + rab(3)*rab(3)
195 rac =
pbc(ra, rc, cell)
198 IF (jatom /= last_jatom)
THEN
206 IF (iatom <= jatom)
THEN
215 NULLIFY (efgint(i)%block)
217 row=irow, col=icol, block=efgint(i)%block, found=found)
223 ncoa = npgfa(iset)*
ncoset(la_max(iset))
224 sgfa = first_sgfa(1, iset)
228 IF (set_radius_a(iset) + set_radius_b(jset) < dab) cycle
230 ncob = npgfb(jset)*
ncoset(lb_max(jset))
231 sgfb = first_sgfb(1, jset)
235 CALL efg(la_max(iset), la_min(iset), npgfa(iset), &
236 rpgfa(:, iset), zeta(:, iset), &
237 lb_max(jset), lb_min(jset), npgfb(jset), &
238 rpgfb(:, jset), zetb(:, jset), &
239 rac, rbc, rab, efgab,
SIZE(rr_work, 1),
SIZE(rr_work, 2), rr_work)
245 CALL dgemm(
"N",
"N", ncoa, nsgfb(jset), ncob, &
246 1.0_dp, efgab(1, 1, i),
SIZE(efgab, 1), &
247 sphi_b(1, sgfb),
SIZE(sphi_b, 1), &
248 0.0_dp, work(1, 1),
SIZE(work, 1))
250 IF (iatom <= jatom)
THEN
251 CALL dgemm(
"T",
"N", nsgfa(iset), nsgfb(jset), ncoa, &
252 1.0_dp, sphi_a(1, sgfa),
SIZE(sphi_a, 1), &
253 work(1, 1),
SIZE(work, 1), &
254 1.0_dp, efgint(i)%block(sgfa, sgfb), &
255 SIZE(efgint(i)%block, 1))
259 CALL dgemm(
"T",
"N", nsgfb(jset), nsgfa(iset), ncoa, &
260 1.0_dp, work(1, 1),
SIZE(work, 1), &
261 sphi_a(1, sgfa),
SIZE(sphi_a, 1), &
262 1.0_dp, efgint(i)%block(sgfb, sgfa), &
263 SIZE(efgint(i)%block, 1))
276 DEALLOCATE (basis_set_list)
287 qs_env%input,
"DFT%PRINT%AO_MATRICES/EFG"),
cp_p_file))
THEN
291 CALL section_vals_val_get(qs_env%input,
"DFT%PRINT%AO_MATRICES%OMIT_HEADERS", l_val=omit_headers)
292 after = min(max(after, 1), 16)
294 para_env, output_unit=iw, omit_headers=omit_headers)
296 para_env, output_unit=iw, omit_headers=omit_headers)
298 para_env, output_unit=iw, omit_headers=omit_headers)
300 para_env, output_unit=iw, omit_headers=omit_headers)
302 para_env, output_unit=iw, omit_headers=omit_headers)
304 para_env, output_unit=iw, omit_headers=omit_headers)
306 "DFT%PRINT%AO_MATRICES/EFG")
309 CALL timestop(handle)
static void dgemm(const char transa, const char transb, const int m, const int n, const int k, const double alpha, const double *a, const int lda, const double *b, const int ldb, const double beta, double *c, const int ldc)
Convenient wrapper to hide Fortran nature of dgemm_, swapping a and b.
Calculation of Coulomb integrals over Cartesian Gaussian-type functions (electron repulsion integrals...
subroutine, public efg(la_max, la_min, npgfa, rpgfa, zeta, lb_max, lb_min, npgfb, rpgfb, zetb, rac, rbc, rab, vab, ldrr1, ldrr2, rr)
Calculation of the primitive electric field integrals over Cartesian Gaussian-type functions.
collect pointers to a block of reals
Handles all functions related to the CELL.
subroutine, public dbcsr_get_block_p(matrix, row, col, block, found, row_size, col_size)
...
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
Interface to the message passing library MPI.
Provides Cartesian and spherical orbital pointers and indices.
subroutine, public init_orbital_pointers(maxl)
Initialize or update the orbital pointers.
integer, dimension(:), allocatable, public ncoset
Define the data structure for the particle information.
Distribution of the electric field gradient integral matrix.
subroutine, public build_efg_matrix(qs_env, matrix_efg, rc)
Calculation of the electric field gradient matrix over Cartesian Gaussian functions.
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 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, npgf_seg)
Get attributes of an atomic kind set.
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)
...
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.