subroutine nbi_bsource_alloc(needs,mibs_use)
  use iso_c_binding, only: fp => c_double
  use nbi_bscom
  implicit none
  integer,intent(in) :: needs ! # of point needed
  integer,intent(in) :: mibs_use ! # of point needed for a second dimension
  logical :: nl_bsource
   nl_bsource=allocated(bs_r)
  if(.not.nl_bsource.and.(mibs_use.ge.1))then
     call nbi_bs_alloc(needs,mibs_use)
  elseif(nl_bsource.and.(mibs_use.gt.1).and.(size(bs_r,dim=1).lt.needs)) then
! need to be extended
     call nbi_bs_expand(needs,mibs_use)
  endif
end subroutine nbi_bsource_alloc
