program Lapfill2
  use sep
  use lapfillx

  implicit none
  integer                             :: n1, n2, niter, id, im
  integer                             :: randseed
  real                                :: dot1(2), dot2(2), eps, randscale
  real, dimension (:), pointer        :: model

  call sep_init (SOURCE)

  call from_history( n1, n2)
  call from_param("niter", niter, 200)
  call from_param("eps", eps, 1.0)
  call from_param("seed", randseed, 1243)
  call from_param("scale", randscale, 0.0)

  allocate( model(n1*n2))

  call sep_read( model )

  call lapfill2_init( n1, n2, .true., model, randscale, randseed )
  call lapfill2x( niter, model, eps )

  call sep_write(model)

  call sep_close()

  deallocate( model)

  call exit( 0)

end program Lapfill2
