C     *********************
C     *  PROGRAM BEMMAIN  *
C     *********************
C
      PROGRAM BEMMAIN
C
      IMPLICIT REAL*8(A-H,O-Z)
      PARAMETER (ND1=90,ND2=270,ND3=102)
      COMPLEX*16 P(ND1,ND1),V(ND1,ND1),F(ND1),T(ND2,ND2),A(ND2),
     *           W(ND2),SP(ND2,ND3,10),TC(ND2,ND2)
      DIMENSION SX1(ND1),SX2(ND1),SZ2(ND1),SX3(ND1),
     *          NCF(10),IP(ND2),NES1(ND1),NES2(ND1),NES3(ND1)
      COMMON /FREQ/ FT,NO
     *       / XZ / FX0(10),FZ0(10),DA(10),NFLT
     *       / NS / NS1,NS2,NS3
C
      WRITE(6,6000)ND1,ND2,ND3
C
      CALL CLOCK
C
      CALL INDATA(SX1,SX2,SZ2,SX3,NES1,NES2,NES3,ND1,NCF,NF)
C
      DO 100 K=1,NO
C
        OM=FT*DFLOAT(K)
C
        CALL CALMAT(SX1,SX2,SZ2,SX3,ND1,V,P,OM,T,ND2,NCF)
C
        DO 110 IFLT=1,NFLT
C
          CALL CALVF(SX2,SZ2,SX3,ND1,ND2,OM,F,A,IFLT,NCF)
C
          DO 120 I=1,NS1+2*NS2+NS3
            DO 130 J=1,NS1+2*NS2+NS3
              TC(I,J)=T(I,J)
  130       CONTINUE
  120     CONTINUE
C
          EPS=10D-10
          CALL DCLNLU(TC,NS1+2*NS2+NS3,ND2,A,EPS,W,IP,NSTOP)
          IF(NSTOP.NE.0) WRITE(6,*)' OM,IFLT,NSTOP=',OM,IFLT,NSTOP
C
          DO 140 M=1,NS1+2*NS2+NS3
            SP(M,K,IFLT)=A(M)
  140     CONTINUE
C
  110     CONTINUE
C
  100 CONTINUE
C
      CALL OUTPUT(SP,NES1,NES2,NES3,ND1,ND2,ND3,NF)
C
      CALL CLOCK(TIME)
      WRITE(6,6010)TIME
C
      STOP
C
 6000 FORMAT(///2X,'DIMENSION DATA'//
     *          2X,'ND1(ONE SURFACE LIMMIT NUM) =',I5,
     *          2X,'ND2(NS1+2*NS2+NS3)          =',I5/,
     *          2X,'ND3(DELTA OMEGA LIMMIT NUM) =',I5)
 6010 FORMAT(///10X,'CPU TIME =',F15.7/)
      END
