logical function is_in_ref(orb, part_type)
! write a function if a certain orbital is in the reference
! determinant of replica part_type
integer, intent(in) :: orb
integer, intent(in), optional :: part_type
integer :: temp_part_type
integer(n_int) :: temp_ilut(0:niftot)
if (present(part_type)) then
temp_part_type = part_type
else
temp_part_type = 1
end if
! there is an inefficient way to check projedet:
temp_ilut = ilutref(:, part_type_to_run(temp_part_type))
is_in_ref = (IsOcc(temp_ilut, orb))
end function is_in_ref