      subroutine qkund(trans,cod,al,rho,kx,eps0,coup)

      implicit none
      real*8 trans(4,5),cod(6),cod1(6),al,rho,eps0
      real*8 arho,theta,dp,kx

      logical coup

      dp      = cod(6)

      arho    = rho*sqrt(2.d0)*(1+dp)
      theta   = al/arho

      cod1(1) = cod(1)
      cod1(2) = cod(2)
      cod1(3) = cod(3)
      cod1(4) = cod(4)

      cod1(1)=cod(1)+cod(2)*al
      cod1(2)=cod(2)
      cod1(3)=cod(3)*cos(theta)+cod(4)*arho*sin(theta)
      cod1(4)=-sin(theta)/arho*cod(3)+cod(4)*cos(theta)

      cod(1) = cod1(1)
      cod(2) = cod1(2)
      cod(3) = cod1(3)
      cod(4) = cod1(4)

      trans(1,1)=1.d0
      trans(1,2)=al
      trans(1,3)=0.d0
      trans(1,4)=0.d0
      trans(1,5)=0.d0
      trans(2,1)=0.d0
      trans(2,2)=1.d0
      trans(2,3)=0.d0
      trans(2,4)=0.d0
      trans(2,5)=0.d0
      trans(3,1)=0.d0
      trans(3,2)=0.d0
      trans(3,3)=cos(theta)
      trans(3,4)=arho*sin(theta)
      trans(3,5)=0.d0
      trans(4,1)=0.d0
      trans(4,2)=0.d0
      trans(4,3)=-sin(theta)/arho
      trans(4,4)=cos(theta)
      trans(4,5)=0.d0

      coup=.true.
      return
      end

