C------------------------------------------------------------------------------
C
C  Peter Richter (prichter@princeton.edu)
C  Princeton Plasma Physics Laboratory
C  August 2000
C
C  testf77layer.for - Test driver for F77 layer atop PREACT module.
C
C------------------------------------------------------------------------------
C
      program testf77layer
C
      implicit none
      integer icd, ihcx, ihii, ihfs, icode_preact, cx_init, ii_init,
     > fs_init, n
      real*8 f(1), x(1), y(1), z(1), cx_sigma, cx_vrel, ii_sigma,
     >ii_vrel, fs_sigma, fs_vrel
C
      x(1) = 10
      y(1) = 10
      z(1) = 0
      n = 1
C
      write(*,*)'Initializing reactions...'
      icd = icode_preact('H->H(cx)')
      ihcx = cx_init(icd, 1, 2)
      icd = icode_preact('H->H(ii)')
      ihii = ii_init(icd, 1, 2)
      icd = icode_preact('D->D(n)')
      ihfs = fs_init(icd, 1, 2)
C
      write(*,*)'\n***** Charge exchange: H->H(cx) *****************\n'
      write(*,*)'sigma, at E=10 keV/A:                                ',
     >'   ',cx_sigma(ihcx, x(1)),' m^2'
      write(*,*)'vrel, at E=10 keV/A:                                 ',
     >'   ',cx_vrel(ihcx, x(1)),' m/s'
      call cx_coldtarget_sigmatimesv(ihcx, x, f, n)
      write(*,*)'sigma*v (cold target), at E=10 keV/A:                ',
     >'   ',f(1),' m^3/s'
      call cx_warmtarget_sigmatimesv(ihcx, x, y, f, n)
      write(*,*)'<sigma*v> (warm target), at E=10 keV/A, T=10 keV/A:  ',
     >'   ',f(1),' m^3/s'
      call cx_energyavg_peramu(ihcx, x, y, f, n)
      write(*,*)'<E/A> of target reagent, at E=10 keV/A, T=10 keV/A:  ',
     >'   ',f(1),' keV/A'
      call cx_average_vdotnorm(ihcx, x, y, f, n)
      write(*,*)'<Vb dot Vtarg / |Vb|*|Vth|>, at E=10 keV/A, T=10 keV/',
     >'A: ',f(1)
C
      write(*,*)'\n***** Ionization: H->H(ii) **********************\n'
      write(*,*)'sigma, at E=10 keV/A:                                ',
     >'   ',ii_sigma(ihii, x(1)),' m^2'
      write(*,*)'vrel, at E=10 keV/A:                                 ',
     >'   ',ii_vrel(ihii, x(1)),' m/s'
      call ii_coldtarget_sigmatimesv(ihii, x, f, n)
      write(*,*)'sigma*v (cold target), at E=10 keV/A:                ',
     >'   ',f(1),' m^3/s'
      call ii_warmtarget_sigmatimesv(ihii, x, y, f, n)
      write(*,*)'<sigma*v> (warm target), at E=10 keV/A, T=10 keV/A:  ',
     >'   ',f(1),' m^3/s'
C
      write(*,*)'\n***** Fusion: D->D(n) ***************************\n'
      write(*,*)'sigma, at E=10 keV/A:                                ',
     >'   ',fs_sigma(ihfs, x(1)),' m^2'
      write(*,*)'vrel, at E=10 keV/A:                                 ',
     >'   ',fs_vrel(ihfs, x(1)),' m/s'
      call fs_coldtarget_sigmatimesv(ihfs, x, f, n)
      write(*,*)'sigma*v (cold target), at E=10 keV/A:                ',
     >'   ',f(1),' m^3/s'
      call fs_warmtarget_sigmatimesv(ihfs, x, y, f, n)
      write(*,*)'<sigma*v> (warm target), at E=10 keV/A, T=10 keV/A:  ',
     >'   ',f(1),' m^3/s'
      call fs_thermonuclear_sigmatimesv(ihfs, x, f, n)
      write(*,*)'<<sigma*v>> thermonuclear, at T=10 keV/A:            ',
     >'   ',f(1),' m^3/s'
      call fs_gyroavg_sigmatimesv(ihfs, x, z, f, n)
      write(*,*)'<sigma*v> gyro average, at E=10 keV/A, no energy var:',
     >'   ',f(1),' m^3/s','\n'
C
      write(*,*)'Test driver terminated successfully.'
      end
C
C------------------------------------------------------------------------------
