!******************** start file idelet.for ; group idelet ******************
!
!-----------------------------------------------------------------------
!
!
subroutine idelet(nbndex,jn,nuse,inpt)
  use iso_c_binding, only: fp => c_double
  !
  !  utility module to delete a particle from neutral beam
  !  calculation
  !
  !  input-- indexb(n) n dimension indexb array
  !          nuse     indexb(1) thru indexb(nuse) refer to particles
  !			     currently being followed
  !          npt      particle to be deleted
  !			(caller should assure  1 <= npt <= nuse)
  !
  !  output-- indexb modified to remove reference indexb(npt)
  !           nuse decremented
  !           npt decremented to point to ptcl just preceding ptcl
  !                deleted.
  !c
  !-------------------------
  !============
  implicit none
  integer :: inpt,jn,isav,j
  !============
  integer :: nbndex(jn),nuse
  !
  !  start of executable code
  !
  if(nuse.ne.inpt) then
     isav=nbndex(inpt)
     do j=inpt+1,nuse
        nbndex(j-1)=nbndex(j)
     end do
     nbndex(nuse)=isav
  endif
  nuse=nuse-1
  inpt=inpt-1
  return
end subroutine idelet
!******************** end file idelet.for ; group idelet ******************
