program main
  use base_ioutil_mod
  use base_struct_mod
  implicit none

  type(axis)                      :: ax_modl,ay_modl,az_modl,ahx_modl,ahy_modl,ahz_modl
  type(axis)                      :: at_data,agx_data,agy_data,asx_data,asy_data
  real, dimension(:), allocatable :: modl
  real, dimension(:), allocatable :: data

  character(len=256)              :: mod1_, mod2_, dat1_, dat2_

  mod1_ = "mod1"; mod2_ = "mod2"
  dat1_ = "dat1"; dat2_ = "dat2"

  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()

! input axes
! ---------- 
  call hinaxis(mod1_, ax_modl , 1); call hinaxis(mod1_, ay_modl , 2); call hinaxis(mod1_, az_modl , 3)
  call hinaxis(mod1_, ahx_modl, 4); call hinaxis(mod1_, ahy_modl, 5); !call hinaxis(mod1_, ahz_modl, 6)

  call hinaxis(dat1_, at_data , 1); call hinaxis(dat1_, agx_data, 2); call hinaxis(dat1_, agy_data, 3)
  call hinaxis(dat1_, asx_data, 4); call hinaxis(dat1_, asy_data, 5)

! output axes
! -----------
  call houaxis(mod2_, ax_modl , 1); call houaxis(mod2_, ay_modl , 2); call houaxis(mod2_, az_modl , 3)
  call houaxis(mod2_, ahx_modl, 4); call houaxis(mod2_, ahy_modl, 5); !call houaxis(mod2_, ahz_modl, 6)

  call houaxis(dat2_, at_data , 1); call houaxis(dat2_, agx_data, 2); call houaxis(dat2_, agy_data, 3)
  call houaxis(dat2_, asx_data, 4); call houaxis(dat2_, asy_data, 5)

  allocate(modl(ax_modl%n*ay_modl%n*az_modl%n*ahx_modl%n*ahy_modl%n))
  allocate(data(at_data%n*agx_data%n*agy_data%n*asx_data%n*asy_data%n))

  call random_number(modl)
  call random_number(data)

  modl = (modl - 0.5)*2.
  data = (data - 0.5)*2.

  call sseek(mod2_, 0, 0)
  call sseek(dat2_, 0, 0)

  call sep_write(modl, mod2_)
  call sep_write(data, dat2_)

end program
