subroutine set_dep_ib_ien(ib,ien,nl_beam_set)

  ! this routine is called if ndep_beam_use > 0 & track gathering is active.
  ! return nl_beam_set according as selected beam and energy fraction
  ! are elible for track data collection, or not

  use nbi_com
  use dep_track_counter
  implicit none
  integer, intent(in) :: ib,ien       ! ib - beam source #
                                      ! ien - energy fraction
                                      
  logical, intent(out):: nl_beam_set  !.true. if user's request successful
                                      ! beam source #=ndep_beam_use
                                      ! and ndep_ien_use, if set, is matched.

  if(ib.eq.ndep_beam_use) then
     nl_beam_set=.true. 
     if(ndep_ien_use.ne.0.and.ndep_ien_use.ne.ien) then
        nl_beam_set=.false.
     endif
  else
     nl_beam_set=.false. 
  endif

  end subroutine set_dep_ib_ien
      
 
 
