      PROGRAM TABSSP

C     Tabulate the sound speed profile for use by another program

      IMPLICIT REAL*4 ( A-H, O-Z )

C      OPEN( UNIT = 27, FILE = 'tabssp.prt', STATUS = 'UNKNOWN',
C     &      CARRIAGECONTROL = 'LIST' )

      WRITE( *, * ) 'Depth, N, RMIN, RMAX, NR ='
      READ( *, * ) D, N, RMIN, RMAX, NR

      IF ( NR .EQ. 1 ) THEN
         DELTAR = 0.0
      ELSE
         DELTAR = ( RMAX - RMIN ) / ( NR - 1 )
      ENDIF

      DO IR = 1, NR
         R  = RMIN + ( IR - 1 ) * DELTAR
         RM = 1000.0 * R
         WRITE( 27, * ) R

         DO I = 1, N
            Z = ( I - 1 ) * D / ( N - 1 )
            CALL ANALYT( RM, Z, C, CR, CZ, CRR, CRZ, CZZ, 'TAB' )
C           WRITE( *, 500 ) Z, C, 0.0, 1.0, 0.0, 0.0
  500       FORMAT( 6( F9.2, ', ') )
            WRITE( *, 1500 ) Z, C
 1500       FORMAT( F9.2, F9.2 )
         END DO

      END DO

      STOP
      END
