program OCtst_main
  use sep 
  use oc_global_mod 
  use oc_utils_mod 
  use oc_weight_mod

  implicit none
  integer :: stat
  real               :: ocmaxmem, oceps
  integer            :: ocniter
  logical            :: ocverb,ocmovie,ocwght 
  integer            :: ocsolver
  integer            :: ocnlap

  character(len=128) :: name 
  character(len=128) :: x_,y_,w_
  type(fileinfo)                   :: file

  !----------------------------------------------------------------
  call sep_init()

  call from_param("ocmaxmem",ocmaxmem,     0.)
  !! convert Mbytes to bytes
  ocmaxmem = ocmaxmem * 1024*1024

  call from_param("oceps",   oceps,0.01)
  call from_param("ocverb",  ocverb,.false.)
  call from_param("ocmovie", ocmovie,.false.)
  call from_param("ocsolver",ocsolver,0)
  call from_param("ocnlap",  ocnlap,2)
  call from_param("ocwght",  ocwght,.false.)

  call sep_close()
  !----------------------------------------------------------------

  x_ = 'X'
  y_ = 'Y'
  w_ = 'W'

  write(0,*) "allocate file"
  call oc_allocatefile(file,x_,nint(ocmaxmem))

  write(0,*) "clone X to Y"
  name="yyy.H"; y_ = oc_clone(.false.,  x_, name, nint(ocmaxmem))

  write(0,*) "init W"
  call oc_weight_init( w_,nint(ocmaxmem))

  write(0,*) "apply W"
  stat = oc_weight(F,F,x_,y_)

  write(0,*) "done"
  call exit(0)
end program OCtst_main




