```       subroutine a8amax( ixtyp , ibpts , idiff ,
&                    s     , eij   , wi    , wj    ,
&                    bxc   , bpxc  , fxc1  ,
&                    fxc2  , fxc3  , xkc   ,
&                    ict   , xsa   , ysa   ,
&                    itout , toa   , goa   , apgoa , excra ,
&                    dexcra, gbarfa
&                   )
c-----------------------------------------------------------------------
c
c  ********************* fortran77 subroutine a8amax *******************
c
c  purpose: to perform Maxwellian averages of collision strengths for
c           adas interpolative fit to neutrals
c
c
c  input:
c            (i*4)  ixtyp    = type of transition (1=dipole,2=non-dipole
c                              non-spin change, 3=spin change, 4=null)
c            (i*4)  idiff    = difference switch (0=ratio, 1=diff)
c            (r*8)  s        = line strength for dipole case
c            (r*8)  eij      = transition energy (rydberg)
c            (r*8)  wi       = lower level statistical weight
c            (r*8)  wj       = upper level statistical weight
c            (r*8)  bxc      = threshold form parameter
c            (r*8)  bpxc     = matching parameter
c            (r*8)  fxc1     = threshold form parameter
c            (r*8)  fxc2     = asymptotic form parameter
c            (r*8)  fxc3     = asymptotic form parameter
c            (i*4)  ict      = length of xsa and ysa value set
c            (r*8)  xsa()    = independent (energy) coord. for spline
c            (r*8)  ysa()    = dependent (coll. str.) coord. for spline
c  output:
c            (i*4)  itout    = length of toa, goa value set
c            (r*8)  toa()    = output temperatures (K)
c            (r*8)  goa()    = output upsilons
c            (r*8)  apgoa()  = output approximate form upsilons
c            (r*8)  excra()  = output excitation rate coefficients
c            (r*8)  dexcra() = output de-excitation rate coefficients
c            (r*8)  gbarfa() = output gbar*f coefficients
c
c
c  routines:
c             egasym	adas	generates asyptotic spline conditions
c	      egspc	adas    generates spline coefficients
c             elnfit    adas    obtains linearly interpolated value
c             efasym    adas    obtains spline interpolated value
c             a8gamg    adas    calculates incomplete gamma function
c             eei       adas    exponential integral exp(x)*e1(x)
c             ee2       adas    exponential integral exp(x)*e2(x)
c
c  author:   Hugh Summers, University of Strathclyde ext.4196
c
c
c  version 1.1                             date:     25/06/99
c  modified: Hugh Summers
c		- first release
c
C  DATE:   07/07/2004			VERSION: 1.2
C  MODIFIED: ALLAN WHITEFORD
C		- CHANGED PARAMS108 TO PARAMS
C
c-----------------------------------------------------------------------
include  'PARAMS'
c------------------------------------------------------------------------
INTEGER             IBPTS,       ICT,         IDIFF,       ITOUT
INTEGER             IXTYP
REAL*8              APGOA(ISTDIM),            BPXC,        BXC
REAL*8              DEXCRA(ISTDIM),           EIJ
REAL*8              EXCRA(ISTDIM),            FXC1,        FXC2
REAL*8              FXC3,        GBARFA(ISTDIM)
REAL*8              GOA(ISTDIM), S,           TOA(ISTDIM), WI
REAL*8              WJ,          XKC,         XSA(ISTDIM)
REAL*8              YSA(ISTDIM)
```