!------------------------------------------------------------------------------
!
!  DOSIG3_Z -- EVALUATE A CROSS SECTION FROM ALADDIN DATA -- SUM OF 3
!
real(fp) FUNCTION DOSIG3_Z(ZEREL,INDXR,ZLBL1,ZLBL2,ZLBL3)
!
!============
! idecl:  explicitize implicit INTEGER declarations:
  use iso_c_binding, only: fp => c_double
  use physconst_mod, only : zero
  use sigtabl_mod   
  use alpcom_mod
  use alcom_mod
  IMPLICIT NONE
  INTEGER isigind_z,ix,i,ier
!============
! idecl:  explicitize implicit REAL declarations:
  real(fp) zerel,zsum,zsigma,dosigx_z
!============
  INTEGER INDXR(3)
  CHARACTER*(*) ZLBL1
  CHARACTER*(*) ZLBL2
  CHARACTER*(*) ZLBL3
!
!  INPUT ZEREL = REL. ENERGY AT WHICH TO EVALUATE CROSS SECTION
!        INDXR = REACTION INDICES (IF ALREADY KNOWN) OR ZERO
!        ZLBL1,ZLBL2,ZLBL3 = REACTION LABELS (USED IF INDEX NOT KNOWN)
!
!  OUTPUT INDXR = NONZERO REACTION INDICES (IF INDXR=0 ON INPUT)
!         DOSIG3 = CROSS SECTION (INTERPOLATED OR EXTRAPOLATED FROM
!                 ALADDIN DATA)
!
!------------------------------------------------------------------------------
!
  IF(INDXR(1).EQ.0) THEN
     INDXR(1)=ISIGIND_Z(ZLBL1)
     INDXR(2)=ISIGIND_Z(ZLBL2)
     INDXR(3)=ISIGIND_Z(ZLBL3)
  ENDIF
!
  ZSUM = zero
!
  DO IX=1,3
     IF((ALEMIN(INDXR(IX)).LE.ZEREL).AND.&
          (ZEREL.LE.ALEMAX(INDXR(IX)))) THEN
!
!  IN RANGE -- USE FIT
        NCF=NALPCF(INDXR(IX))
        CF(1:ncf)=ALPCF(1:ncf,INDXR(IX))
        CALL ALAD_EVAL_Z(ZEREL,ZSIGMA,1,IER)
     ELSE
!
!  OUT OF RANGE -- USE EXTRAPOLATION
        ZSIGMA=DOSIGX_Z(ZEREL,INDXR(IX))
     ENDIF
!
     ZSUM=ZSUM+ZSIGMA
  enddo
  DOSIG3_Z=ZSUM
  RETURN
END FUNCTION DOSIG3_Z
!
!------------------------------------------------------------------------------
! 30Jun2000 fgtok -s r8_precision.sub "r8con.csh conversion"
