C
C *** grfft.f is a FORTRAN code to obtain seismograms in the time domain,
C     which are computed from grpoint.f and grfault.f
C
      PROGRAM grfftsp
C
      IMPLICIT REAL*8(A-H,O-Z)
      PARAMETER(Msflt=1000)
      dimension slp35(50,Msflt),slp125(50,Msflt)
      dimension a1(5,Msflt),a2(5,Msflt)
c
      NW=22
      NL=43
      OPEN(11,FILE='rateA.dat',STATUS='OLD')
      do 100 n=1,NW*NL
        READ(11,*)a1(1,n),a1(2,n),a1(3,n),a1(4,n),a1(5,n)
        READ(11,*)a2(1,n),a2(2,n),a2(3,n),a2(4,n),a2(5,n),n2
        do i=0,3
          jj=i*10
          READ(11,*)(slp35(j+jj,n),j=1,10)
        end do
        READ(11,*)(slp35(j+40,n),j=1,9)
c
        READ(11,*)
        READ(11,*)
        do i=0,3
          jj=i*10
          READ(11,*)(slp125(j+jj,n),j=1,10)
        end do
        READ(11,*)(slp125(j+40,n),j=1,9)
  100 continue
      CLOSE(11)
C
      write(*,*)
      write(*,*)'Enter Fault Width Num. for Slip Rate Func (1-22)'
      read(*,*)Nout
      OPEN(12,FILE='rateA-out2.csv',STATUS='unknown')
      write(12,1000)(i,i,i=1,43)
 1000 format('time(s),',43(',SR35:',i5,',SR125:',i5))
      n=0
      do 200 iW=1,NW
      do 200 iL=1,NL
        n=n+1
        if(iw.ne.Nout)goto 200
  200 continue
      CLOSE(12)
C
      stop
      END

