subroutine beam_info_num(suffix,indep,insjdotb,insnccw)

  ! this routine does not depend on nbi_com -- just xplasma.  so, it can be
  ! called safely by a client code, when the nubeam calculation is performed
  ! as a remote service.
  use nbi_com, only: nonlin
  use xplasma_obj_instance
  implicit none
  !-------------------------------------
  ! passed:

  character*(*), intent(in) :: suffix   ! ' '

  integer, intent(out) :: indep         ! number beams
  !  (0,0) are returned if no deposition data is found.
  integer, intent(out) :: insjdotb,insnccw
  !-------------------------------------
  ! local:

  integer, dimension(:), pointer :: idata
  integer :: id,ierr
  character*32 zobj_name
  integer :: ihdr,iadr,ii
  !-------------------------------------

  indep = 0

  zobj_name = 'beam_info' ! name of xplasma black box
  ! containing beam_info data, if any exists

  call xplasma_blkbxid(s,zobj_name,id)

  if(id.eq.0) return

  !-------------------------
  ! data does exist

  call xplasma_blackbox_retrieve(s,id,ierr, ia_ptr=idata)
  if(ierr.ne.0) then
     write(nonlin,*) ' ?beam_info_num: unexpected error, blackbox "', &
          trim(zobj_name),'":'
     call xplasma_error(s,ierr,nonlin)
     return
  endif
  ihdr = idata(1)
  indep = idata(2)
  insjdotb = idata(9)
  insnccw = idata(10)

  nullify(idata)

end subroutine beam_info_num
