14 USE omp_lib,
ONLY: omp_get_max_threads,&
21 gto_basis_set_p_type,&
33 USE dbcsr_api,
ONLY: dbcsr_distribution_get,&
34 dbcsr_distribution_release,&
35 dbcsr_distribution_type
37 dbt_create, dbt_distribution_destroy, dbt_distribution_new, dbt_distribution_type, &
38 dbt_finalize, dbt_pgrid_create, dbt_pgrid_destroy, dbt_pgrid_type, dbt_put_block, &
39 dbt_reserve_blocks, dbt_type
98 #include "./base/base_uses.f90"
103 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'xas_tdp_integrals'
127 blk_size_3, only_bc_same_center)
129 TYPE(dbt_type),
INTENT(OUT) :: pq_x
130 TYPE(neighbor_list_set_p_type),
DIMENSION(:), &
131 POINTER :: ab_nl, ac_nl
132 TYPE(dbcsr_distribution_type),
INTENT(IN) :: matrix_dist
133 INTEGER,
DIMENSION(:),
INTENT(IN) :: blk_size_1, blk_size_2, blk_size_3
134 LOGICAL,
INTENT(IN),
OPTIONAL :: only_bc_same_center
136 CHARACTER(len=*),
PARAMETER :: routinen =
'create_pqX_tensor'
138 INTEGER :: a, b, group_handle, handle, i, iatom, &
139 ikind, jatom, katom, kkind, nblk, &
140 nblk_3, nblk_per_thread, nkind
141 INTEGER,
ALLOCATABLE,
DIMENSION(:) :: idx1,
idx2,
idx3
142 INTEGER,
DIMENSION(3) :: pdims
143 INTEGER,
DIMENSION(:),
POINTER :: col_dist, row_dist
144 INTEGER,
DIMENSION(:, :),
POINTER :: mat_pgrid
145 LOGICAL :: my_sort_bc, symmetric
146 REAL(
dp),
DIMENSION(3) :: rab, rac, rbc
147 TYPE(dbt_distribution_type) :: t_dist
148 TYPE(dbt_pgrid_type) :: t_pgrid
149 TYPE(mp_comm_type) :: group
150 TYPE(neighbor_list_iterator_p_type), &
151 DIMENSION(:),
POINTER :: ab_iter, ac_iter
153 NULLIFY (ab_iter, ac_iter, col_dist, row_dist, mat_pgrid)
155 CALL timeset(routinen, handle)
158 IF (
PRESENT(only_bc_same_center)) my_sort_bc = only_bc_same_center
164 CALL dbcsr_distribution_get(matrix_dist, pgrid=mat_pgrid, group=group_handle, &
165 row_dist=row_dist, col_dist=col_dist)
166 CALL group%set_handle(group_handle)
169 pdims(1) =
SIZE(mat_pgrid, 1); pdims(2) =
SIZE(mat_pgrid, 2); pdims(3) = 1
170 CALL dbt_pgrid_create(group, pdims, t_pgrid)
172 nblk_3 =
SIZE(blk_size_3)
173 CALL dbt_distribution_new(t_dist, t_pgrid, nd_dist_1=row_dist, nd_dist_2=col_dist, &
174 nd_dist_3=[(0, i=1, nblk_3)])
177 CALL dbt_create(pq_x, name=
"(pq|X)", dist=t_dist, map1_2d=[1, 2], map2_2d=[3], &
178 blk_size_1=blk_size_1, blk_size_2=blk_size_2, blk_size_3=blk_size_3)
195 rbc(:) = rac(:) - rab(:)
196 IF (.NOT. (all(abs(rbc) .LE. 1.0e-8_dp) .OR. all(abs(rac) .LE. 1.0e-8_dp))) cycle
207 ALLOCATE (idx1(nblk),
idx2(nblk),
idx3(nblk))
214 CALL get_iterator_info(ab_iter, ikind=ikind, iatom=iatom, jatom=jatom, nkind=nkind, r=rab)
225 rbc(:) = rac(:) - rab(:)
226 IF (.NOT. (all(abs(rbc) .LE. 1.0e-8_dp) .OR. all(abs(rac) .LE. 1.0e-8_dp))) cycle
244 nblk_per_thread = nblk/omp_get_num_threads() + 1
245 a = omp_get_thread_num()*nblk_per_thread + 1
246 b = min(a + nblk_per_thread, nblk)
247 CALL dbt_reserve_blocks(pq_x, idx1(a:b),
idx2(a:b),
idx3(a:b))
249 CALL dbt_finalize(pq_x)
252 CALL dbt_distribution_destroy(t_dist)
253 CALL dbt_pgrid_destroy(t_pgrid)
255 CALL timestop(handle)
275 basis_set_list_c, potential_parameter, qs_env, &
276 only_bc_same_center, eps_screen)
278 TYPE(dbt_type) :: pq_x
279 TYPE(neighbor_list_set_p_type),
DIMENSION(:), &
280 POINTER :: ab_nl, ac_nl
281 TYPE(gto_basis_set_p_type),
DIMENSION(:),
POINTER :: basis_set_list_a, basis_set_list_b, &
283 TYPE(libint_potential_type) :: potential_parameter
284 TYPE(qs_environment_type),
POINTER :: qs_env
285 LOGICAL,
INTENT(IN),
OPTIONAL :: only_bc_same_center
286 REAL(
dp),
INTENT(IN),
OPTIONAL :: eps_screen
288 CHARACTER(len=*),
PARAMETER :: routinen =
'fill_pqX_tensor'
290 INTEGER :: egfa, egfb, egfc, handle, i, iatom, ibasis, ikind, ilist,
imax, iset, jatom, &
291 jkind, jset, katom, kkind, kset, m_max, max_ncob, max_ncoc, max_nset, max_nsgfa, &
292 max_nsgfb, maxli, maxlj, maxlk, mepos, nbasis, ncoa, ncob, ncoc, ni, nj, nk, nseta, &
293 nsetb, nsetc, nthread, sgfa, sgfb, sgfc, unit_id
294 INTEGER,
DIMENSION(:),
POINTER :: la_max, la_min, lb_max, lb_min, lc_max, &
295 lc_min, npgfa, npgfb, npgfc, nsgfa, &
297 INTEGER,
DIMENSION(:, :),
POINTER :: first_sgfa, first_sgfb, first_sgfc
298 LOGICAL :: do_screen, my_sort_bc
299 REAL(
dp) :: dij, dik, djk, my_eps_screen, ri(3), &
300 rij(3), rik(3), rj(3), rjk(3), rk(3), &
301 sabc_ext, screen_radius
302 REAL(
dp),
ALLOCATABLE,
DIMENSION(:) :: ccp_buffer, cpp_buffer
303 REAL(
dp),
ALLOCATABLE,
DIMENSION(:, :) :: max_contr, max_contra, max_contrb, &
305 REAL(
dp),
ALLOCATABLE,
DIMENSION(:, :, :) :: iabc, sabc, work
306 REAL(
dp),
DIMENSION(:),
POINTER :: set_radius_a, set_radius_b, set_radius_c
307 REAL(
dp),
DIMENSION(:, :),
POINTER :: rpgf_a, rpgf_b, rpgf_c, zeta, zetb, zetc
308 TYPE(cp_2d_r_p_type),
DIMENSION(:, :),
POINTER :: spb, spc, tspa
309 TYPE(cp_libint_t) :: lib
310 TYPE(gto_basis_set_p_type),
DIMENSION(:),
POINTER :: basis_set_list
311 TYPE(gto_basis_set_type),
POINTER :: basis_set, basis_set_a, basis_set_b, &
313 TYPE(mp_para_env_type),
POINTER :: para_env
314 TYPE(o3c_container_type),
POINTER :: o3c
315 TYPE(o3c_iterator_type) :: o3c_iterator
317 NULLIFY (basis_set, basis_set_list, para_env, la_max, la_min)
318 NULLIFY (lb_max, lb_min, lc_max, lc_min, npgfa, npgfb, npgfc, nsgfa, nsgfb, nsgfc)
319 NULLIFY (first_sgfa, first_sgfb, first_sgfc, set_radius_a, set_radius_b, set_radius_c)
320 NULLIFY (rpgf_a, rpgf_b, rpgf_c, zeta, zetb, zetc)
321 NULLIFY (basis_set_a, basis_set_b, basis_set_c, tspa, spb, spc)
323 CALL timeset(routinen, handle)
326 nbasis =
SIZE(basis_set_list_a)
330 DO ibasis = 1, nbasis
332 maxl=
imax, nset=iset, nsgf_set=nsgfa)
333 maxli = max(maxli,
imax)
334 max_nset = max(max_nset, iset)
335 max_nsgfa = max(max_nsgfa, maxval(nsgfa))
340 DO ibasis = 1, nbasis
342 maxl=
imax, nset=iset, nsgf_set=nsgfb, npgf=npgfb)
343 maxlj = max(maxlj,
imax)
344 max_nset = max(max_nset, iset)
345 max_nsgfb = max(max_nsgfb, maxval(nsgfb))
346 max_ncob = max(max_ncob, maxval(npgfb)*
ncoset(maxlj))
350 DO ibasis = 1, nbasis
352 maxl=
imax, nset=iset, npgf=npgfc)
353 maxlk = max(maxlk,
imax)
354 max_nset = max(max_nset, iset)
355 max_ncoc = max(max_ncoc, maxval(npgfc)*
ncoset(maxlk))
357 m_max = maxli + maxlj + maxlk
361 IF (
PRESENT(eps_screen))
THEN
363 my_eps_screen = eps_screen
365 screen_radius = 0.0_dp
372 screen_radius = 1000000.0_dp
379 ALLOCATE (max_contr(max_nset, nbasis), max_contra(max_nset, nbasis), &
380 max_contrb(max_nset, nbasis), max_contrc(max_nset, nbasis))
385 IF (ilist == 1) basis_set_list => basis_set_list_a
386 IF (ilist == 2) basis_set_list => basis_set_list_b
387 IF (ilist == 3) basis_set_list => basis_set_list_c
391 DO ibasis = 1, nbasis
392 basis_set => basis_set_list(ibasis)%gto_basis_set
394 DO iset = 1, basis_set%nset
396 ncoa = basis_set%npgf(iset)*
ncoset(basis_set%lmax(iset))
397 sgfa = basis_set%first_sgf(1, iset)
398 egfa = sgfa + basis_set%nsgf_set(iset) - 1
400 max_contr(iset, ibasis) = &
401 maxval((/(sum(abs(basis_set%sphi(1:ncoa, i))), i=sgfa, egfa)/))
406 IF (ilist == 1) max_contra(:, :) = max_contr(:, :)
407 IF (ilist == 2) max_contrb(:, :) = max_contr(:, :)
408 IF (ilist == 3) max_contrc(:, :) = max_contr(:, :)
410 DEALLOCATE (max_contr)
415 ALLOCATE (tspa(max_nset, nbasis), spb(max_nset, nbasis), spc(max_nset, nbasis))
416 DO ibasis = 1, nbasis
417 DO iset = 1, max_nset
418 NULLIFY (tspa(iset, ibasis)%array)
419 NULLIFY (spb(iset, ibasis)%array)
420 NULLIFY (spc(iset, ibasis)%array)
426 DO ibasis = 1, nbasis
427 IF (ilist == 1) basis_set => basis_set_list_a(ibasis)%gto_basis_set
428 IF (ilist == 2) basis_set => basis_set_list_b(ibasis)%gto_basis_set
429 IF (ilist == 3) basis_set => basis_set_list_c(ibasis)%gto_basis_set
431 DO iset = 1, basis_set%nset
433 ncoa = basis_set%npgf(iset)*
ncoset(basis_set%lmax(iset))
434 sgfa = basis_set%first_sgf(1, iset)
435 egfa = sgfa + basis_set%nsgf_set(iset) - 1
438 ALLOCATE (tspa(iset, ibasis)%array(basis_set%nsgf_set(iset), ncoa))
439 tspa(iset, ibasis)%array(:, :) = transpose(basis_set%sphi(1:ncoa, sgfa:egfa))
440 ELSE IF (ilist == 2)
THEN
441 ALLOCATE (spb(iset, ibasis)%array(ncoa, basis_set%nsgf_set(iset)))
442 spb(iset, ibasis)%array(:, :) = basis_set%sphi(1:ncoa, sgfa:egfa)
444 ALLOCATE (spc(iset, ibasis)%array(ncoa, basis_set%nsgf_set(iset)))
445 spc(iset, ibasis)%array(:, :) = basis_set%sphi(1:ncoa, sgfa:egfa)
453 IF (
PRESENT(only_bc_same_center)) my_sort_bc = only_bc_same_center
461 IF (para_env%mepos == 0)
THEN
462 CALL open_file(unit_number=unit_id, file_name=potential_parameter%filename)
464 CALL init(m_max, unit_id, para_env%mepos, para_env)
465 IF (para_env%mepos == 0)
THEN
481 CALL init_o3c_container(o3c, 1, basis_set_list_a, basis_set_list_b, basis_set_list_c, &
482 ab_nl, ac_nl, only_bc_same_center=my_sort_bc)
501 ALLOCATE (cpp_buffer(max_nsgfa*max_ncob))
502 ALLOCATE (ccp_buffer(max_nsgfa*max_nsgfb*max_ncoc))
511 DO WHILE (
o3c_iterate(o3c_iterator, mepos=mepos) == 0)
513 iatom=iatom, jatom=jatom, katom=katom, rij=rij, rik=rik)
516 basis_set_a => basis_set_list_a(ikind)%gto_basis_set
517 first_sgfa => basis_set_a%first_sgf
518 la_max => basis_set_a%lmax
519 la_min => basis_set_a%lmin
520 npgfa => basis_set_a%npgf
521 nseta = basis_set_a%nset
522 nsgfa => basis_set_a%nsgf_set
523 zeta => basis_set_a%zet
524 rpgf_a => basis_set_a%pgf_radius
525 set_radius_a => basis_set_a%set_radius
528 basis_set_b => basis_set_list_b(jkind)%gto_basis_set
529 first_sgfb => basis_set_b%first_sgf
530 lb_max => basis_set_b%lmax
531 lb_min => basis_set_b%lmin
532 npgfb => basis_set_b%npgf
533 nsetb = basis_set_b%nset
534 nsgfb => basis_set_b%nsgf_set
535 zetb => basis_set_b%zet
536 rpgf_b => basis_set_b%pgf_radius
537 set_radius_b => basis_set_b%set_radius
540 basis_set_c => basis_set_list_c(kkind)%gto_basis_set
541 first_sgfc => basis_set_c%first_sgf
542 lc_max => basis_set_c%lmax
543 lc_min => basis_set_c%lmin
544 npgfc => basis_set_c%npgf
545 nsetc = basis_set_c%nset
546 nsgfc => basis_set_c%nsgf_set
547 zetc => basis_set_c%zet
548 rpgf_c => basis_set_c%pgf_radius
549 set_radius_c => basis_set_c%set_radius
563 ALLOCATE (iabc(ni, nj, nk))
564 iabc(:, :, :) = 0.0_dp
567 ncoa = npgfa(iset)*
ncoset(la_max(iset))
568 sgfa = first_sgfa(1, iset)
569 egfa = sgfa + nsgfa(iset) - 1
572 ncob = npgfb(jset)*
ncoset(lb_max(jset))
573 sgfb = first_sgfb(1, jset)
574 egfb = sgfb + nsgfb(jset) - 1
577 IF (set_radius_a(iset) + set_radius_b(jset) < dij) cycle
580 ncoc = npgfc(kset)*
ncoset(lc_max(kset))
581 sgfc = first_sgfc(1, kset)
582 egfc = sgfc + nsgfc(kset) - 1
585 IF (set_radius_a(iset) + set_radius_c(kset) + screen_radius < dik) cycle
586 IF (set_radius_b(jset) + set_radius_c(kset) + screen_radius < djk) cycle
589 ALLOCATE (sabc(ncoa, ncob, ncoc))
590 sabc(:, :, :) = 0.0_dp
593 CALL eri_3center(sabc, la_min(iset), la_max(iset), npgfa(iset), zeta(:, iset), &
594 rpgf_a(:, iset), ri, lb_min(jset), lb_max(jset), npgfb(jset), &
595 zetb(:, jset), rpgf_b(:, jset), rj, lc_min(kset), lc_max(kset), &
596 npgfc(kset), zetc(:, kset), rpgf_c(:, kset), rk, dij, dik, &
597 djk, lib, potential_parameter, int_abc_ext=sabc_ext)
598 IF (my_eps_screen > sabc_ext*(max_contra(iset, ikind)* &
599 max_contrb(jset, jkind)* &
600 max_contrc(kset, kkind)))
THEN
605 CALL eri_3center(sabc, la_min(iset), la_max(iset), npgfa(iset), zeta(:, iset), &
606 rpgf_a(:, iset), ri, lb_min(jset), lb_max(jset), npgfb(jset), &
607 zetb(:, jset), rpgf_b(:, jset), rj, lc_min(kset), lc_max(kset), &
608 npgfc(kset), zetc(:, kset), rpgf_c(:, kset), rk, dij, dik, &
609 djk, lib, potential_parameter)
612 ALLOCATE (work(nsgfa(iset), nsgfb(jset), nsgfc(kset)))
615 spc(kset, kkind)%array, ncoa, ncob, ncoc, nsgfa(iset), &
616 nsgfb(jset), nsgfc(kset), cpp_buffer, ccp_buffer)
618 iabc(sgfa:egfa, sgfb:egfb, sgfc:egfc) = work(:, :, :)
619 DEALLOCATE (sabc, work)
627 CALL dbt_put_block(pq_x, [iatom, jatom, katom], shape(iabc), iabc, summation=.true.)
640 DO iset = 1, max_nset
641 DO ibasis = 1, nbasis
642 IF (
ASSOCIATED(tspa(iset, ibasis)%array))
DEALLOCATE (tspa(iset, ibasis)%array)
643 IF (
ASSOCIATED(spb(iset, ibasis)%array))
DEALLOCATE (spb(iset, ibasis)%array)
644 IF (
ASSOCIATED(spc(iset, ibasis)%array))
DEALLOCATE (spc(iset, ibasis)%array)
647 DEALLOCATE (tspa, spb, spc)
649 CALL timestop(handle)
666 TYPE(neighbor_list_set_p_type),
DIMENSION(:), &
668 TYPE(gto_basis_set_p_type),
DIMENSION(:),
POINTER :: basis_a, basis_b
669 TYPE(qs_environment_type),
POINTER :: qs_env
670 INTEGER,
DIMENSION(:),
INTENT(IN),
OPTIONAL :: excited_atoms
671 TYPE(distribution_2d_type),
OPTIONAL,
POINTER :: ext_dist2d
673 INTEGER :: ikind, nkind
674 LOGICAL :: my_restrictb
675 LOGICAL,
ALLOCATABLE,
DIMENSION(:) :: a_present, b_present
677 REAL(
dp),
ALLOCATABLE,
DIMENSION(:) :: a_radius, b_radius
678 REAL(
dp),
ALLOCATABLE,
DIMENSION(:, :) :: pair_radius
679 TYPE(atomic_kind_type),
DIMENSION(:),
POINTER :: atomic_kind_set
680 TYPE(cell_type),
POINTER :: cell
681 TYPE(distribution_1d_type),
POINTER :: distribution_1d
682 TYPE(distribution_2d_type),
POINTER :: distribution_2d
683 TYPE(local_atoms_type),
ALLOCATABLE,
DIMENSION(:) :: atom2d
684 TYPE(molecule_type),
DIMENSION(:),
POINTER :: molecule_set
685 TYPE(particle_type),
DIMENSION(:),
POINTER :: particle_set
687 NULLIFY (atomic_kind_set, distribution_1d, distribution_2d, molecule_set, particle_set, cell)
693 my_restrictb = .false.
694 IF (
PRESENT(excited_atoms))
THEN
695 my_restrictb = .true.
698 ALLOCATE (a_present(nkind), b_present(nkind))
701 ALLOCATE (a_radius(nkind), b_radius(nkind))
707 IF (
ASSOCIATED(basis_a(ikind)%gto_basis_set))
THEN
708 a_present(ikind) = .true.
709 CALL get_gto_basis_set(basis_a(ikind)%gto_basis_set, kind_radius=a_radius(ikind))
712 IF (
ASSOCIATED(basis_b(ikind)%gto_basis_set))
THEN
713 b_present(ikind) = .true.
714 CALL get_gto_basis_set(basis_b(ikind)%gto_basis_set, kind_radius=b_radius(ikind))
718 ALLOCATE (pair_radius(nkind, nkind))
723 CALL get_qs_env(qs_env, atomic_kind_set=atomic_kind_set, cell=cell, &
724 distribution_2d=distribution_2d, local_particles=distribution_1d, &
725 particle_set=particle_set, molecule_set=molecule_set)
728 IF (
PRESENT(ext_dist2d)) distribution_2d => ext_dist2d
730 ALLOCATE (atom2d(nkind))
731 CALL atom2d_build(atom2d, distribution_1d, distribution_2d, atomic_kind_set, &
732 molecule_set, .false., particle_set)
734 IF (my_restrictb)
THEN
737 atomb_to_keep=excited_atoms, nlname=
"XAS_TDP_ovlp_nl")
742 nlname=
"XAS_TDP_ovlp_nl")
766 TYPE(neighbor_list_set_p_type),
DIMENSION(:), &
768 TYPE(gto_basis_set_p_type),
DIMENSION(:),
POINTER :: basis_a, basis_c
769 INTEGER,
INTENT(IN) :: op_type
770 TYPE(qs_environment_type),
POINTER :: qs_env
771 INTEGER,
DIMENSION(:),
INTENT(IN),
OPTIONAL :: excited_atoms
772 REAL(
dp),
INTENT(IN),
OPTIONAL :: x_range
773 TYPE(distribution_2d_type),
OPTIONAL,
POINTER :: ext_dist2d
775 INTEGER :: ikind, nkind
776 LOGICAL :: sort_atoms
777 LOGICAL,
ALLOCATABLE,
DIMENSION(:) :: a_present, c_present
779 REAL(
dp),
ALLOCATABLE,
DIMENSION(:) :: a_radius, c_radius
780 REAL(
dp),
ALLOCATABLE,
DIMENSION(:, :) :: pair_radius
781 TYPE(atomic_kind_type),
DIMENSION(:),
POINTER :: atomic_kind_set
782 TYPE(cell_type),
POINTER :: cell
783 TYPE(distribution_1d_type),
POINTER :: distribution_1d
784 TYPE(distribution_2d_type),
POINTER :: distribution_2d
785 TYPE(local_atoms_type),
ALLOCATABLE,
DIMENSION(:) :: atom2d
786 TYPE(molecule_type),
DIMENSION(:),
POINTER :: molecule_set
787 TYPE(particle_type),
DIMENSION(:),
POINTER :: particle_set
789 NULLIFY (atomic_kind_set, distribution_1d, distribution_2d, molecule_set, particle_set, cell)
795 IF ((
PRESENT(excited_atoms))) sort_atoms = .true.
797 ALLOCATE (a_present(nkind), c_present(nkind))
800 ALLOCATE (a_radius(nkind), c_radius(nkind))
810 IF (
ASSOCIATED(basis_a(ikind)%gto_basis_set))
THEN
811 a_present(ikind) = .true.
812 CALL get_gto_basis_set(basis_a(ikind)%gto_basis_set, kind_radius=a_radius(ikind))
815 IF (
ASSOCIATED(basis_c(ikind)%gto_basis_set))
THEN
816 c_present(ikind) = .true.
817 CALL get_gto_basis_set(basis_c(ikind)%gto_basis_set, kind_radius=c_radius(ikind))
825 IF (
ASSOCIATED(basis_c(ikind)%gto_basis_set))
THEN
826 c_present(ikind) = .true.
827 c_radius(ikind) = 1000000.0_dp
829 IF (
ASSOCIATED(basis_a(ikind)%gto_basis_set)) a_present(ikind) = .true.
836 IF (
ASSOCIATED(basis_a(ikind)%gto_basis_set))
THEN
837 a_present(ikind) = .true.
838 CALL get_gto_basis_set(basis_a(ikind)%gto_basis_set, kind_radius=a_radius(ikind))
840 IF (
ASSOCIATED(basis_c(ikind)%gto_basis_set))
THEN
841 c_present(ikind) = .true.
842 CALL get_gto_basis_set(basis_c(ikind)%gto_basis_set, kind_radius=c_radius(ikind))
843 c_radius(ikind) = c_radius(ikind) + x_range
848 cpabort(
"Operator not known")
851 ALLOCATE (pair_radius(nkind, nkind))
856 CALL get_qs_env(qs_env, atomic_kind_set=atomic_kind_set, cell=cell, &
857 distribution_2d=distribution_2d, local_particles=distribution_1d, &
858 particle_set=particle_set, molecule_set=molecule_set)
861 IF (
PRESENT(ext_dist2d)) distribution_2d => ext_dist2d
863 ALLOCATE (atom2d(nkind))
864 CALL atom2d_build(atom2d, distribution_1d, distribution_2d, atomic_kind_set, &
865 molecule_set, .false., particle_set)
869 operator_type=
"ABC", atomb_to_keep=excited_atoms, &
870 nlname=
"XAS_TDP_3c_nl")
873 operator_type=
"ABC", nlname=
"XAS_TDP_3c_nl")
894 basis_set_c, qs_env, only_bc_same_center)
896 TYPE(distribution_2d_type),
POINTER :: opt_3c_dist2d
897 TYPE(neighbor_list_set_p_type),
DIMENSION(:), &
898 POINTER :: ab_list, ac_list
899 TYPE(gto_basis_set_p_type),
DIMENSION(:),
POINTER :: basis_set_a, basis_set_b, basis_set_c
900 TYPE(qs_environment_type),
POINTER :: qs_env
901 LOGICAL,
INTENT(IN),
OPTIONAL :: only_bc_same_center
903 CHARACTER(len=*),
PARAMETER :: routinen =
'get_opt_3c_dist2d'
905 INTEGER :: handle, i, iatom, ikind, ip, jatom, &
906 jkind, kkind, mypcol, myprow, n, &
907 natom, nkind, npcol, nprow, nsgfa, &
909 INTEGER,
ALLOCATABLE,
DIMENSION(:) :: nparticle_local_col, nparticle_local_row
910 INTEGER,
DIMENSION(:, :),
POINTER :: col_dist, row_dist
911 LOGICAL :: my_sort_bc
912 REAL(
dp) :: cost, rab(3), rac(3), rbc(3)
913 REAL(
dp),
ALLOCATABLE,
DIMENSION(:) :: col_cost, col_proc_cost, row_cost, &
915 TYPE(cp_1d_i_p_type),
DIMENSION(:),
POINTER :: local_particle_col, local_particle_row
916 TYPE(cp_blacs_env_type),
POINTER :: blacs_env
917 TYPE(mp_para_env_type),
POINTER :: para_env
918 TYPE(neighbor_list_iterator_p_type), &
919 DIMENSION(:),
POINTER :: ab_iter, ac_iter
920 TYPE(particle_type),
DIMENSION(:),
POINTER :: particle_set
921 TYPE(qs_kind_type),
DIMENSION(:),
POINTER :: qs_kind_set
923 NULLIFY (para_env, col_dist, row_dist, blacs_env, qs_kind_set, particle_set)
924 NULLIFY (local_particle_col, local_particle_row, ab_iter, ac_iter)
926 CALL timeset(routinen, handle)
933 IF (
PRESENT(only_bc_same_center)) my_sort_bc = only_bc_same_center
935 CALL get_qs_env(qs_env, natom=natom, para_env=para_env, blacs_env=blacs_env, &
936 qs_kind_set=qs_kind_set, particle_set=particle_set, nkind=nkind)
938 myprow = blacs_env%mepos(1) + 1
939 mypcol = blacs_env%mepos(2) + 1
940 nprow = blacs_env%num_pe(1)
941 npcol = blacs_env%num_pe(2)
943 ALLOCATE (col_cost(natom), row_cost(natom))
944 col_cost = 0.0_dp; row_cost = 0.0_dp
946 ALLOCATE (row_dist(natom, 2), col_dist(natom, 2))
947 row_dist = 1; col_dist = 1
952 CALL get_iterator_info(ab_iter, ikind=ikind, jkind=jkind, iatom=iatom, jatom=jatom, r=rab)
962 rbc(:) = rac(:) - rab(:)
963 IF (.NOT. (all(abs(rbc) .LE. 1.0e-8_dp) .OR. all(abs(rac) .LE. 1.0e-8_dp))) cycle
968 nsgfa = basis_set_a(ikind)%gto_basis_set%nsgf
969 nsgfb = basis_set_b(jkind)%gto_basis_set%nsgf
970 nsgfc = basis_set_c(kkind)%gto_basis_set%nsgf
972 cost = real(nsgfa*nsgfb*nsgfc,
dp)
974 row_cost(iatom) = row_cost(iatom) + cost
975 col_cost(jatom) = col_cost(jatom) + cost
983 CALL para_env%sum(row_cost)
984 CALL para_env%sum(col_cost)
987 ALLOCATE (col_proc_cost(npcol), row_proc_cost(nprow))
988 col_proc_cost = 0.0_dp; row_proc_cost = 0.0_dp
990 iatom = maxloc(row_cost, 1)
991 ip = minloc(row_proc_cost, 1)
992 row_proc_cost(ip) = row_proc_cost(ip) + row_cost(iatom)
993 row_dist(iatom, 1) = ip
994 row_cost(iatom) = 0.0_dp
996 iatom = maxloc(col_cost, 1)
997 ip = minloc(col_proc_cost, 1)
998 col_proc_cost(ip) = col_proc_cost(ip) + col_cost(iatom)
999 col_dist(iatom, 1) = ip
1000 col_cost(iatom) = 0.0_dp
1004 ALLOCATE (local_particle_col(nkind), local_particle_row(nkind))
1005 ALLOCATE (nparticle_local_row(nkind), nparticle_local_col(nkind))
1006 nparticle_local_row = 0; nparticle_local_col = 0
1009 ikind = particle_set(iatom)%atomic_kind%kind_number
1011 IF (row_dist(iatom, 1) == myprow) nparticle_local_row(ikind) = nparticle_local_row(ikind) + 1
1012 IF (col_dist(iatom, 1) == mypcol) nparticle_local_col(ikind) = nparticle_local_col(ikind) + 1
1016 n = nparticle_local_row(ikind)
1017 ALLOCATE (local_particle_row(ikind)%array(n))
1019 n = nparticle_local_col(ikind)
1020 ALLOCATE (local_particle_col(ikind)%array(n))
1023 nparticle_local_row = 0; nparticle_local_col = 0
1025 ikind = particle_set(iatom)%atomic_kind%kind_number
1027 IF (row_dist(iatom, 1) == myprow)
THEN
1028 nparticle_local_row(ikind) = nparticle_local_row(ikind) + 1
1029 local_particle_row(ikind)%array(nparticle_local_row(ikind)) = iatom
1031 IF (col_dist(iatom, 1) == mypcol)
THEN
1032 nparticle_local_col(ikind) = nparticle_local_col(ikind) + 1
1033 local_particle_col(ikind)%array(nparticle_local_col(ikind)) = iatom
1038 row_dist(:, 1) = row_dist(:, 1) - 1
1039 col_dist(:, 1) = col_dist(:, 1) - 1
1041 col_distribution_ptr=col_dist, local_rows_ptr=local_particle_row, &
1042 local_cols_ptr=local_particle_col, blacs_env=blacs_env)
1044 CALL timestop(handle)
1060 INTEGER,
DIMENSION(:),
INTENT(IN) :: ex_atoms
1061 TYPE(xas_tdp_env_type),
POINTER :: xas_tdp_env
1062 TYPE(xas_tdp_control_type),
POINTER :: xas_tdp_control
1063 TYPE(qs_environment_type),
POINTER :: qs_env
1065 CHARACTER(len=*),
PARAMETER :: routinen =
'compute_ri_3c_exchange'
1067 INTEGER :: handle, natom, nkind
1068 INTEGER,
ALLOCATABLE,
DIMENSION(:) :: blk_size_orb, blk_size_ri
1069 TYPE(dbcsr_distribution_type) :: opt_dbcsr_dist
1070 TYPE(gto_basis_set_p_type),
DIMENSION(:),
POINTER :: basis_set_orb, basis_set_ri
1071 TYPE(mp_para_env_type),
POINTER :: para_env
1072 TYPE(neighbor_list_set_p_type),
DIMENSION(:), &
1073 POINTER :: ab_list, ac_list
1074 TYPE(particle_type),
DIMENSION(:),
POINTER :: particle_set
1075 TYPE(qs_kind_type),
DIMENSION(:),
POINTER :: qs_kind_set
1077 NULLIFY (basis_set_ri, basis_set_orb, ac_list, ab_list, qs_kind_set, para_env, particle_set)
1079 CALL timeset(routinen, handle)
1082 CALL get_qs_env(qs_env, nkind=nkind, qs_kind_set=qs_kind_set, para_env=para_env, &
1083 natom=natom, particle_set=particle_set)
1086 ALLOCATE (basis_set_ri(nkind))
1087 ALLOCATE (basis_set_orb(nkind))
1094 xas_tdp_control%ri_m_potential%potential_type, qs_env, &
1095 excited_atoms=ex_atoms, x_range=xas_tdp_control%ri_m_potential%cutoff_radius)
1097 CALL get_opt_3c_dist2d(xas_tdp_env%opt_dist2d_ex, ab_list, ac_list, basis_set_orb, &
1098 basis_set_orb, basis_set_ri, qs_env)
1104 ext_dist2d=xas_tdp_env%opt_dist2d_ex)
1106 xas_tdp_control%ri_m_potential%potential_type, qs_env, &
1107 excited_atoms=ex_atoms, x_range=xas_tdp_control%ri_m_potential%cutoff_radius, &
1108 ext_dist2d=xas_tdp_env%opt_dist2d_ex)
1111 ALLOCATE (blk_size_orb(natom), blk_size_ri(natom))
1113 CALL get_particle_set(particle_set, qs_kind_set, nsgf=blk_size_orb, basis=basis_set_orb)
1114 CALL get_particle_set(particle_set, qs_kind_set, nsgf=blk_size_ri, basis=basis_set_ri)
1116 ALLOCATE (xas_tdp_env%ri_3c_ex)
1117 CALL create_pqx_tensor(xas_tdp_env%ri_3c_ex, ab_list, ac_list, opt_dbcsr_dist, blk_size_orb, &
1118 blk_size_orb, blk_size_ri)
1119 CALL fill_pqx_tensor(xas_tdp_env%ri_3c_ex, ab_list, ac_list, basis_set_orb, basis_set_orb, &
1120 basis_set_ri, xas_tdp_control%ri_m_potential, qs_env, &
1121 eps_screen=xas_tdp_control%eps_screen)
1126 CALL dbcsr_distribution_release(opt_dbcsr_dist)
1127 DEALLOCATE (basis_set_ri, basis_set_orb)
1131 CALL para_env%sync()
1133 CALL timestop(handle)
1147 TYPE(xas_tdp_env_type),
POINTER :: xas_tdp_env
1148 TYPE(qs_environment_type),
POINTER :: qs_env
1150 CHARACTER(len=*),
PARAMETER :: routinen =
'compute_ri_3c_coulomb'
1152 INTEGER :: handle, natom, nkind
1153 INTEGER,
ALLOCATABLE,
DIMENSION(:) :: blk_size_orb, blk_size_ri
1154 TYPE(dbcsr_distribution_type) :: opt_dbcsr_dist
1155 TYPE(gto_basis_set_p_type),
DIMENSION(:),
POINTER :: basis_set_orb, basis_set_ri
1156 TYPE(libint_potential_type) :: pot
1157 TYPE(mp_para_env_type),
POINTER :: para_env
1158 TYPE(neighbor_list_set_p_type),
DIMENSION(:), &
1159 POINTER :: ab_list, ac_list
1160 TYPE(particle_type),
DIMENSION(:),
POINTER :: particle_set
1161 TYPE(qs_kind_type),
DIMENSION(:),
POINTER :: qs_kind_set
1163 NULLIFY (basis_set_ri, basis_set_orb, ac_list, ab_list, qs_kind_set, para_env, particle_set)
1165 CALL timeset(routinen, handle)
1168 CALL get_qs_env(qs_env, nkind=nkind, qs_kind_set=qs_kind_set, para_env=para_env, &
1169 natom=natom, particle_set=particle_set)
1172 ALLOCATE (basis_set_ri(nkind))
1173 ALLOCATE (basis_set_orb(nkind))
1179 excited_atoms=xas_tdp_env%ex_atom_indices)
1181 qs_env, excited_atoms=xas_tdp_env%ex_atom_indices)
1182 CALL get_opt_3c_dist2d(xas_tdp_env%opt_dist2d_coul, ab_list, ac_list, basis_set_orb, &
1183 basis_set_orb, basis_set_ri, qs_env, only_bc_same_center=.true.)
1191 excited_atoms=xas_tdp_env%ex_atom_indices, &
1192 ext_dist2d=xas_tdp_env%opt_dist2d_coul)
1197 qs_env, excited_atoms=xas_tdp_env%ex_atom_indices, &
1198 ext_dist2d=xas_tdp_env%opt_dist2d_coul)
1201 ALLOCATE (blk_size_orb(natom), blk_size_ri(natom))
1203 CALL get_particle_set(particle_set, qs_kind_set, nsgf=blk_size_orb, basis=basis_set_orb)
1204 CALL get_particle_set(particle_set, qs_kind_set, nsgf=blk_size_ri, basis=basis_set_ri)
1207 ALLOCATE (xas_tdp_env%ri_3c_coul)
1208 CALL create_pqx_tensor(xas_tdp_env%ri_3c_coul, ab_list, ac_list, opt_dbcsr_dist, blk_size_orb, &
1209 blk_size_orb, blk_size_ri, only_bc_same_center=.true.)
1210 CALL fill_pqx_tensor(xas_tdp_env%ri_3c_coul, ab_list, ac_list, basis_set_orb, basis_set_orb, &
1211 basis_set_ri, pot, qs_env, only_bc_same_center=.true.)
1216 CALL dbcsr_distribution_release(opt_dbcsr_dist)
1217 DEALLOCATE (basis_set_ri, basis_set_orb)
1221 CALL para_env%sync()
1223 CALL timestop(handle)
1242 INTEGER,
INTENT(IN) :: ex_kind
1243 TYPE(xas_tdp_env_type),
POINTER :: xas_tdp_env
1244 TYPE(xas_tdp_control_type),
POINTER :: xas_tdp_control
1245 TYPE(qs_environment_type),
POINTER :: qs_env
1247 INTEGER :: egfp, egfq, maxl, ncop, ncoq, nset, &
1248 nsgf, pset, qset, sgfp, sgfq, unit_id
1249 INTEGER,
DIMENSION(:),
POINTER :: lmax, lmin, npgf_set, nsgf_set
1250 INTEGER,
DIMENSION(:, :),
POINTER :: first_sgf
1252 REAL(
dp),
ALLOCATABLE,
DIMENSION(:, :) :: metric, pq, work
1253 REAL(
dp),
DIMENSION(:, :),
POINTER :: rpgf, sphi, zet
1254 TYPE(cp_libint_t) :: lib
1255 TYPE(gto_basis_set_type),
POINTER :: ri_basis
1256 TYPE(mp_para_env_type),
POINTER :: para_env
1257 TYPE(qs_kind_type),
DIMENSION(:),
POINTER :: qs_kind_set
1259 NULLIFY (ri_basis, qs_kind_set, para_env, lmin, lmax, npgf_set, zet, rpgf, first_sgf)
1260 NULLIFY (sphi, nsgf_set)
1263 CALL get_qs_env(qs_env, qs_kind_set=qs_kind_set, para_env=para_env)
1264 IF (
ASSOCIATED(xas_tdp_env%ri_inv_ex))
THEN
1265 DEALLOCATE (xas_tdp_env%ri_inv_ex)
1269 CALL get_qs_kind(qs_kind_set(ex_kind), basis_set=ri_basis, basis_type=
"RI_XAS")
1270 CALL get_gto_basis_set(ri_basis, nsgf=nsgf, maxl=maxl, npgf=npgf_set, lmin=lmin, &
1271 lmax=lmax, zet=zet, pgf_radius=rpgf, first_sgf=first_sgf, &
1272 nsgf_set=nsgf_set, sphi=sphi, nset=nset)
1273 ALLOCATE (metric(nsgf, nsgf))
1286 IF (para_env%mepos == 0)
THEN
1287 CALL open_file(unit_number=unit_id, file_name=xas_tdp_control%ri_m_potential%filename)
1289 CALL init(2*maxl + 1, unit_id, para_env%mepos, para_env)
1290 IF (para_env%mepos == 0)
THEN
1298 ncop = npgf_set(pset)*
ncoset(lmax(pset))
1299 sgfp = first_sgf(1, pset)
1300 egfp = sgfp + nsgf_set(pset) - 1
1303 ncoq = npgf_set(qset)*
ncoset(lmax(qset))
1304 sgfq = first_sgf(1, qset)
1305 egfq = sgfq + nsgf_set(qset) - 1
1307 ALLOCATE (work(ncop, ncoq))
1310 CALL eri_2center(work, lmin(pset), lmax(pset), npgf_set(pset), zet(:, pset), rpgf(:, pset), &
1311 r, lmin(qset), lmax(qset), npgf_set(qset), zet(:, qset), rpgf(:, qset), &
1312 r, 0.0_dp, lib, xas_tdp_control%ri_m_potential)
1314 CALL ab_contract(metric(sgfp:egfp, sgfq:egfq), work, sphi(:, sgfp:), sphi(:, sgfq:), &
1315 ncop, ncoq, nsgf_set(pset), nsgf_set(qset))
1324 IF (.NOT. xas_tdp_control%do_ri_metric)
THEN
1327 ALLOCATE (xas_tdp_env%ri_inv_ex(nsgf, nsgf))
1328 xas_tdp_env%ri_inv_ex(:, :) = metric(:, :)
1338 IF (para_env%mepos == 0)
THEN
1339 CALL open_file(unit_number=unit_id, file_name=xas_tdp_control%x_potential%filename)
1341 CALL init(2*maxl + 1, unit_id, para_env%mepos, para_env)
1342 IF (para_env%mepos == 0)
THEN
1349 ALLOCATE (pq(nsgf, nsgf))
1353 ncop = npgf_set(pset)*
ncoset(lmax(pset))
1354 sgfp = first_sgf(1, pset)
1355 egfp = sgfp + nsgf_set(pset) - 1
1358 ncoq = npgf_set(qset)*
ncoset(lmax(qset))
1359 sgfq = first_sgf(1, qset)
1360 egfq = sgfq + nsgf_set(qset) - 1
1362 ALLOCATE (work(ncop, ncoq))
1365 CALL eri_2center(work, lmin(pset), lmax(pset), npgf_set(pset), zet(:, pset), rpgf(:, pset), &
1366 r, lmin(qset), lmax(qset), npgf_set(qset), zet(:, qset), rpgf(:, qset), &
1367 r, 0.0_dp, lib, xas_tdp_control%x_potential)
1369 CALL ab_contract(pq(sgfp:egfp, sgfq:egfq), work, sphi(:, sgfp:), sphi(:, sgfq:), &
1370 ncop, ncoq, nsgf_set(pset), nsgf_set(qset))
1377 ALLOCATE (xas_tdp_env%ri_inv_ex(nsgf, nsgf))
1378 xas_tdp_env%ri_inv_ex = 0.0_dp
1380 CALL dgemm(
'N',
'N', nsgf, nsgf, nsgf, 1.0_dp, metric, nsgf, pq, nsgf, &
1381 0.0_dp, xas_tdp_env%ri_inv_ex, nsgf)
1382 CALL dgemm(
'N',
'N', nsgf, nsgf, nsgf, 1.0_dp, xas_tdp_env%ri_inv_ex, nsgf, metric, nsgf, &
1384 xas_tdp_env%ri_inv_ex(:, :) = pq(:, :)
1401 INTEGER,
INTENT(IN) :: ex_kind
1402 TYPE(xas_tdp_env_type),
POINTER :: xas_tdp_env
1403 TYPE(xas_tdp_control_type),
POINTER :: xas_tdp_control
1404 TYPE(qs_environment_type),
POINTER :: qs_env
1407 TYPE(gto_basis_set_type),
POINTER :: ri_basis
1408 TYPE(qs_kind_type),
DIMENSION(:),
POINTER :: qs_kind_set
1410 NULLIFY (ri_basis, qs_kind_set)
1413 CALL get_qs_env(qs_env, qs_kind_set=qs_kind_set)
1414 IF (
ASSOCIATED(xas_tdp_env%ri_inv_coul))
THEN
1415 DEALLOCATE (xas_tdp_env%ri_inv_coul)
1419 CALL get_qs_kind(qs_kind_set(ex_kind), basis_set=ri_basis, basis_type=
"RI_XAS")
1421 ALLOCATE (xas_tdp_env%ri_inv_coul(nsgf, nsgf))
1422 xas_tdp_env%ri_inv_coul = 0.0_dp
1424 IF (.NOT. xas_tdp_control%is_periodic)
THEN
1426 rab=(/0.0_dp, 0.0_dp, 0.0_dp/), fba=ri_basis, fbb=ri_basis, &
1427 calculate_forces=.false.)
1428 cpassert(
ASSOCIATED(xas_tdp_control))
1430 CALL periodic_ri_coulomb2(xas_tdp_env%ri_inv_coul, ri_basis, qs_env)
1444 SUBROUTINE periodic_ri_coulomb2(ri_coul2, ri_basis, qs_env)
1446 REAL(
dp),
DIMENSION(:, :),
INTENT(INOUT) :: ri_coul2
1447 TYPE(gto_basis_set_type),
POINTER :: ri_basis
1448 TYPE(qs_environment_type),
POINTER :: qs_env
1450 INTEGER :: maxco, ncop, ncoq, nset, op, oq, ppgf, &
1451 pset, qpgf, qset, sgfp, sgfq
1452 INTEGER,
DIMENSION(:),
POINTER :: lmax, lmin, npgf, nsgf
1453 INTEGER,
DIMENSION(:, :),
POINTER :: first_sgf
1455 REAL(
dp),
ALLOCATABLE,
DIMENSION(:, :) :: hpq
1456 REAL(
dp),
DIMENSION(:, :),
POINTER :: sphi, zet
1457 TYPE(cell_type),
POINTER :: cell
1458 TYPE(cp_eri_mme_param) :: mme_param
1459 TYPE(mp_para_env_type),
POINTER :: para_env
1460 TYPE(qs_kind_type),
DIMENSION(:),
POINTER :: qs_kind_set
1462 NULLIFY (cell, qs_kind_set, lmin, lmax, nsgf, npgf, zet, sphi, first_sgf)
1467 CALL get_qs_env(qs_env, cell=cell, qs_kind_set=qs_kind_set, para_env=para_env)
1469 CALL eri_mme_init(mme_param%par, n_minimax=20, cutoff=300.0_dp, do_calib_cutoff=.true., &
1470 cutoff_min=10.0_dp, cutoff_max=10000.0_dp, cutoff_eps=0.01_dp, &
1471 cutoff_delta=0.9_dp, sum_precision=1.0e-12_dp, debug=.false., &
1472 debug_delta=1.0e-6_dp, debug_nsum=1000000, unit_nr=0, print_calib=.false., &
1473 do_error_est=.false.)
1474 mme_param%do_calib = .true.
1476 CALL cp_eri_mme_set_params(mme_param, cell, qs_kind_set, basis_type_1=
"RI_XAS", para_env=para_env)
1478 CALL get_gto_basis_set(ri_basis, lmax=lmax, npgf=npgf, zet=zet, lmin=lmin, nset=nset, &
1479 nsgf_set=nsgf, sphi=sphi, first_sgf=first_sgf, maxco=maxco)
1482 ALLOCATE (hpq(nset*maxco, nset*maxco))
1486 ncop = npgf(pset)*
ncoset(lmax(pset))
1487 sgfp = first_sgf(1, pset)
1490 ncoq = npgf(qset)*
ncoset(lmax(qset))
1491 sgfq = first_sgf(1, qset)
1493 DO ppgf = 1, npgf(pset)
1494 op = (pset - 1)*maxco + (ppgf - 1)*
ncoset(lmax(pset))
1495 DO qpgf = 1, npgf(qset)
1496 oq = (qset - 1)*maxco + (qpgf - 1)*
ncoset(lmax(qset))
1499 lmax(qset), zet(ppgf, pset), zet(qpgf, qset), r, hpq, &
1506 op = (pset - 1)*maxco + 1
1507 oq = (qset - 1)*maxco + 1
1509 CALL ab_contract(ri_coul2(sgfp:sgfp + nsgf(pset) - 1, sgfq:sgfq + nsgf(qset) - 1), &
1510 hpq(op:op + ncop - 1, oq:oq + ncoq - 1), sphi(:, sgfp:), sphi(:, sgfq:), &
1511 ncop, ncoq, nsgf(pset), nsgf(qset))
1519 END SUBROUTINE periodic_ri_coulomb2
static int imax(int x, int y)
Returns the larger of two given integer (missing from the C standard)
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.
Contraction of integrals over primitive Cartesian Gaussians based on the contraction matrix sphi whic...
subroutine, public libxsmm_abc_contract(abcint, sabc, tsphi_a, sphi_b, sphi_c, ncoa, ncob, ncoc, nsgfa, nsgfb, nsgfc, cpp_buffer, ccp_buffer)
3-center contraction routine from primitive cartesain Gaussians to spherical Gaussian functions....
subroutine, public ab_contract(abint, sab, sphi_a, sphi_b, ncoa, ncob, nsgfa, nsgfb)
contract overlap integrals (a,b) and transfer to spherical Gaussians
Define the atomic kind types and their sub types.
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.
constants for the different operators of the 2c-integrals
integer, parameter, public operator_coulomb
various utilities that regard array of different kinds: output, allocation,... maybe it is not a good...
methods related to the blacs parallel environment
DBCSR operations in CP2K.
subroutine, public cp_dbcsr_dist2d_to_dist(dist2d, dist)
Creates a DBCSR distribution from a distribution_2d.
Interface to Minimax-Ewald method for periodic ERI's to be used in CP2K.
Utility routines to open and close files. Tracking of preconnections.
subroutine, public open_file(file_name, file_status, file_form, file_action, file_position, file_pad, unit_number, debug, skip_get_unit_number, file_access)
Opens the requested file using a free unit number.
subroutine, public close_file(unit_number, file_status, keep_preconnection)
Close an open file given by its logical unit number. Optionally, keep the file and unit preconnected.
This is the start of a dbt_api, all publically needed functions are exported here....
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...
subroutine, public distribution_2d_create(distribution_2d, blacs_env, local_rows_ptr, n_local_rows, local_cols_ptr, row_distribution_ptr, col_distribution_ptr, n_local_cols, n_row_distribution, n_col_distribution)
initializes the distribution_2d
Minimax-Ewald (MME) method for calculating 2-center and 3-center electron repulsion integrals (ERI) o...
subroutine, public eri_mme_2c_integrate(param, la_min, la_max, lb_min, lb_max, zeta, zetb, rab, hab, o1, o2, G_count, R_count, normalize, potential, pot_par)
Low-level integration routine for 2-center ERIs.
Types and initialization / release routines for Minimax-Ewald method for electron repulsion integrals...
subroutine, public eri_mme_release(param)
...
subroutine, public eri_mme_init(param, n_minimax, cutoff, do_calib_cutoff, do_error_est, cutoff_min, cutoff_max, cutoff_eps, cutoff_delta, sum_precision, debug, debug_delta, debug_nsum, unit_nr, print_calib)
...
Calculation of the incomplete Gamma function F_n(t) for multi-center integrals over Cartesian Gaussia...
subroutine, public init_md_ftable(nmax)
Initialize a table of F_n(t) values in the range 0 <= t <= 12 with a stepsize of 0....
Calculation of contracted, spherical Gaussian integrals using the (OS) integral scheme....
subroutine, public int_operators_r12_ab_os(r12_operator, vab, dvab, rab, fba, fbb, omega, r_cutoff, calculate_forces)
Calcululates the two-center integrals of the type (a|O(r12)|b) using the OS scheme.
Defines the basic variable types.
integer, parameter, public dp
2- and 3-center electron repulsion integral routines based on libint2 Currently available operators: ...
subroutine, public eri_2center(int_ab, la_min, la_max, npgfa, zeta, rpgfa, ra, lb_min, lb_max, npgfb, zetb, rpgfb, rb, dab, lib, potential_parameter)
Computes the 2-center electron repulsion integrals (a|b) for a given set of cartesian gaussian orbita...
subroutine, public eri_3center(int_abc, la_min, la_max, npgfa, zeta, rpgfa, ra, lb_min, lb_max, npgfb, zetb, rpgfb, rb, lc_min, lc_max, npgfc, zetc, rpgfc, rc, dab, dac, dbc, lib, potential_parameter, int_abc_ext)
Computes the 3-center electron repulsion integrals (ab|c) for a given set of cartesian gaussian orbit...
real(kind=dp), parameter, public cutoff_screen_factor
Interface to the Libint-Library or a c++ wrapper.
subroutine, public cp_libint_init_2eri(lib, max_am)
subroutine, public cp_libint_init_3eri(lib, max_am)
subroutine, public cp_libint_cleanup_3eri(lib)
subroutine, public cp_libint_set_contrdepth(lib, contrdepth)
subroutine, public cp_libint_cleanup_2eri(lib)
Collection of simple mathematical functions and subroutines.
subroutine, public invmat_symm(a, cholesky_triangle)
returns inverse of real symmetric, positive definite matrix
Interface to the message passing library MPI.
Define the data structure for the molecule information.
Provides Cartesian and spherical orbital pointers and indices.
integer, dimension(:), allocatable, public ncoset
Define methods related to particle_type.
subroutine, public get_particle_set(particle_set, qs_kind_set, first_sgf, last_sgf, nsgf, nmao, basis)
Get the components of a particle set.
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.
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, 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.
Define the neighbor list data types and the corresponding functionality.
subroutine, public release_neighbor_list_sets(nlists)
releases an array of neighbor_list_sets
integer function, public nl_sub_iterate(iterator_set, mepos)
...
subroutine, public neighbor_list_iterator_create(iterator_set, nl, search, nthread)
Neighbor list iterator functions.
subroutine, public nl_set_sub_iterator(iterator_set, ikind, jkind, iatom, mepos)
...
subroutine, public neighbor_list_iterator_release(iterator_set)
...
subroutine, public get_neighbor_list_set_p(neighbor_list_sets, nlist, symmetric)
Return the components of the first neighbor list 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)
...
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 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.
3-center overlap type integrals containers
subroutine, public get_o3c_iterator_info(o3c_iterator, mepos, iatom, jatom, katom, ikind, jkind, kkind, rij, rik, cellj, cellk, integral, tvec, force_i, force_j, force_k)
...
subroutine, public o3c_iterator_create(o3c, o3c_iterator, nthread)
...
subroutine, public release_o3c_container(o3c_container)
...
subroutine, public o3c_iterator_release(o3c_iterator)
...
integer function, public o3c_iterate(o3c_iterator, mepos)
...
subroutine, public init_o3c_container(o3c, nspin, basis_set_list_a, basis_set_list_b, basis_set_list_c, sab_nl, sac_nl, only_bc_same_center)
...
This module computes the basic integrals for the truncated coulomb operator.
subroutine, public init(Nder, iunit, mepos, group)
...
integer function, public get_lmax_init()
Returns the value of nderiv_init so that one can check if opening the potential file is worhtwhile.
3-center integrals machinery for the XAS_TDP method
subroutine, public build_xas_tdp_3c_nl(ac_list, basis_a, basis_c, op_type, qs_env, excited_atoms, x_range, ext_dist2d)
Builds a neighbor lists set taylored for 3-center integral within XAS TDP, such that only excited ato...
subroutine, public compute_ri_coulomb2_int(ex_kind, xas_tdp_env, xas_tdp_control, qs_env)
Computes the two-center Coulomb integral needed for the RI in kernel calculation. Stores the integral...
subroutine, public build_xas_tdp_ovlp_nl(ab_list, basis_a, basis_b, qs_env, excited_atoms, ext_dist2d)
Builds a neighbor lists set for overlaping 2-center S_ab, where b is restricted on a a given list of ...
subroutine, public create_pqx_tensor(pq_X, ab_nl, ac_nl, matrix_dist, blk_size_1, blk_size_2, blk_size_3, only_bc_same_center)
Prepares a tensor to hold 3-center integrals (pq|X), where p,q are distributed according to the given...
subroutine, public compute_ri_3c_coulomb(xas_tdp_env, qs_env)
Computes the RI Coulomb 3-center integrals (ab|c), where c is from the RI_XAS basis and centered on t...
subroutine, public compute_ri_exchange2_int(ex_kind, xas_tdp_env, xas_tdp_control, qs_env)
Computes the two-center Exchange integral needed for the RI in kernel calculation....
subroutine, public get_opt_3c_dist2d(opt_3c_dist2d, ab_list, ac_list, basis_set_a, basis_set_b, basis_set_c, qs_env, only_bc_same_center)
Returns an optimized distribution_2d for the given neighbor lists based on an evaluation of the cost ...
subroutine, public compute_ri_3c_exchange(ex_atoms, xas_tdp_env, xas_tdp_control, qs_env)
Computes the RI exchange 3-center integrals (ab|c), where c is from the RI_XAS basis and centered on ...
subroutine, public fill_pqx_tensor(pq_X, ab_nl, ac_nl, basis_set_list_a, basis_set_list_b, basis_set_list_c, potential_parameter, qs_env, only_bc_same_center, eps_screen)
Fills the given 3 dimensional (pq|X) tensor with integrals.
Define XAS TDP control type and associated create, release, etc subroutines, as well as XAS TDP envir...