
      SUBROUTINE xsgabs(ear, ne, param, ifl, photar, photer)

      IMPLICIT NONE

      INTEGER ne, ifl
      REAL ear(0:ne), param(3), photar(ne), photer(ne)

C---
C XSPEC model subroutine
C Gaussian absorption line
C---
C see ADDMOD for parameter descriptions
C number of model parameters:3
C       1       EL      line energy (in energy units, e.g. keV)
C       2       W	line width (sigma) (in energy units)
C       3       Tau     line optical depth
C intrinsic energy range: none
C algorithm:
C       M(E) = exp(-(tau/sqrt(2*PI)/W) * exp(-0.5*((E-EL)/W)**2)))
C       If W is less than or equal to zero, the line is treated as a delta
C            function.
C       N.B. when the energy spacing is much greater than W and the stepsize
C            for EL then the partial derivative determinations can lead
C            to fit error conditions.  The solution is to increase the
C            stepsize for EL
C---

      REAL PI
      PARAMETER (PI=3.14159265)

      REAL dele
      INTEGER i

C Call the additive Gaussian model routine with the first two parameters

      CALL xsgaul(ear, ne, param, ifl, photar, photer)

C Correct to the average value of the gaussian for the energy bin, Multiply by 
c the optical depth and take the exponential 

      DO i = 1, ne
         dele = ear(i) - ear(i-1)
         IF ( dele .NE. 0 ) photar(i) = photar(i) / dele
         photar(i) = -param(3) * photar(i)
         photar(i) = exp(photar(i))
      ENDDO

      RETURN
      END


