function create_heisenberg_fock_space_guga(n_orbs) result(heisenberg_fock)
integer, intent(in) :: n_orbs
integer(n_int), allocatable :: heisenberg_fock(:,:)
integer :: i, n_up, n_down, j, s_tot
integer(n_int), allocatable :: hilbert_space(:,:), temp_fock(:,:)
allocate(temp_fock(0:0, 2**n_orbs), source = 0_n_int)
j = 1
do i = 0, n_orbs / 2
n_up = n_orbs - i
n_down = i
s_tot = n_up - n_down
hilbert_space = create_all_open_shell_dets(n_orbs, n_down, n_up)
hilbert_space = csf_purify(hilbert_space, s_tot, n_orbs)
temp_fock(:,j:j+size(hilbert_space,2)-1) = hilbert_space
j = j + size(hilbert_space, 2)
end do
allocate(heisenberg_fock(0:0,j-1), source = temp_fock(:,1:j-1))
end function create_heisenberg_fock_space_guga