C
C *** EIGEN VALUE EQUATION OF LOVE WAVE, IN CASE OF C=VS(NL)
C
      REAL FUNCTION FA21*8 (OM,ML,NL,DNS,VS,DEP)
C
C INPUT DATA
C OM    : CIRCULAR FREQUENCY (OMEGA)
C ML    : NL IN MAIN 
C NL    : TOTAL NUMBER OF LAYERS           
C DNS(I): DENSITY OF Ith LAYER 
C VS (I): VS OF Ith LAYER      
C DEP(I): DEPTH (THICKNESS) OF Ith LAYER  
C OUTPUT DATA
C FA21  : EIGEN VALUE EQUATION OF LOVE WAVE, IN CASE OF C=VS(NL)
C
      IMPLICIT REAL*8(A-H,O-Z)
      DIMENSION DNS(ML),VS(ML),DEP(ML)
      COMPLEX*16 R11,R12,R21,R22,SA11,SA12,SA21,SA22
     *         ,SB11,SB12,SB21,SB22
C
      BN=VS(NL)
      WN=OM/BN
C
      R11=(1.0D0,0.0D0)
      R12=(0.0D0,0.0D0)
      R21=(0.0D0,0.0D0)
      R22=(1.0D0,0.0D0)
C
      DO 100 IL=NL-1,1,-1
C
        SA11=R11
        SA12=R12
        SA21=R21
        SA22=R22
C
        BM=VS(IL)
        RBM=DSQRT(BN*BN/(BM*BM)-1.0D0)
        QM=WN*RBM*DEP(IL)
        CQ=DCOS(QM)
        SQ=DSIN(QM)
C
        SM=DNS(IL)*VS(IL)*VS(IL)
        SB11=DCMPLX(CQ,0.0D0)
        IF(RBM.EQ.0.D0)THEN
          SB12=DCMPLX(0.D0,WN*DEP(IL)/SM)
        ELSE
          SB12=DCMPLX(0.0D0,SQ/(SM*RBM))
        END IF
        SB21=DCMPLX(0.0D0,SQ*SM*RBM)
        SB22=DCMPLX(CQ,0.0D0)
C
        R11=SA11*SB11+SA12*SB21
        R12=SA11*SB12+SA12*SB22
        R21=SA21*SB11+SA22*SB21
        R22=SA21*SB12+SA22*SB22
C
  100 CONTINUE
C
      FA21=IMAG(R21)
C
      RETURN
      END
