
      subroutine mkfield(gcmin,imax,kmax,jmax,nfields,ixp,gcmout)
      include 'tracsat.h'
c
c Make field ixp using history fields in gcmin
c Return calculated field in gcmout
c
      parameter(pi=3.14159)
      dimension gcmin(imax,kmax,jmax,nfields),gcmout(imax,kmax,jmax)
c
      ncalls = ncalls+1
      if (ixp.eq.ixui.or.ixp.eq.ixvi.or.ixp.eq.ixwi) then
        write(6,"('>>> mkfield: ion drifts not yet available <<<')")
        gcmout(:,:,:) = 0.
      elseif (ixp.eq.ixver) then
        write(6,"('>>> mkfield: ver6300 not yet available')")
        gcmout(:,:,:) = 0.
c
c 5/24/94: Added *1.e-7 to Wise ver15m and ver53m equations as per
c   email from John received May 18, 1994.
c
      elseif (ixp.eq.ixver15m) then
        gcmout(:,:,:) = ((5.94e-26 * sqrt(gcmin(:,:,:,ifget(ixt))) *
     +    exp(-960./ gcmin(:,:,:,ifget(ixt))) *
     +    gcmin(:,:,:,ifget(ixo1)) * gcmin(:,:,:,ifget(ixco2))) /
     +    (4.*pi * (1.28 + 3.5e-13 * sqrt(gcmin(:,:,:,ifget(ixt))) *
     +    gcmin(:,:,:,ifget(ixo1))))) * 1.e-7
      elseif (ixp.eq.ixver53m) then
        gcmout(:,:,:) = ((2.63e-22*exp(-2715./gcmin(:,:,:,ifget(ixt))) *
     +    gcmin(:,:,:,ifget(ixo1)) * gcmin(:,:,:,ifget(ixno))) /
     +    (4.*pi * (10.78 + 6.5e-11 * gcmin(:,:,:,ifget(ixo1)))))*1.e-7 
      else
        write(6,"('>>> mkfield: unknown ixp=',i3)") ixp
        gcmout(:,:,:) = 0.
      endif
      return
      end
