subroutine ps_ValenceShell_Get(ps,i,n,l,occupation,occ_up,occ_down)
type(ps_t), intent(in) :: ps
integer, intent(in) :: i
integer, intent(out), optional :: n
integer, intent(out), optional :: l
real(dp), intent(out), optional :: occupation
real(dp), intent(out), optional :: occ_up
real(dp), intent(out), optional :: occ_down
call check_index(i,ps%config_val%nshells,"valence shell")
if (present(n)) then
n = ps%config_val%n(i)
endif
if (present(l)) then
l = l_of_sym(ps%config_val%l(i),"valence shell")
endif
if (present(occupation)) then
occupation = ps%config_val%occ(i)
endif
if (present(occ_up)) then
if (ps%header%polarized) then
occ_up = ps%config_val%occ_up(i)
else
call die("Cannot get per spin occupation")
endif
endif
if (present(occ_down)) then
if (ps%header%polarized) then
occ_down = ps%config_val%occ_down(i)
else
call die("Cannot get per spin occupation")
endif
endif
end subroutine ps_ValenceShell_Get