      subroutine wpunchp(tim,dt,ne,newg)
c
c    write intermediate results
c
      include 'itg.par'
c
      include 'post.cmn'
c
c
      if(newg.ne.1) then
      ld1=ld
      ldb1=ldb
      nmin1=nmin
      nmax1=nmax
      nd1=nd
      do 10 i=1,nd
      mmax1(i)=mmax(i)
      mmin1(i)=mmin(i)
      md1=md
   10 continue
      endif
c
      n2=nspecies
      write(7)ld1,ldb1,nmin1,nmax1,nd1,lin,ne,nspecies
      write(7)(mmin1(n),n=1,nd1)
      write(7)(mmax1(n),n=1,nd1)
      write(7)tim,shr,qsf,epsn,alpha,etai,rmu1,rmu2,rkap,vy,vz,
     &    rmime,etae
      write(7)dt0,dt,x0,y0,z0
      write(7)((((ws(l,m,n,i),l=1,ld),m=1,md1),n=1,nd1),i=1,n2)
      write(7)((((wc(l,m,n,i),l=1,ld),m=1,md1),n=1,nd1),i=1,n2)
      write(7)((((us(l,m,n,i),l=1,ld),m=1,md1),n=1,nd1),i=1,n2)
      write(7)((((uc(l,m,n,i),l=1,ld),m=1,md1),n=1,nd1),i=1,n2)
      write(7)((((prs(l,m,n,i),l=1,ld),m=1,md1),n=1,nd1),i=1,n2)
      write(7)((((prc(l,m,n,i),l=1,ld),m=1,md1),n=1,nd1),i=1,n2)
      write(7)((((vs(l,m,n,i),l=1,ld),m=1,md1),n=1,nd1),i=1,n2)
      write(7)((((vc(l,m,n,i),l=1,ld),m=1,md1),n=1,nd1),i=1,n2)
      write(7)((((tc(l,m,n,i),l=1,ld),m=1,md1),n=1,nd1),i=1,n2)
      write(7)((((ts(l,m,n,i),l=1,ld),m=1,md1),n=1,nd1),i=1,n2)
      write(7)((((qc(l,m,n,i),l=1,ld),m=1,md1),n=1,nd1),i=1,n2)
      write(7)((((qs(l,m,n,i),l=1,ld),m=1,md1),n=1,nd1),i=1,n2)
      write(7)((((qparc(l,m,n,i),l=1,ld),m=1,md1),n=1,nd),i=1,n2)
      write(7)((((qpars(l,m,n,i),l=1,ld),m=1,md1),n=1,nd),i=1,n2)
      write(7)(timo(i),i=1,ne)
      write(7)(wpfx(i),i=1,ne)
      write(7)(gamx(i),i=1,ne)
      write(7)(wrhx(i),i=1,ne)
      write(7)(wrhy(i),i=1,ne)
      write(7)(wdux(i),i=1,ne)
      write(7)(wu2x(i),i=1,ne)
      write(7)(wp2x(i),i=1,ne)
      write(7)(wv2x(i),i=1,ne)
      write(7)(wlux(i),i=1,ne)
      write(7)(wdpx(i),i=1,ne)
      write(7)(wdvx(i),i=1,ne)
      write(7)(wenx(i),i=1,ne)
      write(7)(wdfx(i),i=1,ne)
      write(7)(pcerr(i),i=1,ne)
      write(7)(((wkif(i,m,n),i=1,ne),m=1,md1),n=1,nd1)
      write(7)(((wpif(i,m,n),i=1,ne),m=1,md1),n=1,nd1)
      write(7)(((wvif(i,m,n),i=1,ne),m=1,md1),n=1,nd1)
      write(7)(((wplx(i,m,n),i=1,ne),m=1,md1),n=1,nd1)
      write(7)(wakx(i),i=1,ne)
      write(7)(waky(i),i=1,ne)
      write(7)(therm(i),i=1,ne)
      write(7)(wxsp(i),i=1,ne)
      write(7)(((grtmx(i,m,n),i=1,ne),m=1,md1),n=1,nd1)
      write(7)(((uctim(i,m,n),i=1,ntotal),m=1,md1),n=1,nd)
      write(7)(((ustim(i,m,n),i=1,ntotal),m=1,md1),n=1,nd)
      write(7)(timf(i),i=1,ntotal)
      write(7)avgflag
    1 format(1x,3i10)
    2 format(1x,3e22.14)
c
      return
      end
