#include "fpreproc/f77_dcomplx.h"
!------------------------------------------------------------------------------
!
!  SIGPREP_Z -- SET ARGUMENTS FOR HARRY'S SIGMA ROUTINE FROM SIGTAB
!               REACTION NUMBER
!
SUBROUTINE SIGPREP_Z(IREACT)
!
  use iso_c_binding, only: fp => c_double
  use sigtabl_mod
  IMPLICIT NONE
!
!  Modified:
!  10/09/94 tbt Lithium Ireact=17-21.
!
!  ARGUMENT IREACT LABELS REACTION AS IN SUBROUTINE NAMREACT
!  IN SIGTAB SUBROUTINE LIBRARY; HERE THIS IS CONVERTED TO THE
!  CONVENTION USED IN HARRY TOWNER'S FUSION CROSS SECTION ROUTINES
!
!============
! idecl:  explicitize implicit INTEGER declarations:
  INTEGER ireact
!============
  IF(IREACT.EQ.1) THEN
     KREACT=-1                      ! H0,H+ cx
     KK=-1
  ELSE IF(IREACT.EQ.2) THEN
     KREACT=-2                      ! H0,H+ ii
     KK=-1
  ELSE IF(IREACT.EQ.3) THEN
     KREACT=4                       ! DD(n,He3) fusion
     KK=0
     CALL RMASS_Z(KREACT,KK,AMASS1,AMASS2,AMASS3,AMASS4)
  ELSE IF(IREACT.EQ.4) THEN
     KREACT=3                       ! DD(p,T) fusion
     KK=0
     CALL RMASS_Z(KREACT,KK,AMASS1,AMASS2,AMASS3,AMASS4)
  ELSE IF(IREACT.EQ.5) THEN
     KREACT=1                       ! DT fusion (D beam, T target)
     KK=0
     CALL RMASS_Z(KREACT,KK,AMASS1,AMASS2,AMASS3,AMASS4)
  ELSE IF(IREACT.EQ.6) THEN
     KREACT=1                       ! DT fusion (T beam, D target)
     KK=1
     CALL RMASS_Z(KREACT,KK,AMASS1,AMASS2,AMASS3,AMASS4)
  ELSE IF(IREACT.EQ.7) THEN
     KREACT=2                       ! DHe3 fusion (D beam, He3 target)
     KK=0
     CALL RMASS_Z(KREACT,KK,AMASS1,AMASS2,AMASS3,AMASS4)
  ELSE IF(IREACT.EQ.8) THEN
     KREACT=2                       ! DHe3 fusion (He3 beam, D target)
     KK=1
     CALL RMASS_Z(KREACT,KK,AMASS1,AMASS2,AMASS3,AMASS4)
  ELSE IF(IREACT.EQ.9) THEN
     KREACT=5                       ! TT(2n,He4) fusion
     KK=0
     CALL RMASS_Z(KREACT,KK,AMASS1,AMASS2,AMASS3,AMASS4)
  ELSE IF(IREACT.EQ.25) THEN
     KREACT=12                       ! TT(2n,He4) fusion DPC fit 06/2018
     KK=0
     CALL RMASS_Z(KREACT,KK,AMASS1,AMASS2,AMASS3,AMASS4)
  ELSE IF(IREACT.EQ.10) THEN
     KREACT=6                       ! THe3 fusion (T beam, He3 target)
     KK=1
     CALL RMASS_Z(KREACT,KK,AMASS1,AMASS2,AMASS3,AMASS4)
  ELSE IF(IREACT.EQ.11) THEN
     KREACT=6                       ! THe3 fusion (He3 beam, T target)
     KK=0
     CALL RMASS_Z(KREACT,KK,AMASS1,AMASS2,AMASS3,AMASS4)
  ELSE IF(IREACT.EQ.12) THEN
     KREACT=-3                      ! H+,He0 cx
     KK=-1
  ELSE IF(IREACT.EQ.13) THEN
     KREACT=-4                      ! H+,He0 ii
     KK=-1
  ELSE IF(IREACT.EQ.14) THEN
     KREACT=-5                      ! He++,H0 ii
     KK=-1
  ELSE IF(IREACT.EQ.15) THEN
     KREACT=-6                      ! He++,He0 cx
     KK=-1
  ELSE IF(IREACT.EQ.16) THEN
     KREACT=-7                      ! He++,He0 ii
     KK=-1
  ELSE IF(IREACT.EQ.17) THEN
     KREACT=-8                      ! H+,Li0 cx (fake cross section!)
     KK=-1
  ELSE IF(IREACT.EQ.18) THEN
     KREACT=-9                      ! H+,Li0 ii (fake cross section!)
     KK=-1
  ELSE IF(IREACT.EQ.19) THEN
     KREACT=-10                     ! He++,Li0 cx (fake cross section!)
     KK=-1
  ELSE IF(IREACT.EQ.20) THEN
     KREACT=-11                     ! He++,Li0 ii (fake cross section!)
     KK=-1
  ELSE IF(IREACT.EQ.21) THEN
     KREACT=-12                     ! Li+++,H0 ii (fake cross section!)
     KK=-1
  ELSE IF(IREACT.EQ.22) THEN
     KREACT=-13                     ! Li+++,He0 ii (fake cross section!)
     KK=-1
  ELSE IF(IREACT.EQ.23) THEN
     KREACT=-14                     ! Li+++,Li0 cx (fake cross section!)
     KK=-1
  ELSE IF(IREACT.EQ.24) THEN
     KREACT=-15                     ! Li+++,Li0 ii (fake cross section!)
     KK=-1
  ELSE
     !  DIE!
     call errmsg_exit('?sigprep_z: invalid IREACT argument value!')
  ENDIF
!
  RETURN
END SUBROUTINE SIGPREP_Z
!
!------------------------------------------------------------------------------
! 30Jun2000 fgtok -s r8_precision.sub "r8con.csh conversion"
! 30Jun2000 fgtok
