function calc_pgen_mixed_k_space_hub_transcorr(nI, ilutI, ex, ic) result(pgen)
integer, intent(in) :: nI(nel), ex(:, :), ic
integer(n_int), intent(in) :: ilutI(0:niftot)
real(dp) :: pgen
real(dp) :: p_elec, p_orb
if (ic == 2) then
pgen = pDoubles
if (same_spin(ex(1, 1), ex(1, 2))) then
pgen = pgen * pParallel
if (is_beta(ex(1, 1))) then
p_elec = 1.0_dp / real(nOccBeta * (nOccBeta - 1), dp)
p_orb = 2.0_dp / real(nbasis / 2 - nOccBeta, dp)
else
p_elec = 1.0_dp / real(nOccAlpha * (nOccAlpha - 1), dp)
p_orb = 2.0_dp / real(nbasis / 2 - nOccAlpha, dp)
end if
else
pgen = pgen * (1.0_dp - pParallel)
p_elec = 1.0_dp / real(nOccBeta * nOccAlpha, dp)
p_orb = 2.0_dp / real(nbasis - nel, dp)
end if
pgen = pgen * p_elec * p_orb
else
pgen = calc_pgen_k_space_hubbard_triples(nI, ilutI, ex, ic)
pgen = pgen * (1.0_dp - pDoubles) * 2.0_dp
end if
end function calc_pgen_mixed_k_space_hub_transcorr