C
C *** EIGEN VALUE EQUATION OF RAYLEIGH WAVE IN THE CASE OF C=VS(NL)
C
      REAL FUNCTION FRCT*8 (OM,ML,NL,DNS,VP,VS,THK)
C
      IMPLICIT REAL*8(A-H,O-Z)
      DIMENSION VP(ML),VS(ML),THK(ML),DNS(ML)
      COMPLEX*16 AA(4,4),SA(4,4),SB(4,4)
     *          ,RAN,B11,B13,RL,RK,RN,RM
C
C *** WAVE NUMBER ***
C
      BN=VS(NL)
      WN=OM/BN
C
C *** INITIALIZATION OF AA MATRIX ***
C
      DO 100 I=1,4
        DO 110 J=1,4
          AA(I,J)=(0.0D0,0.0D0)
  110   CONTINUE
        AA(I,I)=(1.0D0,0.0D0)
  100 CONTINUE
C
C *** AA MATRIX ***
C
      DO 200 IL=NL-1,1,-1
C
        DO 210 I=1,4
          DO 220 J=1,4
            SA(I,J)=AA(I,J)
  220     CONTINUE
  210   CONTINUE
C
C    ** CQ, STQ AND SDQ **
C
        BM=VS(IL)
        CB2=BN*BN/(BM*BM)
C
        RBM=DSQRT(CB2-1.0D0)
        QM=WN*RBM*THK(IL)
        CQ=DCOS(QM)
        SQ=DSIN(QM)
        STQ=RBM*SQ
        SDQ=SQ/RBM
C
C    ** CP, STP AND SDP **
C
        AM=VP(IL)
        CA2=BN*BN/(AM*AM)
        CALL CSTD(WN,AM,BN,CA2,THK(IL),CP,STP,SDP)
C
C    ** HASKELL'S SUB MATRIX **
C
        CALL FRSB(DNS(IL),ML,CB2,BN,CQ,STQ,SDQ,CP,STP,SDP,SB)
C
C    ** AA MATRIX **
C
        DO 250 I=1,4
          DO 260 J=1,4
            AA(I,J)=(0.D0,0.D0)
            DO 270 K=1,4
              AA(I,J)=AA(I,J)+SA(I,K)*SB(K,J)
  270       CONTINUE
  260     CONTINUE
  250   CONTINUE
C
  200 CONTINUE
C
C *** GN,RAN,B11-B24 AND RL-RM ***
C
      GN=2.D0*VS(NL)*VS(NL)/(BN*BN)
      RAN=-DCMPLX(0.D0,DSQRT(1.0D0-BN*BN/(VP(NL)*VP(NL))))
C
      B11=GN*RAN
      B12=GN-1.D0
      B14=1.D0/(DNS(NL)*BN*BN)
      B13=-RAN*B14
      B21=-B12
      B23=B14
C
      RL=B11*AA(1,1)+B12*AA(2,1)+B13*AA(3,1)+B14*AA(4,1)
      RK=B11*AA(1,2)+B12*AA(2,2)+B13*AA(3,2)+B14*AA(4,2)
      RN=B21*AA(1,1)+B23*AA(3,1)
      RM=B21*AA(1,2)+B23*AA(3,2)
C
C *** FNCFRN ***
C
      FRCT=REAL(RN*RK-RL*RM)
C                     
      RETURN
      END
