      program main

      open(1,file='sgsim_pw.out')
      do i=1,3
            read(1,*)
      end do
      open(2,file='sgsim_pw1.out')
      write(2,*) 'Sgsim_pw first XZ slice'
      write(2,*) '1'
      write(2,*) 'value'
      nx=400
      ny=600
      nz=200
      do iz=1,nz      
      write(*,*) ' Currently on level ',iz
            do ix=1,nx
                  read(1,*) sim
                  write(2,*) sim
            end do
            do iy=2,ny
            do ix=1,nx
                  read(1,*)
	      end do
            end do
      end do
      close(1)
      close(2)
      end
