program OW_editvel_pik

use sep

implicit none

logical			:: vmut,vper,vvel,vchg
character*80                  :: hor1
real			:: o1,o2,d1,d2,v,x
integer			:: i1,i2,n1,n2
real,allocatable		:: velin(:,:)

call sep_init()
call sep_begin_prog()

call from_history("n1",n2); call from_history("d1",d2); call from_history("o1",o2)
call from_history("n3",n1); call from_history("d3",d1); call from_history("o3",o1)

call from_param("hor1",hor1)
open(unit=2,file=hor1)
allocate(velin(n2,n1));velin=0;
call sreed("in",velin,4*n1*n2)
call from_param("v",v)

   outer:do i2=1,n2
      x=(i2-1)*d2+o2
      do i1=1,n1
         if (velin(i2,i1)>=v) then
            write(2,3) i1,x
            cycle outer
         end if
      end do
   end do outer
3 format(i4, f13.5)
close(2)
deallocate(velin)
call sep_end_prog()
end program
