subroutine ps_Potential_Get(ps,i,&
l,j,n,rc,set,flavor,eref,annotation,func)
type(ps_t), intent(in), target :: ps
integer, intent(in) :: i
integer, intent(out), optional :: set
integer, intent(out), optional :: l
real(dp), intent(out), optional :: j
integer, intent(out), optional :: n
real(dp), intent(out), optional :: rc
real(dp), intent(out), optional :: eref
character(len=*), intent(out), optional :: flavor
type(ps_annotation_t), intent(out), optional :: annotation
type(ps_radfunc_t), intent(out), optional :: func
type(sl_table_t), pointer :: q(:)
q => ps%sl_table
call check_index(i,size(q),"SL pot")
if (present(set)) then
set = q(i)%p%set
endif
if (present(l)) then
l = l_of_sym(q(i)%p%l,"SL pot")
endif
if (present(n)) then
n = q(i)%p%n
endif
if (present(j)) then
if (q(i)%p%j < 0.0) then
j = -1.0_dp
! Maybe optional status flag raised?
else
j = q(i)%p%j
endif
endif
if (present(rc)) then
rc = q(i)%p%rc
endif
if (present(eref)) then
! Will return a very large positive value if the attribute eref is not
! present in the file
eref = q(i)%p%eref
endif
if (present(flavor)) then
flavor = q(i)%p%flavor
endif
if (present(annotation)) then
annotation = q(i)%p%parent_group%annotation
endif
if (present(func)) then
func = q(i)%p%V
endif
end subroutine ps_Potential_Get