program main
  use base_struct_mod
  use base_ioutil_mod
  use sep
  implicit none

  type(axis)                      :: ax, ay, az
  integer                         :: ix_dfr, iy_dfr, iz_dfr
  integer                         :: nx_dfr, ny_dfr, nz_dfr
  integer                         :: index_x_dfr, index_y_dfr, index_z_dfr
  real, dimension(:,:,:), pointer :: modl
  character(len=256)              :: modl_, data_


  modl_ = "modl"
  data_ = "data"

  call sep_init(SOURCE)
  call getch_add_string("head=/dev/null")
  call getch_add_string("noheader=y")
  call set_no_putch()
  call sep_begin_prog()

  call hinaxis(data_, ax, 1)
  call hinaxis(data_, ay, 2)
  call hinaxis(data_, az, 3)

  call houaxis(modl_, ax, 1)
  call houaxis(modl_, ay, 2)
  call houaxis(modl_, az, 3)

  call from_param("nx_dfr", nx_dfr, 1)
  call from_param("ny_dfr", ny_dfr, 1)
  call from_param("nz_dfr", nz_dfr, 1)

  allocate(modl(ax%n, ay%n, az%n))

  modl = 0.

  do iz_dfr=1, nz_dfr; index_z_dfr = 1.5 + az%n/(nz_dfr+1)*iz_dfr
  do iy_dfr=1, ny_dfr; index_y_dfr = 1.5 + ay%n/(ny_dfr+1)*iy_dfr
  do ix_dfr=1, nx_dfr; index_x_dfr = 1.5 + ax%n/(nx_dfr+1)*ix_dfr
     modl(index_x_dfr, index_y_dfr, index_z_dfr) = 1.
  end do
  end do 
  end do

  call sep_write(modl, modl_)

end program
