function calc_pgen_ueg(ilutI, ex, ic) result(pgen)
! i also have to write a pgen recalculator for the pgens with this
! new UEG excitation generator.. i am a bit confused why this has
! not been done yet i have to admit..
! and i need this function if i want to use it with HPHF..
integer, intent(in) :: ex(2, 2), ic
integer(n_int), intent(in) :: ilutI(0:niftot)
real(dp) :: pgen
real(dp) :: p_elec, p_orb, cum_arr(nBasis), cum_sum
integer :: src(2), orb_a, tgt(2)
if (ic /= 2) then
pgen = 0.0_dp
return
end if
src = get_src(ex)
tgt = get_tgt(ex)
! i should return 0 if b < a.. since those excitations
! are never created.. but are the actually called ever? hm..
! the question is how does the ex() determination work actually?
! is it ever possible in the HPHF case eg. that b > a when
! comparing two dets? hm.. check!
! if (tgt(1) > tgt(2)) then
! pgen = 0.0_dp
! return
! end if
! now the real part..
p_elec = 1.0_dp / real(ElecPairs, dp)
orb_a = tgt(1)
! i need to recalct the cum_arr
call create_ab_list_ueg(ilutI, src, cum_arr, cum_sum)
if (cum_sum < EPS) then
pgen = 0.0_dp
return
end if
! and now i have to check orba probability
if (orb_a == 1) then
p_orb = cum_arr(1) / cum_sum
else
p_orb = (cum_arr(orb_a) - cum_arr(orb_a - 1)) / cum_sum
end if
pgen = p_orb * p_elec
end function calc_pgen_ueg