Fit Function: NEEXH2

Fit Function \[\begin{align*} \sigma = 5.984e-16 \; \frac{ucont \; cstr} {pe} \\ ucont = \left(1- \frac{1}{x} \right)^{pcf(7)}; \; \; x = \frac{pe}{pcf(1)} \\ cstr = \begin{cases} pcf(2) + \frac{pcf(3)}{x} + \frac{pcf(4)}{x^2} + \frac{pcf(5)}{x^3} & \text{if} \; pcf(6) = 0 \\ pcf(6) \; \ln(x) + pcf(2) + \frac{pcf(3)}{x} + \frac{pcf(4)}{x^2} + \frac{pcf(5)}{x^3} & \text{if} \; pcf(6) \ne 0 \\ \end{cases} \end{align*}\]
Comments

Fortran

Arguments
namedescriptionunitstype(s)
pe energy eV real, dimension(:)
pcf coefficient data array real, dimension(7)
kncf number of coefficients in the data array integer
pfit cross section cm2 real, dimension(:)
kermsg error message character
Return values
namedescriptionunitstype(s)
sigma cross section cm2 real, dimension(:)
Code
c
c##############################################################################
c
      subroutine neexh2(pe, pcf, kncf, pxs, kermsg)
c
c     this is a subroutine to calculate cross sections (cm[2])
c     versus energy (ev) for electron impact excitation.
c
c     pe = collision energy in ev
c
c     pcf(1) = threshold energy (ev), eth.
c     pcf(2-7) = parameters for fit to the cross section
c
c     kermsg = blank if no errors
c
c     pxs = cross section in cm[2]
c
c------------------------------------------------------------------------
c
      double precision pe, pcf, pxs
      double precision cstr, ryd, ksq, x, alog, u , ucont, eth
c
      dimension pcf(7)
      character*(*) kermsg
c
      data ryd/13.6d0/
c
      eth = pcf(1)
      if(pe .ge. eth) then
        kermsg = ' '
      else
        pxs = 0.0d0
        return
      endif
c
        ksq= pe/ryd
        etrans = eth/ryd
        x=ksq/etrans
        xsq = x*x
        xsq2 = xsq*xsq
        alog = 0.0d0
c
        if (pcf(6) .ne. zero) alog = pcf(6) * dlog (x)
        cstr = alog + pcf(2) + pcf(3)/x + pcf(4)/xsq + pcf(5)/(x*xsq)
c
        u = (pe - eth) / eth
        ucont = ( u / (u + 1.0d0)) ** pcf(7)
        pxs =   5.984e-16 *  ucont * cstr / pe
c
      return
      end

Python

Arguments
namedescriptionunitstype(s)
pe energy eV float, np.ndarray
pcf coefficient data array float, np.ndarray
kncf number of coefficients in the data array int
pfit cross section cm2 float, np.ndarray
kermsg error message str
Return values
namedescriptionunitstype(s)
pfit cross section cm2 float, np.ndarray
Code