function get_occ_neighbors(ilut, orb) result(occ_neighbors)
integer(n_int), intent(in) :: ilut(0:NIfTot)
integer, intent(in) :: orb
real(dp) :: occ_neighbors
#ifdef DEBUG_
character(*), parameter :: this_routine = "get_occ_neighbors"
#endif
integer, allocatable :: neighbors(:)
integer :: i
ASSERT(associated(lat))
! orb is given as a spatial orbital!
neighbors = lat%get_neighbors(orb)
occ_neighbors = 0.0_dp
do i = 1, size(neighbors)
! check both spinorbitals
if (IsOcc(ilut, 2 * neighbors(i))) occ_neighbors = occ_neighbors + 1.0_dp
if (IsOcc(ilut, 2 * neighbors(i) - 1)) occ_neighbors = occ_neighbors + 1.0_dp
end do
end function get_occ_neighbors