!------------------------------------------------------------------------------
!
!  SIGALAD1_Z -- READ A CROSS SECTION FIT FROM ALADDIN DATA FILE
!
SUBROUTINE SIGALAD1_Z(KSTR,IER_ALAD)
!============
! idecl:  explicitize implicit INTEGER declarations:
  use iso_c_binding, only: fp => c_double
  use sigtabl_mod   
  use alpcom_mod
  use alcom_mod
  IMPLICIT NONE
  INTEGER ier_alad,ier
!============
! idecl:  explicitize implicit REAL declarations:
 real(fp) ze,zep,zeav,zsigma,zsigmap,zsigav,zem,zsigmam
!============
 CHARACTER*(*) KSTR    ! REACTION LABEL
!
!  IER_ALAD = 0 ON OUTPUT IF COMPLETION IS SUCCESSFUL
!           OTHERWISE .NE. 0
!
!  USED TO LOAD COMMON FOR SIGTAB PROGRAM, SO THAT DESIRED FITS MAY BE
!  COMPUTED.
!
!------------------------------------------------------------------------------
!
 NUMALAD=NUMALAD+1
 IF(NUMALAD.GT.MAXALADR) THEN
    WRITE(6,'(//'' ?SIGALAD1_Z -- TOO MANY REACTIONS:  ''/)')
    ALADFLAG=.FALSE.
    return
 ENDIF
!
 ALADRLBL(NUMALAD)=KSTR
 CALL ALAD_FIND_Z(1,ALADRLBL(NUMALAD),' ',' ',IER_ALAD)
 IF(IER_ALAD.NE.0) THEN
    WRITE(6,'(//'' ?SIGALAD1_Z -- ERROR ON REACTION:  '',A/)')&
         ALADRLBL(NUMALAD)
    ALADFLAG=.FALSE.
    return
 ENDIF
!
 NALPCF(NUMALAD)=NCF
 ALPCF(1:ncf,NUMALAD)=CF(1:ncf)
 CALL ALAD_ELIM(ALEMIN(NUMALAD),ALEMAX(NUMALAD),IER_ALAD)
!  BE CONSERVATIVE...
 ALEMIN(NUMALAD)=1.000001_fp*ALEMIN(NUMALAD)
 ALEMAX(NUMALAD)=0.999999_fp*ALEMAX(NUMALAD)
!
 IF(IER_ALAD.NE.0) THEN
    WRITE(6,'(//'' ?SIGALAD1_Z -- ERROR ON REACTION:  '',A/)')&
         ALADRLBL(NUMALAD)
    ALADFLAG=.FALSE.
    return
 ENDIF
! 
 CALL ALAD_EVAL_Z(ALEMIN(NUMALAD),ALAMIN(NUMALAD),1,IER_ALAD)
 IF(IER_ALAD.NE.0) THEN
    WRITE(6,'(//'' ?SIGALAD1_Z -- ERROR ON REACTION:  '',A/)')&
         ALADRLBL(NUMALAD)
    ALADFLAG=.FALSE.
    return
 ENDIF
!
 CALL ALAD_EVAL_Z(ALEMAX(NUMALAD),ALAMAX(NUMALAD),1,IER_ALAD)
 IF(IER_ALAD.NE.0) THEN
    WRITE(6,'(//'' ?SIGALAD1_Z -- ERROR ON REACTION:  '',A/)')&
         ALADRLBL(NUMALAD)
    ALADFLAG=.FALSE.
    return
 ENDIF
!
 ZE=ALEMIN(NUMALAD)
 ZEP=1.0001_fp*ZE
 ZEAV=0.5_fp*(ZE+ZEP)
!
 ZSIGMA=ALAMIN(NUMALAD)
 CALL ALAD_EVAL_Z(ZEP,ZSIGMAP,1,IER)
 ZSIGAV=0.5_fp*(ZSIGMA+ZSIGMAP)
!
 ALSMIN(NUMALAD)=ZEAV*(ZSIGMAP-ZSIGMA)/&
      (ZSIGAV*(ZEP-ZE))
!
 ZE=ALEMAX(NUMALAD)
 ZEM=0.9999_fp*ZE
 ZEAV=0.5_fp*(ZE+ZEM)
!
 ZSIGMA=ALAMAX(NUMALAD)
 CALL ALAD_EVAL_Z(ZEM,ZSIGMAM,1,IER)
 ZSIGAV=0.5_fp*(ZSIGMA+ZSIGMAM)
!
 ALSMAX(NUMALAD)=ZEAV*(ZSIGMA-ZSIGMAM)/&
      (ZSIGAV*(ZE-ZEM))
!
 RETURN
END SUBROUTINE SIGALAD1_Z
!
!------------------------------------------------------------------------------
! 30Jun2000 fgtok -s r8_precision.sub "r8con.csh conversion"
 
 
 
 
 
 
 
 
 
 
 
 
