get_helement_k_space_hub_general Function

public function get_helement_k_space_hub_general(nI, nJ, ic_ret) result(hel)

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: nI(nel)
integer, intent(in) :: nJ(nel)
integer, intent(inout), optional :: ic_ret

Return Value real(kind=dp)


Contents


Source Code

    function get_helement_k_space_hub_general(nI, nJ, ic_ret) result(hel)
        integer, intent(in) :: nI(nel), nJ(nel)
        integer, intent(inout), optional :: ic_ret
        HElement_t(dp) :: hel
        integer :: ic, ex(2, 3), ex_2(2, 2)
        logical :: tpar
        integer(n_int) :: ilutI(0:NIfTot), ilutJ(0:niftot)

        !todo: if 2-body-transcorrelation, we can have triple excitations now..
        ! fix that here.. (and also in a lot of other parts in the code..)
        if (present(ic_ret)) then
            if (ic_ret == 0) then
                hel = get_diag_helement_k_sp_hub(nI)

            else if (ic_ret == 2) then
                ex_2(1, 1) = 2

                call GetExcitation(nI, nJ, nel, ex_2, tpar)
                hel = get_offdiag_helement_k_sp_hub(nI, ex_2, tpar)

            else if (ic_ret == 3 .and. t_trans_corr_2body) then
                ex(1, 1) = 3
                call GetExcitation(nI, nJ, nel, ex, tpar)
                hel = get_3_body_helement_ks_hub(ex, tpar)

            else if (ic_ret == -1) then
                call EncodeBitDet(nI, ilutI)
                call EncodeBitDet(nJ, ilutJ)

                ic_ret = FindBitExcitLevel(ilutI, ilutJ)

                if (ic_ret == 0) then
                    hel = get_diag_helement_k_sp_hub(nI)

                else if (ic_ret == 2) then
                    ex_2(1, 1) = 2
                    call GetBitExcitation(ilutI, ilutJ, ex_2, tpar)
                    hel = get_offdiag_helement_k_sp_hub(nI, ex_2, tpar)

                else if (ic_ret == 3 .and. t_trans_corr_2body) then
                    ex(1, 1) = 3
                    call GetBitExcitation(ilutI, ilutJ, ex, tpar)

                    hel = get_3_body_helement_ks_hub(ex, tpar)

                else
                    hel = h_cast(0.0_dp)
                end if
            else
                hel = h_cast(0.0_dp)
            end if
        else
            call EncodeBitDet(nI, ilutI)
            call EncodeBitDet(nJ, ilutJ)

            ic = FindBitExcitLevel(ilutI, ilutJ)

            if (ic == 0) then
                hel = get_diag_helement_k_sp_hub(nI)
            else if (ic == 2) then
                ex_2(1, 1) = 2

                call GetBitExcitation(ilutI, ilutJ, ex_2, tpar)
                hel = get_offdiag_helement_k_sp_hub(nI, ex_2, tpar)

            else if (ic == 3 .and. t_trans_corr_2body) then
                ex(1, 1) = 3
                call GetBitExcitation(ilutI, ilutJ, ex, tpar)

                hel = get_3_body_helement_ks_hub(ex, tpar)

            else
                hel = h_cast(0.0_dp)
            end if
        end if

    end function get_helement_k_space_hub_general