!
Subroutine Components(er, zet, min, max, key, Pole, eM, eN)
use Advertisement
implicit none
integer*4, intent(in) :: min, max, key
complex*16, intent(in), dimension(1:*) :: Pole
complex*16, intent(out), dimension(1:3, 1:*) :: eM, eN
real*8, intent(in) :: er, zet
real*8 a
complex*16 rp, zp, ap, p, t
complex*16 f, df
integer*4 k
a=dsqrt(1.d00-zet*zet)
do k=min, max
 rp=cdsqrt(er**2+Pole(k)**2-2.d00*er*Pole(k)*zet)
 zp=(er*zet-Pole(k))/rp
 ap=cdsqrt(1.d00-zp*zp)
 if (key.eq.3) then
  rp=rp*(1.d00, 0.d00); Call Hankel(rp, f, df)
 end if
 if (key.eq.1) then
  rp=rp*r_i;  Call Bessel(rp, f, df)
 end if
 call Legendre(zp, p, t)
 if (m.eq.0) then
  eM(1, k)=(0.d00, 0.d00)
  eM(2, k)=(0.d00, 0.d00)
  eM(3, k)=-t*f/rp
  eN(1, k)=2.d00*p*f/rp/rp
  eN(2, k)=t*df/rp
  eN(3, k)=(0.d00, 0.d00)
 else
  eM(1, k)=(0.d00, 0.d00)
  eM(2, k)=m*p*f/rp
  eM(3, k)=-t*f/rp
  eN(1, k)=m*(m+1)*ap*p*f/rp/rp
  eN(2, k)=t*df/rp
  eN(3, k)=m*p*df/rp
 end if
 p=a*zp-zet*ap; t=zet*zp+a*ap 
 eM(1,k)=eM(2,k)*p; eM(2,k)=eM(2,k)*t
 f=eN(1, k)*t+eN(2, k)*p; df=-eN(1, k)*p+eN(2, k)*t
 eN(1, k)=f; eN(2, k)=df
end do
end Subroutine Components
!  
Subroutine oComponents(er, zet, min, max, key, eM, eN)
use Advertisement
implicit none
integer*4, intent(in) :: min, max, key
complex*16, intent(out), dimension(1:3, 1:*) :: eM, eN
real*8, intent(in) :: er, zet
real*8 a, p(max), t(max)
complex*16 f(max), df(max)
integer*4 k
if (key.eq.3) Call nHankel(max, er*(1.d00, 0.d00), f, df) !
if (key.eq.1) Call nBessel(max, er*(1.d00, 0.d00), f, df) !
a=dsqrt(1.d00-zet*zet)
call nLegendre(max, zet, a, p, t) !
do k=min, max
 p(k)=nu(k)*p(k)
 t(k)=nu(k)*t(k)
 if (m.eq.0) then
  eM(1, k)=(0.d00, 0.d00)
  eM(2, k)=(0.d00, 0.d00)
  eM(3, k)=-t(k)*f(k)/er
  eN(1, k)=k*(k+1)*p(k)*f(k)/er/er
  eN(2, k)=t(k)*df(k)/er
  eN(3, k)=(0.d00, 0.d00)
 else
  eM(1, k)=(0.d00, 0.d00)
  eM(2, k)=m*p(k)*f(k)/er
  eM(3, k)=-t(k)*f(k)/er
  eN(1, k)=k*(k+1)*a*p(k)*f(k)/er/er
  eN(2, k)=t(k)*df(k)/er
  eN(3, k)=m*p(k)*df(k)/er
 end if
end do
end Subroutine oComponents
!
