  program refcoef2

  use sep

  implicit none

  real, dimension(:,:),allocatable	:: dado
  integer                      		:: n1, n2, n3, i2, i3, it, stat
  real                        		:: o1, o2, o3, d1, d2, d3 
  real                        		:: gama, offset
  real                        		:: zr, v1, v2
  real, parameter             		:: PI = 3.14159265359
  
  call sep_init()
  call sep_begin_prog()

  call initpar()

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

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

  allocate(dado(n1,n2))
  dado=0.
  do i3=1,n3
    call sreed("in",dado,4*n1*n2)
    do i2=1,n2
	gama=o2+(i2-1)*d2
        dado(:,i2)=dado(:,i2)/abs(cosd(gama))
    end do
    call srite("out", dado, 4*n1*n2)
  end do
  deallocate(dado)
  call sep_end_prog()
  end program
