115 SUBROUTINE libgint_update_env(fac, memory_parameter, do_periodic, cell, actual_x_data, nneighbors, max_pgf, &
116 natom, kind_of, particle_set, basis_parameter)
120 LOGICAL :: do_periodic
122 TYPE(
hfx_type),
POINTER :: actual_x_data
123 INTEGER :: nneighbors, max_pgf, natom
124 INTEGER,
ALLOCATABLE,
DIMENSION(:) :: kind_of
129 REAL(
dp),
DIMENSION(:, :),
ALLOCATABLE :: cell_r
130 REAL(
dp),
DIMENSION(:),
ALLOCATABLE :: flat_gcc
131 INTEGER,
DIMENSION(:),
POINTER :: la_min, la_max, npgfa, nsgfa
132 INTEGER,
DIMENSION(:, :),
POINTER :: nsgfl_a
133 INTEGER :: i, l, iset, jset, iatom, ikind, nseta, &
136 REAL(
dp),
DIMENSION(:, :),
POINTER :: zeta
137 REAL(
dp),
DIMENSION(:, :, :),
POINTER :: gcc
138 TYPE(
bra_t),
POINTER :: bra_p, ket_p
141 CALL libgint_set_hf_fac(libgint_handle,
fac)
143 CALL libgint_set_max_mem(libgint_handle, memory_parameter%max_memory)
147 ALLOCATE (cell_r(3, nneighbors))
149 cell_r(:, i) = actual_x_data%neighbor_cells(i)%cell_r(:)
151 CALL libgint_set_cell(libgint_handle, do_pbc, cell%hmat, cell%h_inv)
152 CALL libgint_set_neighs(libgint_handle, cell_r, nneighbors)
162 IF (
ALLOCATED(first_set_of_atom))
DEALLOCATE (first_set_of_atom)
163 ALLOCATE (first_set_of_atom(natom))
165 ikind = kind_of(iatom)
166 ra = particle_set(iatom)%r(:)
167 nseta = basis_parameter(ikind)%nset
168 npgfa => basis_parameter(ikind)%npgf
169 la_min => basis_parameter(ikind)%lmin
170 la_max => basis_parameter(ikind)%lmax
171 zeta => basis_parameter(ikind)%zet
172 nsgfa => basis_parameter(ikind)%nsgf
173 nsgfl_a => basis_parameter(ikind)%nsgfl
174 gcc => basis_parameter(ikind)%gcc
175 first_set_of_atom(iatom) = jset
177 CALL libgint_set_atom(libgint_handle, jset - 1, ra, zeta(:, iset), npgfa(iset))
179 DO l = la_min(iset), la_max(iset)
180 nla = nsgfl_a(l, iset)
181 IF (
ALLOCATED(flat_gcc))
DEALLOCATE (flat_gcc)
182 ALLOCATE (flat_gcc(npgfa(iset)*nla))
183 flat_gcc(:) = pack(gcc(1:npgfa(iset), inla:inla + nla - 1, iset), .true.)
184 CALL libgint_set_atom_l(libgint_handle, jset - 1, l, nla, flat_gcc)
192 mark_used(memory_parameter)
193 mark_used(do_periodic)
195 mark_used(actual_x_data)
196 mark_used(nneighbors)
200 mark_used(particle_set)
201 mark_used(basis_parameter)
202 cpabort(
"This CP2K executable has not been linked against the required library libGint.")
316 ra, rb, rc, rd, npgfa, npgfb, npgfc, npgfd, &
317 potential_parameter, &
318 screen1, screen2, log10_pmax, log10_eps_schwarz, &
320 neighbor_cells, cell, do_periodic, screened)
322 INTEGER,
INTENT(IN) :: iatom, jatom, katom, latom, iset, &
324 REAL(
dp),
INTENT(IN) :: ra(3), rb(3), rc(3), rd(3)
325 INTEGER,
INTENT(IN) :: npgfa, npgfb, npgfc, npgfd
326 TYPE(hfx_potential_type) :: potential_parameter
327 REAL(
dp),
INTENT(IN) :: screen1(2), screen2(2)
328 REAL(
dp),
INTENT(IN) :: log10_pmax, log10_eps_schwarz
329 TYPE(hfx_screen_coeff_type),
DIMENSION(:, :), &
330 POINTER :: pgf1, pgf2
331 TYPE(hfx_cell_type),
DIMENSION(:),
POINTER :: neighbor_cells
333 LOGICAL,
INTENT(IN) :: do_periodic
334 LOGICAL,
INTENT(OUT) :: screened
337 TYPE(
bra_t),
POINTER :: bra_p, ket_p
338 LOGICAL :: cell_was_screened
339 INTEGER :: idx_n1, idx_n2, n1, n2, idx_ij, idx_kl, o_ij, n_ij, o_kl, n_kl
340 INTEGER :: ipgf, jpgf, kpgf, lpgf, iatom_set, &
341 jatom_set, katom_set, latom_set
342 REAL(
dp) :: pgf_max_1, pgf_max_2
343 INTEGER :: nelements_ij, nelements_kl
346 potential_parameter = potential_parameter
351 iatom_set = first_set_of_atom(iatom) + iset - 2
352 jatom_set = first_set_of_atom(jatom) + jset - 2
353 katom_set = first_set_of_atom(katom) + kset - 2
354 latom_set = first_set_of_atom(latom) + lset - 2
357 pgf1, log10_pmax, log10_eps_schwarz, ra, rb, &
358 nelements_ij, neighbor_cells, do_periodic)
361 pgf2, log10_pmax, log10_eps_schwarz, rc, rd, &
362 nelements_kl, neighbor_cells, do_periodic)
373 DO idx_n1 = 1, bra%cell_cnt
375 n1 = bra%cell_idx(1, idx_n1)
376 n_ij = bra%cell_idx(2, idx_n1)
377 o_ij = bra%cell_idx(3, idx_n1)
379 DO idx_n2 = 1, ket%cell_cnt
381 n2 = ket%cell_idx(1, idx_n2)
382 n_kl = ket%cell_idx(2, idx_n2)
383 o_kl = ket%cell_idx(3, idx_n2)
385 cell_was_screened = .true.
386 DO idx_ij = o_ij + 1, o_ij + n_ij
388 ipgf = bra%pgf_idx(1, idx_ij)
389 jpgf = bra%pgf_idx(2, idx_ij)
391 pgf_max_1 = bra%pgf_scr(1, idx_ij)
393 DO idx_kl = o_kl + 1, o_kl + n_kl
394 kpgf = ket%pgf_idx(1, idx_kl)
395 lpgf = ket%pgf_idx(2, idx_kl)
397 pgf_max_2 = ket%pgf_scr(1, idx_kl)
399 IF (pgf_max_1 + pgf_max_2 + log10_pmax < log10_eps_schwarz) cycle
401 CALL libgint_add_prm(libgint_handle, ipgf - 1, jpgf - 1, kpgf - 1, lpgf - 1)
402 cell_was_screened = .false.
407 IF (.NOT. cell_was_screened)
THEN
408 CALL libgint_add_shell(libgint_handle, iatom_set, jatom_set, katom_set, latom_set, n1 - 1, n2 - 1)
431 mark_used(potential_parameter)
434 mark_used(log10_pmax)
435 mark_used(log10_eps_schwarz)
438 mark_used(neighbor_cells)
440 mark_used(do_periodic)
442 cpabort(
"This CP2K executable has not been linked against the required library libGint.")
505 iatom, jatom, katom, latom, &
506 iset, jset, kset, lset, &
507 atomic_offset_ac, atomic_offset_ad, atomic_offset_bc, atomic_offset_bd, &
508 offset_ac_set, offset_ad_set, offset_bc_set, offset_bd_set, &
509 nsgfa, nsgfb, nsgfc, nsgfd, &
510 la_min, la_max, lb_min, lb_max, &
511 lc_min, lc_max, ld_min, ld_max, &
512 nsgfl_a, nsgfl_b, nsgfl_c, nsgfl_d)
515 INTEGER :: iatom, jatom, katom, latom
516 INTEGER :: iset, jset, kset, lset
517 INTEGER :: atomic_offset_ac, atomic_offset_ad, &
518 atomic_offset_bc, atomic_offset_bd
519 INTEGER,
DIMENSION(:, :),
POINTER :: offset_ac_set, offset_ad_set
520 INTEGER,
DIMENSION(:, :),
POINTER :: offset_bc_set, offset_bd_set
521 INTEGER :: nsgfa, nsgfb, nsgfc, nsgfd
522 INTEGER :: la_min, la_max, lb_min, lb_max
523 INTEGER :: lc_min, lc_max, ld_min, ld_max
524 INTEGER,
DIMENSION(:, :),
POINTER :: nsgfl_a, nsgfl_b, nsgfl_c, nsgfl_d
545 LOGICAL(1) :: tac, tad, tbc, tbd
546 INTEGER :: offset_ac_l_set, offset_ad_l_set, &
547 offset_bc_l_set, offset_bd_l_set
548 INTEGER :: s_offset_a, s_offset_b, s_offset_c, &
550 INTEGER :: s_offset_a_l, s_offset_b_l, &
551 s_offset_c_l, s_offset_d_l
552 INTEGER :: s_offset_ac, s_offset_ad, s_offset_bc, &
554 INTEGER :: ld_ac_set, ld_ad_set, ld_bc_set, &
556 INTEGER :: la, lb, lc, ld, nla, nlb, nlc, nld, &
557 inla, inlb, inlc, inld
567 IF (jatom >= latom)
THEN
568 offset_bd_l_set = offset_bd_set(jset, lset) + atomic_offset_bd - 2
572 offset_bd_l_set = offset_bd_set(lset, jset) + atomic_offset_bd - 2
576 IF (jatom >= katom)
THEN
577 offset_bc_l_set = offset_bc_set(jset, kset) + atomic_offset_bc - 2
581 offset_bc_l_set = offset_bc_set(kset, jset) + atomic_offset_bc - 2
586 IF (iatom >= latom)
THEN
587 offset_ad_l_set = offset_ad_set(iset, lset) + atomic_offset_ad - 2
591 offset_ad_l_set = offset_ad_set(lset, iset) + atomic_offset_ad - 2
596 IF (iatom >= katom)
THEN
597 offset_ac_l_set = offset_ac_set(iset, kset) + atomic_offset_ac - 2
601 offset_ac_l_set = offset_ac_set(kset, iset) + atomic_offset_ac - 2
607 DO la = la_min, la_max
608 nla = nsgfl_a(la, iset)
610 DO lb = lb_min, lb_max
611 nlb = nsgfl_b(lb, jset)
613 DO lc = lc_min, lc_max
614 nlc = nsgfl_c(lc, kset)
616 ld_loop:
DO ld = ld_min, ld_max
617 nld = nsgfl_d(ld, lset)
618 CALL libgint_add_qrt(libgint_handle, la, lb, lc, ld, nla, nlb, nlc, nld)
620 s_offset_a = s_offset_a_l + (inla - 1)*(2*la + 1)
622 s_offset_b = s_offset_b_l + (inlb - 1)*(2*lb + 1)
624 s_offset_c = s_offset_c_l + (inlc - 1)*(2*lc + 1)
626 s_offset_d = s_offset_d_l + (inld - 1)*(2*ld + 1)
628 s_offset_ac = offset_ac_l_set + s_offset_c*ld_ac_set + s_offset_a
630 s_offset_ac = offset_ac_l_set + s_offset_a*ld_ac_set + s_offset_c
634 s_offset_ad = offset_ad_l_set + s_offset_d*ld_ad_set + s_offset_a
636 s_offset_ad = offset_ad_l_set + s_offset_a*ld_ad_set + s_offset_d
640 s_offset_bc = offset_bc_l_set + s_offset_c*ld_bc_set + s_offset_b
642 s_offset_bc = offset_bc_l_set + s_offset_b*ld_bc_set + s_offset_c
646 s_offset_bd = offset_bd_l_set + s_offset_d*ld_bd_set + s_offset_b
648 s_offset_bd = offset_bd_l_set + s_offset_b*ld_bd_set + s_offset_d
651 CALL libgint_add_qrtt(libgint_handle, symm_fac, &
652 la, lb, lc, ld, inla - 1, inlb - 1, inlc - 1, inld - 1, &
653 ld_ac_set, ld_ad_set, ld_bc_set, ld_bd_set, &
654 s_offset_ac, s_offset_ad, s_offset_bc, s_offset_bd, &
661 s_offset_d_l = s_offset_d_l + nld*(2*ld + 1)
663 s_offset_c_l = s_offset_c_l + nlc*(2*lc + 1)
665 s_offset_b_l = s_offset_b_l + nlb*(2*lb + 1)
667 s_offset_a_l = s_offset_a_l + nla*(2*la + 1)
670 CALL libgint_add_set(libgint_handle)
682 mark_used(atomic_offset_ac)
683 mark_used(atomic_offset_ad)
684 mark_used(atomic_offset_bc)
685 mark_used(atomic_offset_bd)
686 mark_used(offset_ac_set)
687 mark_used(offset_ad_set)
688 mark_used(offset_bc_set)
689 mark_used(offset_bd_set)
706 cpabort(
"This CP2K executable has not been linked against the required library libGint.")
subroutine, public libgint_update_fock_matrix(symm_fac, iatom, jatom, katom, latom, iset, jset, kset, lset, atomic_offset_ac, atomic_offset_ad, atomic_offset_bc, atomic_offset_bd, offset_ac_set, offset_ad_set, offset_bc_set, offset_bd_set, nsgfa, nsgfb, nsgfc, nsgfd, la_min, la_max, lb_min, lb_max, lc_min, lc_max, ld_min, ld_max, nsgfl_a, nsgfl_b, nsgfl_c, nsgfl_d)
The previous coulomb_4 function assigned an integral between primitive gaussian. Now we assign the ns...
subroutine, public libgint_coulomb4(iatom, jatom, katom, latom, iset, jset, kset, lset, ra, rb, rc, rd, npgfa, npgfb, npgfc, npgfd, potential_parameter, screen1, screen2, log10_pmax, log10_eps_schwarz, pgf1, pgf2, neighbor_cells, cell, do_periodic, screened)
Assign two-electron integrals of a quartet/shell to libGint.