program sg_mig
  use wei_mig_standard_scale_mod
  complex, allocatable :: image(:,:,:,:,:)
  complex, allocatable :: wfld(:,:,:,:,:)
  type(wfile)   :: ifile,data
  type(wspace),pointer   :: space
  integer        :: nth
#ifdef OMP
  integer,external :: omp_get_thread_num,omp_get_num_threads
#endif

  allocate(space)
  call sep_init()
  call mig_init(space,ifile,data)

#ifdef OMP
!$OMP PARALLEL
  space%nth=omp_get_num_threads()
!$OMP END PARALLEL
#else
  space%nth=1 
#endif
  allocate(wfld(space%npad(1),space%npad(2),space%npad(3),&
    space%npad(4),space%nth))
  allocate(image(space%npad(1),space%npad(2),space%npad(3),&
    space%npad(4),space%nzb))
  call mig_of(space,ifile,data,wfld,image)

  call sep_end_prog()
  


end program

