anchor.diff:              aeg(i,ih,2) = hs/hi
               aeg(i,ih,3) = hs*hi
               aeg(i,ih,4) = hc
  -            aeg(i,ih,5) = ((wf/afok)*(one-hc))/dpsq ! hr06
  -            aeg(i,ih,6) = (((-one*wf)/hi)*hs)/dpsq  ! hr06
  +            aeg(i,ih,5) = ((wf/afok)*(one-hc))/dpsq
  +            aeg(i,ih,6) = (((-one*wf)/hi)*hs)/dpsq
               ih = ih+1
               if(ih.gt.2) ih = 1
               hi = sqrt(abs(ek(i)/dpd))
  
positive.code:                 aeg(i,2,2) = rho*si
                  aeg(i,2,3) = zero
                  aeg(i,2,4) = one
                  aeg(i,2,5) = ((-one*rho)*(one-co))/dpsq         ! hr06
                  aeg(i,2,6) = ((-one*two)*tan_mb(fok*half))/dpsq ! hr06
                  ! VERTICAL
                  g  = tan_mb(fok*half)/rho
                  gl = el(i)*g
                  aeg(i,1,1) = one-gl
                  aeg(i,1,2) = el(i)
                  aeg(i,1,3) = (-one*g)*(two-gl)                  ! hr06
                  aeg(i,1,4) = aeg(i,1,1)
              case (6)
                  ! HORIZONTAL
                  aeg(i,2,1)=co
                  aeg(i,2,2)=rho*si
                  aeg(i,2,3)=(-one*si)/rho                        ! hr06
                  aeg(i,2,4)=co
                  aeg(i,2,5)=((-one*rho)*(one-co))/dpsq           ! hr06
                  aeg(i,2,6)=(-one*si)/dpsq                       ! hr06
                  ! VERTICAL
                  aeg(i,1,1)=one
                  aeg(i,1,2)=el(i)
  
negative.code:                 fokq = ek(i)
              else
                  ih   = 1
                  fokq = -one*ek(i)
              end if
              wf  = ed(i)/dpsq
              fok = fokq/dpd-wf**2
              if(abs(fok).le.pieni) then
                  do l=1,2
                      a(i,l,1) = one
  