function is_allowed_ueg_k_vector(orbi, orbj, orba) result(is_allowed)
integer, intent(in) :: orbi, orbj, orba
logical :: is_allowed
integer :: ki(3), kj(3), ka(3), kb(3)
real(dp) :: testE
ki = G1(orbi)%k
kj = G1(orbj)%k
! Obtain the new momentum vectors
ka = G1(orba)%k
kb = ki + kj - ka
! Is kb allowed by the size of the space?
testE = sum(kb**2)
if (abs(kb(1)) <= nmaxx .and. abs(kb(2)) <= nmaxy .and. &
abs(kb(3)) <= nmaxz .and. &
(.not. (tOrbECutoff .and. (testE > OrbECutoff)))) then
is_allowed = .true.
else
is_allowed = .false.
end if
end function is_allowed_ueg_k_vector