! written by nbigen.py
! *** do not edit *** (use nbigen.py instead)
 
subroutine nbi_alloc_track
 
  use nbi_com
  use logmod
  implicit NONE
 
  logical :: ia
 
  !==============================================
  ! internal arrays
 
  if(mibs_use.le.0) then
     call warnLog(' nbi_alloc_track: mibs_use.le.0')
     call nbi_dalloc_track
     return
  endif
 
  ia=.TRUE.
  if(allocated(TRACK_nbsce)) then
     if(size(TRACK_nbsce,1).eq.mdep0) then
        if(size(TRACK_nbsce,2).eq.mibs_use) then
           ia=.FALSE.
        endif
     endif
  endif
 
  if(ia) call nbi_dalloc_track
 
  ! arrays are set to zero regardless of (ia) setting.
 
  if(ia) allocate(TRACK_nbsce(mdep0,mibs_use)); TRACK_nbsce = zero
  if(ia) allocate(TRACK_nbien(mdep0,mibs_use)); TRACK_nbien = zero
  if(ia) allocate(XNTRACK(mdep0,mibs_use)); XNTRACK = zero
  if(ia) allocate(TRACK_RIN(mdep0,mibs_use)); TRACK_RIN = zero
  if(ia) allocate(TRACK_ZIN(mdep0,mibs_use)); TRACK_ZIN = zero
  if(ia) allocate(TRACK_PHIIN(mdep0,mibs_use)); TRACK_PHIIN = zero
  if(ia) allocate(TRACK_ROUT(mdep0,mibs_use)); TRACK_ROUT = zero
  if(ia) allocate(TRACK_ZOUT(mdep0,mibs_use)); TRACK_ZOUT = zero
  if(ia) allocate(TRACK_PHIOUT(mdep0,mibs_use)); TRACK_PHIOUT = zero
  if(ia) allocate(TRACK_TIME(mdep0,mibs_use)); TRACK_TIME = zero
  if(ia) allocate(TRACK_EINJ(mdep0,mibs_use)); TRACK_EINJ = zero
  if(ia) allocate(TRACK_SINJ(mdep0,mibs_use)); TRACK_SINJ = zero
 
  write(nonlin,*)'% nbi_alloc_track: nbi_alloc_track done'
end subroutine nbi_alloc_track
