!
!  return preact handle for selected impact ionization or
!  neutralizing charge exchange reaction
!
subroutine hatom_handle(irtype,izneut,izchrg,ihandle)
 
  use hatom_mod
  implicit NONE
 
  integer, parameter :: CX=1, II=2
 
  integer, parameter :: H=1, HE=2, LI=3
 
  integer, intent(in) :: irtype   ! reaction type: =cx or =ii
  integer, intent(in)  :: izneut  ! Z of neutral species
  integer, intent(in)  :: izchrg  ! Z of ion species
 
  integer, intent(out) :: ihandle ! preact handle of selected reaction
 
  !  ihandle = 0 returned if reaction is not known...
  !------------------------------------------------------
  !  initialize module, if necessary
 
  if(hatom_flag.eq.0) call hatom_init
 
  !--------------------------------------------
 
  ihandle = 0
 
  if(irtype.eq.CX) then
 
     !  ---------> (neutralizing) charge exchange
 
     if(izneut.eq.H) then
        if(izchrg.eq.H) then
           ihandle = Lcx_H0_H
        endif
 
     else if(izneut.eq.HE) then
        if(izchrg.eq.H) then
           ihandle = Lcx_HE0_H
        else if(izchrg.eq.HE) then
           ihandle = Lcx_HE0_HE
        endif
 
     else if(izneut.eq.LI) then
        if(izchrg.eq.H) then
           ihandle = Lcx_LI0_H
        else if(izchrg.eq.HE) then
           ihandle = Lcx_LI0_HE
        else if(izchrg.eq.LI) then
           ihandle = Lcx_LI0_LI
        endif
 
     endif
 
  else if(irtype.eq.II) then
 
     !  ---------> impact ionization
     !      or, sum of impact ionization and partial charge exchange
 
     if(izneut.eq.H) then
        if(izchrg.eq.H) then
           ihandle = Lii_H0_H
        else if(izchrg.eq.HE) then
           ihandle = Lii_H0_HE
        else if(izchrg.eq.LI) then
           ihandle = Lii_H0_LI
        endif
 
     else if(izneut.eq.HE) then
        if(izchrg.eq.H) then
           ihandle = Lii_HE0_H
        else if(izchrg.eq.HE) then
           ihandle = Lii_HE0_HE
        else if(izchrg.eq.LI) then
           ihandle = Lii_HE0_LI
        endif
 
     else if(izneut.eq.LI) then
        if(izchrg.eq.H) then
           ihandle = Lii_LI0_H
        else if(izchrg.eq.HE) then
           ihandle = Lii_LI0_HE
        else if(izchrg.eq.LI) then
           ihandle = Lii_LI0_LI
        endif
 
     endif
 
  endif
 
end subroutine hatom_handle
