C=================================================================C
C
C     main program calling a subroutine SZTABLE.
C
C=================================================================C

      IMPLICIT REAL*8 (A-H,O-Z)
      real*8 TH(50), X(101), Z(50, 101)

      CALL SZTABLE(TH, X, Z)

      DO 10 J = 1, 101

      write(51, 100) X(J), Z( 1,J), Z( 2,J), Z( 3,J), Z( 4,J), Z( 5,J),
     *                     Z( 6,J), Z( 7,J), Z( 8,J), Z( 9,J), Z(10,J)
      write(52, 100) X(J), Z(11,J), Z(12,J), Z(13,J), Z(14,J), Z(15,J),
     *                     Z(16,J), Z(17,J), Z(18,J), Z(19,J), Z(20,J)
      write(53, 100) X(J), Z(21,J), Z(22,J), Z(23,J), Z(24,J), Z(25,J),
     *                     Z(26,J), Z(27,J), Z(28,J), Z(29,J), Z(30,J)
      write(54, 100) X(J), Z(31,J), Z(32,J), Z(33,J), Z(34,J), Z(35,J),
     *                     Z(36,J), Z(37,J), Z(38,J), Z(39,J), Z(40,J)
      write(55, 100) X(J), Z(41,J), Z(42,J), Z(43,J), Z(44,J), Z(45,J),
     *                     Z(46,J), Z(47,J), Z(48,J), Z(49,J), Z(50,J)
10    CONTINUE
100   FORMAT(1H , F4.1, 10ES10.3E1)
      STOP
      END

C=====================================================================C
C
C     Subroutine SZTABLE(TH, X, Z)
C     This routine returns the data of Tables 1 -- 5 for the SZ effect.
C     Outputs:
C             TH(50) --- data of theta_e from 0.002 to 0.100
C             X(101) --- data of X from 0.0 to 20.0
C             Z(50, 101) --- SZ effect data for a given set of
C                            values (theta_e, X)
C
C                                Created by S. Nozawa (July, 2002)
C
C=====================================================================C

      SUBROUTINE SZTABLE(TH, X, Z)
      IMPLICIT REAL*8 (A-H,O-Z)
      real*8 TH(50), X(101), Z(50, 101)

C     Open data files
      open (unit=11, file='table1.dat')
      open (unit=12, file='table2.dat')
      open (unit=13, file='table3.dat')
      open (unit=14, file='table4.dat')
      open (unit=15, file='table5.dat')

C.... Define TH(I) as an array of theta_e
      IMAX = 50
      DO 10 I = 1, IMAX
        TH(I) = 0.002D0*I
10    CONTINUE

C.... Read Tables 1 -- 5
      JMAX = 101
      DO 20 J = 1, JMAX
        read(11, *) X1, Z( 1,J), Z( 2,J), Z( 3,J), Z( 4,J), Z( 5,J),
     *                  Z( 6,J), Z( 7,J), Z( 8,J), Z( 9,J), Z(10,J)
        read(12, *) X2, Z(11,J), Z(12,J), Z(13,J), Z(14,J), Z(15,J),
     *                  Z(16,J), Z(17,J), Z(18,J), Z(19,J), Z(20,J)
        read(13, *) X3, Z(21,J), Z(22,J), Z(23,J), Z(24,J), Z(25,J),
     *                  Z(26,J), Z(27,J), Z(28,J), Z(29,J), Z(30,J)
        read(14, *) X4, Z(31,J), Z(32,J), Z(33,J), Z(34,J), Z(35,J),
     *                  Z(36,J), Z(37,J), Z(38,J), Z(39,J), Z(40,J)
        read(15, *) X5, Z(41,J), Z(42,J), Z(43,J), Z(44,J), Z(45,J),
     *                  Z(46,J), Z(47,J), Z(48,J), Z(49,J), Z(50,J)

C.... Define X(J) as an array of X
        X(J) = X1
20    CONTINUE

      RETURN
      END
