### Fit Function: NEEXH1

 Fit Function \begin{align*} \sigma(pe) = \begin{cases} 10^{-16} \; \left[ pcf(3) + pcf(4) \; (pe - pcf(1))\right]& \text{if} \; pe \le pcf(2) \\ pcf(6) & \text{if} \; pe \gt pcf(2) \; \text{and } \; pe \lt pcf(5) \\ 5.984 \times 10^{-16} \; \frac{cstr} {pe} & \text{if} \; pe \gt pcf(5) \end{cases} \end{align*} Comments cstr = \begin{cases} pcf(7) + \frac{pcf(8)}{x} + \frac{pcf(9)}{x^2} + \frac{pcf(10)}{x^3} + \frac{pcf(11)}{x^4} & \text{if} \; pcf(12) = 0 \\ pcf(12) \; \ln(x) + pcf(7) + \frac{pcf(8)}{x} + \frac{pcf(9)}{x^2} + \frac{pcf(10)}{x^3} + \frac{pcf(11)}{x^4} & \text{if} \; pcf(12) \ne 0 \\ \end{cases}

#### Fortran

Arguments
namedescriptionunitstype(s)
pe energy eV real, dimension(:)
pcf coefficient data array real, dimension(12)
kncf number of coefficients in the data array integer
pfit cross section cm2 real, dimension(:)
kermsg error message character
Return values
namedescriptionunitstype(s)
pfit cross section cm2 real, dimension(:)
Code
c
c##############################################################################
c
subroutine neexh1(pe, pcf, kncf, pxs, kermsg)
c
c     this is a subroutine to calculate cross sections (cm)
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) = upper value of energy range over which the
c              cross section, sig, is approximated in a linear form
c                     sig = a + b*(e-eth)
c              where a,b and c are parameters and e is the incident
c              energy in ev
c              (lower end of the range is the threshold energy)
c
c     pcf(3) = parameter a
c     pcf(4) = parameter b
c     pcf(5) = upper value of energy range over which the cross section
c              is approximated by a constant value. (lower limit for
c              this range is pcf(2).
c     pcf(6) = constant value for second region.
c     pcf(7-12) = parameters for fit to the cross section in the third
c              region.
c
c     kermsg = blank if no errors
c
c     pxs = cross section in cm
c
c------------------------------------------------------------------------
c
double precision pe, pcf, pxs
double precision cstr, ryd, ksq, x, alog
c
dimension pcf(12)
character*(*) kermsg
c
data ryd/1.36d+01/
c
eth = pcf(1)
if(pe .ge. eth) then
kermsg = ' '
else
pxs = 0.0d0
return
endif
c
if (pe .le. pcf(2)) then
pxs =  1.0e-16 * (pcf(3) + (pcf(4) * (pe - eth)))
c
else if (pe .gt. pcf(2) .and. pe .le. pcf(5)) then
pxs =  pcf(6)
c
else
ksq= pe/ryd
etrans = eth/ryd
x=ksq/etrans
xsq = x*x
alog = 0.0d0
if (pcf(12) .ne. zero) alog = pcf(12) * dlog (x)
cstr = alog + pcf(7) + pcf(8)/x + pcf(9)/xsq + pcf(10)/(x*xsq)
&        + pcf(11)/(xsq*xsq)
pxs =   5.984d-16 * cstr / pe
c
endif
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