c-----------------------
c                           read density. produce projection file for sm
c
      PARAMETER (N=64)
      Dimension dens(N,N,N)
      Dimension pr(N,N)

      open(1,file='dens_cr.dat')
      open(2,file='pr.dat')


      read (1,*) dens
      Do i=1,N
         i1 =i-1
         if(i1.lt.1)i1=i1+N
         i2 =i+1
         if(i2.gt.N)i2=i2-N
      Do j=1,N
         j1 =j-1
         if(j1.lt.1)j1=j1+N
         j2 =j+1
         if(j2.gt.N)j2=j2-N
          s=0.
      Do k = (32-8),(32)
          k1 =k-1
         if(k1.lt.1)k1=k1+N
         k2 =k+1
         if(k2.gt.N)k2=k2-N
        
         s = s+dens(i,j,k)+dens(i1,j,k)+dens(i2,j,k)+
     &                              dens(i,j1,k)+dens(i,j2,k)+
     &                              dens(i,j,k1)+dens(i,j,k2)
      EndDo
c      if(i.eq.1)s=1000.
         write(2,*) i, j, s/7.
         EndDo
         EndDo


         stop
         end
