anchor.diff:        SI=SI*SC+CO*SS
      50 CO=CO*SC-SIS*SS
         KO=NTOT+1
  -      DO 40 I=1,KO,2
  +      do 40 I=1,KO,2
         K1=NTOT2-I+4
         AP1RE=A(I)-A(K1+1)
         AP2RE=-(A(I+1)+A(K1))
  
positive.code: C   CODED PER B SCHNABEL SEPT. 1970
  C * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *  *
  C
        DIMENSION T(200), TSTEP(27), NT(27)
  C
        IF (KK .EQ. 1) THEN
          K = 1
          T(K) = 0.
          SAVE = 0.
          DO N = 1,NN
            M = NT(N)
            STEP = (TSTEP(N) - SAVE)/FLOAT(M)
            SAVE = TSTEP(N)
            DO I = 1,M
              K = K + 1
              T(K) = T(K-1) + STEP
            END DO
          END DO
          NSTEP = K
          RETURN
        ELSE IF (KK .EQ. 2) THEN
          NST = ALOG10(T1)
          IF (T1.LT. 1.) NST = NST - 1
          STEP = 1./NN
          K = 1
          TA = 10.**FLOAT(NST)
          T(1) = TA
          DO J = 2,NN
            K = K + 1
            T(K) = TA*10.**(STEP*FLOAT(J))
            IF (T(K) .GT. T1) GO TO 221
          END DO
    221   TA = T(K-1)
          K = 0
    211   DO J = 1,NN
            K = K + 1
            T(K) = TA*10.**(STEP*FLOAT(J))
            IF (T(K).GT.TN)  GO TO 212
          END DO
          TA = TA*10.
          GO TO 211
    212   NSTEP = K
          RETURN
        END IF
        END
  C***********************************************************
        SUBROUTINE RESP(LN,LS,NN,X,AX,A,S,INV)
  C * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
  C   THIS PROGRAM READS DATA FOR RESPONSE SPECTRUM ANALYSIS
  C   NECESSARY SUBROUTINES    DRCTSP,  CMPMAX
  C
  C        NN      = RESPONSE SPECTRUM NUMBER
  C        ND      = NUMBER OF DAMPING VALUES
  C        X       = FOURIER TRANSFORM OF OBJECT MOTION
  C        AX      = FOURIER TRANSFORM OF COMPUTED MOTIONS
  C        T       = PERIODS FOR WHICH RESPONSE IS TO BE COMPUTED
  C
  C   CODED PER B SCHNABEL DEC. 1970
  C   New Sets of Periods -- included in February 1991
  C
  C * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
  C
        CHARACTER*6 TITLE,ID,IBLANK,IDNT
        CHARACTER*60 ABSIS
        CHARACTER*32 FPERIOD
        CHARACTER*80 headerd
        COMPLEX X, AX
  C
        DIMENSION X(64), AX(3,64),A(2,64), S(10),INV(10)
        DIMENSION ID(27,11)
  C
        COMMON /SOILA/ IDNT(6),BL(51),GL(51),FACT(51),H(51),R(51),BF(51)
        COMMON /EQ/ MFOLD,MA2,TITLE(5),DT, MA , MMA, DF,MX
        COMMON /RVAL/ NND(27), ZLD(6),T(200), SA(5,200),SV(5,200)
  C
        IBLANK = '      '
        ABSIS = ' PERIOD IN SEC.'
  C
        READ(5,4) ND, KPER, GGT
      4 FORMAT(2I5,F10.2)
        READ(5,5) (ZLD(I), I = 1,ND)
      5 FORMAT(6F10.3)
        WRITE(6,9001) LN, (ZLD(I), I = 1,ND)
  C -------------------------------------------------------------------
  C   IF KPER = 0; Periods from 0.03 to 10 sec are included in data block
  C                in this subroutine
  C    otherwise, periods are specified by user (maximum is 200 periods)
  C -------------------------------------------------------------------
        IF (KPER.EQ. 0) GO TO 99
          READ(5,'(A32)') FPERIOD
          WRITE(6,60) FPERIOD
     60   FORMAT(' File from which periods were read: ' A32)
          OPEN(8,FILE=FPERIOD,STATUS='OLD')
          READ (8,4) NLINES, NNM
          DO I = 1, NLINES
            READ(8,*) headerd
            WRITE(6,*) headerd
          END DO
          READ(8,*) (T(I), I=1, NNM)
          CLOSE(8)
          GO TO 101
  C ----------------------------------------------------------------------
  C  default periods for calculating response spectra
  C  ---------------------------------------------------------------------
  
negative.code: C
  C***********************************************************************
  C
        dimension X(27,20),Y(27,20),A(27,20),B(27,20),NV(27),TSTEP(27)
        dimension NT(27), T(200), V(27,200)
  C
        XMIN = 100000000.
        XMAX = 0.
        do L= 1,NC
          M = NV(L)
          if (XMAX .lt. X(L,M))   XMAX = X(L,M)
          if (XMIN .gt. X(L,1)) XMIN = X(L,1)
          M = M - 1
          do I = 1,M
            X1 = X(L,I)
            X2 = X(L,I+1)
            if (K1 .eq. 2)  X1 = ALOG10(X1)
            if (K1 .eq. 2)  X2 = ALOG10(X2)
            X(L,I) = X(L,I+1)
            A(L,I) = (Y(L,I+1) - Y(L,I))/(X2 - X1)
            B(L,I) = -A(L,I)*X1 + Y(L,I)
          end do
        end do
  C
        call STEPG(K1, NN, TSTEP, NT, XMIN, XMAX, T, NSTEP)
  C
        do L = 1,NC
          M = NV(L) - 1
          do I = 1,NSTEP
            do J = 1,M
              if (T(I) .lt. X(L,J))  go to  31
            end do
            J = M
     31     TT = T(I)
            if (K1 .eq. 2) TT = ALOG10(TT)
            V(L,I) = A(L,J)*TT  + B(L,J)
          end do
        end do
        return
        end
  C*********************************************************************
        subroutine STEPG(KK, NN, TSTEP, NT, T1, TN, T, NSTEP)
  C * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *  *
  C
  C   THE ROUTINE GENERATES STEPS IN LINEAR OR LOGARITHMIC INCREMENT
  