ints_exchange Subroutine

public subroutine ints_exchange(basis, schwarz_ints, mu2)

Uses

  • proc~~ints_exchange~~UsesGraph proc~ints_exchange ints_exchange iso_c_binding iso_c_binding proc~ints_exchange->iso_c_binding module~constants constants proc~ints_exchange->module~constants module~int2e_libint int2e_libint proc~ints_exchange->module~int2e_libint module~int2e_rotaxis int2e_rotaxis proc~ints_exchange->module~int2e_rotaxis module~int2e_rys int2e_rys proc~ints_exchange->module~int2e_rys module~types types proc~ints_exchange->module~types module~precision precision module~constants->module~precision module~int2e_libint->iso_c_binding module~int2e_libint->module~constants module~int2_pairs int2_pairs module~int2e_libint->module~int2_pairs module~libint_f libint_f module~int2e_libint->module~libint_f module~int2e_libint->module~precision module~int2e_rotaxis->module~constants boys_lut boys_lut module~int2e_rotaxis->boys_lut module~basis_tools basis_tools module~int2e_rotaxis->module~basis_tools module~int2e_rotaxis->module~int2_pairs module~int2e_rotaxis->module~precision module~int2e_rys->module~constants module~int2e_rys->module~basis_tools module~int2e_rys->module~precision module~types->iso_c_binding module~atomic_structure_m atomic_structure_m module~types->module~atomic_structure_m module~types->module~basis_tools module~functionals functionals module~types->module~functionals module~parallel parallel module~types->module~parallel module~types->module~precision tagarray tagarray module~types->tagarray module~atomic_structure_m->iso_c_binding module~basis_tools->module~constants module~basis_tools->module~atomic_structure_m module~basis_tools->module~parallel module~basis_tools->module~precision iso_fortran_env iso_fortran_env module~basis_tools->iso_fortran_env module~io_constants io_constants module~basis_tools->module~io_constants module~functionals->iso_c_binding module~functionals->module~precision xc_f03_lib_m xc_f03_lib_m module~functionals->xc_f03_lib_m module~int2_pairs->module~precision module~libint_f->iso_c_binding module~parallel->iso_c_binding module~parallel->module~precision module~parallel->iso_fortran_env mpi mpi module~parallel->mpi module~precision->iso_fortran_env

Arguments

Type IntentOptional Attributes Name
type(basis_set), intent(in) :: basis
real(kind=dp), intent(inout) :: schwarz_ints(:,:)
real(kind=dp), intent(in), optional :: mu2

Calls

proc~~ints_exchange~~CallsGraph proc~ints_exchange ints_exchange interface~show_message show_message proc~ints_exchange->interface~show_message libint2_cleanup_eri libint2_cleanup_eri proc~ints_exchange->libint2_cleanup_eri libint2_init_eri libint2_init_eri proc~ints_exchange->libint2_init_eri none~alloc int2_pair_storage%alloc proc~ints_exchange->none~alloc none~clean~2 int2_rys_data_t%clean proc~ints_exchange->none~clean~2 none~compute int2_pair_storage%compute proc~ints_exchange->none~compute none~init~2 int2_rys_data_t%init proc~ints_exchange->none~init~2 none~set int2_cutoffs_t%set proc~ints_exchange->none~set none~set_ids int2_rys_data_t%set_ids proc~ints_exchange->none~set_ids proc~genr22 genr22 proc~ints_exchange->proc~genr22 proc~int2_rys_compute int2_rys_compute proc~ints_exchange->proc~int2_rys_compute proc~libint_compute_eri libint_compute_eri proc~ints_exchange->proc~libint_compute_eri fgrid fgrid proc~genr22->fgrid rfinc rfinc proc~genr22->rfinc rmr rmr proc~genr22->rmr xgrid xgrid proc~genr22->xgrid none~evaluate rys_root_t%evaluate proc~int2_rys_compute->none~evaluate ab_x ab_x proc~libint_compute_eri->ab_x ab_y ab_y proc~libint_compute_eri->ab_y ab_z ab_z proc~libint_compute_eri->ab_z alpha1over_zetapluseta alpha1over_zetapluseta proc~libint_compute_eri->alpha1over_zetapluseta alpha1rho_over_zeta2 alpha1rho_over_zeta2 proc~libint_compute_eri->alpha1rho_over_zeta2 alpha2over_zetapluseta alpha2over_zetapluseta proc~libint_compute_eri->alpha2over_zetapluseta alpha2rho_over_zeta2 alpha2rho_over_zeta2 proc~libint_compute_eri->alpha2rho_over_zeta2 alpha3over_zetapluseta alpha3over_zetapluseta proc~libint_compute_eri->alpha3over_zetapluseta alpha3rho_over_eta2 alpha3rho_over_eta2 proc~libint_compute_eri->alpha3rho_over_eta2 alpha4over_zetapluseta alpha4over_zetapluseta proc~libint_compute_eri->alpha4over_zetapluseta alpha4rho_over_eta2 alpha4rho_over_eta2 proc~libint_compute_eri->alpha4rho_over_eta2 cd_x cd_x proc~libint_compute_eri->cd_x cd_y cd_y proc~libint_compute_eri->cd_y cd_z cd_z proc~libint_compute_eri->cd_z f_ab_s___0__s___1___twoprep_s___0__s___1___ab__up_0 f_ab_s___0__s___1___twoprep_s___0__s___1___ab__up_0 proc~libint_compute_eri->f_ab_s___0__s___1___twoprep_s___0__s___1___ab__up_0 f_ab_s___0__s___1___twoprep_s___0__s___1___ab__up_1 f_ab_s___0__s___1___twoprep_s___0__s___1___ab__up_1 proc~libint_compute_eri->f_ab_s___0__s___1___twoprep_s___0__s___1___ab__up_1 f_ab_s___0__s___1___twoprep_s___0__s___1___ab__up_10 f_ab_s___0__s___1___twoprep_s___0__s___1___ab__up_10 proc~libint_compute_eri->f_ab_s___0__s___1___twoprep_s___0__s___1___ab__up_10 f_ab_s___0__s___1___twoprep_s___0__s___1___ab__up_11 f_ab_s___0__s___1___twoprep_s___0__s___1___ab__up_11 proc~libint_compute_eri->f_ab_s___0__s___1___twoprep_s___0__s___1___ab__up_11 f_ab_s___0__s___1___twoprep_s___0__s___1___ab__up_12 f_ab_s___0__s___1___twoprep_s___0__s___1___ab__up_12 proc~libint_compute_eri->f_ab_s___0__s___1___twoprep_s___0__s___1___ab__up_12 f_ab_s___0__s___1___twoprep_s___0__s___1___ab__up_13 f_ab_s___0__s___1___twoprep_s___0__s___1___ab__up_13 proc~libint_compute_eri->f_ab_s___0__s___1___twoprep_s___0__s___1___ab__up_13 f_ab_s___0__s___1___twoprep_s___0__s___1___ab__up_14 f_ab_s___0__s___1___twoprep_s___0__s___1___ab__up_14 proc~libint_compute_eri->f_ab_s___0__s___1___twoprep_s___0__s___1___ab__up_14 f_ab_s___0__s___1___twoprep_s___0__s___1___ab__up_15 f_ab_s___0__s___1___twoprep_s___0__s___1___ab__up_15 proc~libint_compute_eri->f_ab_s___0__s___1___twoprep_s___0__s___1___ab__up_15 f_ab_s___0__s___1___twoprep_s___0__s___1___ab__up_16 f_ab_s___0__s___1___twoprep_s___0__s___1___ab__up_16 proc~libint_compute_eri->f_ab_s___0__s___1___twoprep_s___0__s___1___ab__up_16 f_ab_s___0__s___1___twoprep_s___0__s___1___ab__up_17 f_ab_s___0__s___1___twoprep_s___0__s___1___ab__up_17 proc~libint_compute_eri->f_ab_s___0__s___1___twoprep_s___0__s___1___ab__up_17 f_ab_s___0__s___1___twoprep_s___0__s___1___ab__up_18 f_ab_s___0__s___1___twoprep_s___0__s___1___ab__up_18 proc~libint_compute_eri->f_ab_s___0__s___1___twoprep_s___0__s___1___ab__up_18 f_ab_s___0__s___1___twoprep_s___0__s___1___ab__up_19 f_ab_s___0__s___1___twoprep_s___0__s___1___ab__up_19 proc~libint_compute_eri->f_ab_s___0__s___1___twoprep_s___0__s___1___ab__up_19 f_ab_s___0__s___1___twoprep_s___0__s___1___ab__up_2 f_ab_s___0__s___1___twoprep_s___0__s___1___ab__up_2 proc~libint_compute_eri->f_ab_s___0__s___1___twoprep_s___0__s___1___ab__up_2 f_ab_s___0__s___1___twoprep_s___0__s___1___ab__up_20 f_ab_s___0__s___1___twoprep_s___0__s___1___ab__up_20 proc~libint_compute_eri->f_ab_s___0__s___1___twoprep_s___0__s___1___ab__up_20 f_ab_s___0__s___1___twoprep_s___0__s___1___ab__up_3 f_ab_s___0__s___1___twoprep_s___0__s___1___ab__up_3 proc~libint_compute_eri->f_ab_s___0__s___1___twoprep_s___0__s___1___ab__up_3 f_ab_s___0__s___1___twoprep_s___0__s___1___ab__up_4 f_ab_s___0__s___1___twoprep_s___0__s___1___ab__up_4 proc~libint_compute_eri->f_ab_s___0__s___1___twoprep_s___0__s___1___ab__up_4 f_ab_s___0__s___1___twoprep_s___0__s___1___ab__up_5 f_ab_s___0__s___1___twoprep_s___0__s___1___ab__up_5 proc~libint_compute_eri->f_ab_s___0__s___1___twoprep_s___0__s___1___ab__up_5 f_ab_s___0__s___1___twoprep_s___0__s___1___ab__up_6 f_ab_s___0__s___1___twoprep_s___0__s___1___ab__up_6 proc~libint_compute_eri->f_ab_s___0__s___1___twoprep_s___0__s___1___ab__up_6 f_ab_s___0__s___1___twoprep_s___0__s___1___ab__up_7 f_ab_s___0__s___1___twoprep_s___0__s___1___ab__up_7 proc~libint_compute_eri->f_ab_s___0__s___1___twoprep_s___0__s___1___ab__up_7 f_ab_s___0__s___1___twoprep_s___0__s___1___ab__up_8 f_ab_s___0__s___1___twoprep_s___0__s___1___ab__up_8 proc~libint_compute_eri->f_ab_s___0__s___1___twoprep_s___0__s___1___ab__up_8 f_ab_s___0__s___1___twoprep_s___0__s___1___ab__up_9 f_ab_s___0__s___1___twoprep_s___0__s___1___ab__up_9 proc~libint_compute_eri->f_ab_s___0__s___1___twoprep_s___0__s___1___ab__up_9 proc~libint_compute_eri->fgrid igrid igrid proc~libint_compute_eri->igrid irgrd irgrd proc~libint_compute_eri->irgrd oo2e oo2e proc~libint_compute_eri->oo2e oo2z oo2z proc~libint_compute_eri->oo2z oo2ze oo2ze proc~libint_compute_eri->oo2ze pa_x pa_x proc~libint_compute_eri->pa_x pa_y pa_y proc~libint_compute_eri->pa_y pa_z pa_z proc~libint_compute_eri->pa_z qc_x qc_x proc~libint_compute_eri->qc_x qc_y qc_y proc~libint_compute_eri->qc_y qc_z qc_z proc~libint_compute_eri->qc_z proc~libint_compute_eri->rfinc rho12_over_alpha1 rho12_over_alpha1 proc~libint_compute_eri->rho12_over_alpha1 rho12_over_alpha2 rho12_over_alpha2 proc~libint_compute_eri->rho12_over_alpha2 rho34_over_alpha3 rho34_over_alpha3 proc~libint_compute_eri->rho34_over_alpha3 rho34_over_alpha4 rho34_over_alpha4 proc~libint_compute_eri->rho34_over_alpha4 proc~libint_compute_eri->rmr roe roe proc~libint_compute_eri->roe roz roz proc~libint_compute_eri->roz two_alpha0_bra two_alpha0_bra proc~libint_compute_eri->two_alpha0_bra two_alpha0_ket two_alpha0_ket proc~libint_compute_eri->two_alpha0_ket two_alpha1bra two_alpha1bra proc~libint_compute_eri->two_alpha1bra two_alpha1ket two_alpha1ket proc~libint_compute_eri->two_alpha1ket wp_x wp_x proc~libint_compute_eri->wp_x wp_y wp_y proc~libint_compute_eri->wp_y wp_z wp_z proc~libint_compute_eri->wp_z wq_x wq_x proc~libint_compute_eri->wq_x wq_y wq_y proc~libint_compute_eri->wq_y wq_z wq_z proc~libint_compute_eri->wq_z

Called by

proc~~ints_exchange~~CalledByGraph proc~ints_exchange ints_exchange none~run_generic int2_compute_t%run_generic none~run_generic->proc~ints_exchange none~set_screening~2 int2_compute_t%set_screening none~set_screening~2->proc~ints_exchange proc~grd2_driver grd2_driver proc~grd2_driver->proc~ints_exchange none~run_cam int2_compute_t%run_cam none~run_cam->none~run_generic none~run~6 int2_compute_t%run none~run~6->none~run_generic none~run~6->none~run_cam proc~fock_jk fock_jk proc~fock_jk->none~set_screening~2 proc~fock_jk->none~run~6 proc~hf_gradient hf_gradient proc~hf_gradient->proc~grd2_driver proc~oqp_tdhf_z_vector oqp_tdhf_z_vector proc~oqp_tdhf_z_vector->none~set_screening~2 proc~oqp_tdhf_z_vector->none~run~6 proc~scf_driver scf_driver proc~scf_driver->none~set_screening~2 proc~scf_driver->none~run~6 proc~tdhf_2e_grad tdhf_2e_grad proc~tdhf_2e_grad->proc~grd2_driver proc~tdhf_energy tdhf_energy proc~tdhf_energy->none~set_screening~2 proc~tdhf_energy->none~run~6 proc~tdhf_mrsf_energy tdhf_mrsf_energy proc~tdhf_mrsf_energy->none~set_screening~2 proc~tdhf_mrsf_energy->none~run~6 proc~tdhf_sf_energy tdhf_sf_energy proc~tdhf_sf_energy->none~set_screening~2 proc~tdhf_sf_energy->none~run~6 proc~hf_energy hf_energy proc~hf_energy->proc~scf_driver proc~tdhf_energy_c tdhf_energy_C proc~tdhf_energy_c->proc~tdhf_energy proc~tdhf_gradient tdhf_gradient proc~tdhf_gradient->proc~tdhf_2e_grad proc~tdhf_mrsf_energy_c tdhf_mrsf_energy_C proc~tdhf_mrsf_energy_c->proc~tdhf_mrsf_energy proc~tdhf_sf_energy_c tdhf_sf_energy_C proc~tdhf_sf_energy_c->proc~tdhf_sf_energy proc~tdhf_z_vector_c tdhf_z_vector_C proc~tdhf_z_vector_c->proc~oqp_tdhf_z_vector proc~tdhf_gradient_c tdhf_gradient_C proc~tdhf_gradient_c->proc~tdhf_gradient

Source Code

  subroutine ints_exchange(basis, schwarz_ints, mu2)
    use int2e_rotaxis, only: genr22
    use int2e_libint, only: libint2_init_eri, libint2_cleanup_eri
    use int2e_libint, only: libint_compute_eri, libint_print_eri
    use int2e_libint, only: libint_t, libint2_active
    use int2e_rys, only: int2_rys_compute
    use types, only: information
    use constants, only: NUM_CART_BF
    use, intrinsic :: iso_c_binding, only: C_NULL_PTR, C_INT,  c_f_pointer

    implicit none

    type(basis_set), intent(in) :: basis
    real(kind=dp), intent(inout) :: schwarz_ints(:,:)
    real(kind=dp), optional, intent(in) :: mu2

    real(kind=dp), parameter :: &
      ic_exchng  = 1.0d-15, &
      ei1_exchng = 1.0d-17, &
      ei2_exchng = 1.0d-17, &
      cux_exchng = 50.0

    integer :: flips(4)
    integer :: shell_ids(4)
    integer :: nbf(4)
    integer :: lmax
    integer :: ish, jsh
    integer :: i, j, jmax
    integer :: am(4), max_am
    integer :: ok
    logical :: rotspd, libint, zero_shq, rys
    logical :: attenuated
    real(kind=dp) :: vmax
    real(kind=dp), allocatable, target :: ints(:)
    real(kind=dp), pointer :: pints(:,:,:,:)
    type(libint_t), allocatable :: erieval(:)
    type(int2_rys_data_t) :: gdat
    type(int2_cutoffs_t) :: cutoffs
    type(int2_pair_storage) :: ppairs

    attenuated = present(mu2)

    lmax = maxval(basis%am)
    if (lmax < 0 .or. lmax > 6) call show_message("Basis set agular momentum exceeds max. supported", WITH_ABORT)

!   Set very tight cutoff
    call cutoffs%set(ic_exchng, ei1_exchng, ei2_exchng, cux_exchng)

    if (libint2_active) then
        allocate(erieval(basis%mxcontr**4))
        call libint2_init_eri(erieval, int(4, C_INT), C_NULL_PTR)
    end if
    allocate(ints(NUM_CART_BF(lmax)**4), source=0.0d0)
    call gdat%init(lmax, cutoffs, ok)

    call ppairs%alloc(basis, cutoffs)
    call ppairs%compute(basis, cutoffs)

    do ish = 1, basis%nshell
      do jsh = 1, ish
        shell_ids = [ish, jsh, ish, jsh]

        am = basis%am(shell_ids)
        max_am = maxval(am)

        rotspd = max_am <= 2
        libint = .not.rotspd.and.libint2_active.and..not.attenuated
        rys = .not.rotspd.and..not.libint
        if (rotspd) then
          if (attenuated) then
            call genr22(basis, ppairs, ints, shell_ids, flips, cutoffs, mu2)
          else
            call genr22(basis, ppairs, ints, shell_ids, flips, cutoffs)
          end if
          nbf = am(flips)
          nbf = (nbf+1)*(nbf+2)/2
          vmax = maxval(abs(ints(1:product(nbf))))
        else if (libint) then
          nbf = am(flips)
          call libint_compute_eri(basis, ppairs, cutoffs, shell_ids, 0, erieval, flips, zero_shq)
          call c_f_pointer(erieval(1)%targets(1), pints, shape=nbf([4,3,2,1]))
          vmax = maxval(abs(pints))
        else if (rys) then
          call gdat%set_ids(basis, shell_ids)
          if (attenuated) then
            call int2_rys_compute(ints, gdat, ppairs, zero_shq, mu2)
          else
            call int2_rys_compute(ints, gdat, ppairs, zero_shq)
          end if
          nbf = gdat%nbf
          pints(1:nbf(4), 1:nbf(3), 1:nbf(2), 1:nbf(1)) => ints
          call normalize_ints(nbf, gdat%am, pints)
          vmax = maxval(abs(pints))
        end if
        schwarz_ints(ish, jsh) = sqrt(vmax)
        schwarz_ints(jsh, ish) = sqrt(vmax)
      end do
    end do

    if (libint2_active) then
        call libint2_cleanup_eri(erieval)
        deallocate(erieval)
    end if
    call gdat%clean()
  end subroutine ints_exchange