      SUBROUTINE DRCEXT
      IMPLICIT REAL (A-H,O-Z)
      INCLUDE 'SIZES'
      LOGICAL ERROR, FIRST, CARCOR, INTDIS
      DIMENSION NN(NUMATM), ISYM(10,NUMATM)
      DIMENSION A(3,NUMATM),NC(NUMATM),NB(NUMATM),NA(NUMATM)
      DIMENSION LA(NUMATM),LB(NUMATM),LC(NUMATM)
      DIMENSION NDIST( NUMATM), NANGLE( NUMATM), NDIHED( NUMATM)
      CHARACTER*80 KEYWRD,KOMENT,TITLE
      CHARACTER*80 DUMMY, COMAND
      CHARACTER*6 METHOD
      CHARACTER*3 FTYPE
      REAL VFREQ, VIBVEC
      LOGICAL LKINET, TIME, EPOTEN, REFER, PERROR
      LOGICAL DEBUGL, DEBUGN, DEBUGO, DEBUG, DEBUGP, DEBUGI
      COMMON /DEBCOM/ DEBUG, DEBUGL, DEBUGN, DEBUGO, DEBUGP, DEBUGI
      COMMON /FILEST/ FIRST
      COMMON /FORCE/ VFREQ(3*NUMATM), VIBVEC(3*NUMATM,3*NUMATM), IDVECT
C**   COMMON /FINFO/ DELTAH,   RC,  GRAD,RCGRAD,    VIP,DIPOLE, ICHARG
      COMMON /FINFO/ ETIME, EXKIN, ENERR,  EPOT, EKINET, REFNR, IPOINT
      COMMON /FINFOC/ FTYPE
*
* ETIME  := ELAPSED TIME
* EXKIN  := EXCESS KINETIC ENERGY TO ADD
* ENERR  := ENERGY ERROR
* EPOT   := POTENTIAL ENERGY AT THIS POINT
* EKINET := KINETIC ENERGY AT THIS POINT
* REFNR  := REFERENCE NUMBER
* IPOINT := POINT NUMBER
*
*  LOOK FOR THE START OF NEXT DRC POINT
*
C?      IF ( DEBUGI ) THEN
         WRITE (DUMMY,'( '' IN DRCEXT: '')') 
         CALL DEBUGR( DUMMY )
C?      ENDIF

      CALL DEBUGR( 'EXTRACTING from REACTION COORDINATE output.')

 10   CALL UPROMP('Which parameters do you wish to plot? ')

      READ( *, '(A)', END=10) COMAND
      CALL LCLEAN( COMAND, COMAND, .TRUE.)

      IF ( COMAND(1:1) .EQ. ' ') GOTO 20

      IF( COMAND(1:2) .EQ. 'KI') THEN
         LKINET = .TRUE.
      ELSEIF( COMAND(1:2) .EQ. 'TI') THEN
         TIME = .TRUE.
      ELSEIF( COMAND( 1:2) .EQ. 'PO') THEN
         EPOTEN = .TRUE.
      ELSEIF( COMAND( 1:3) .EQ. 'REF') THEN
         REFER = .TRUE.
      ELSEIF( COMAND( 1:3) .EQ. 'ERR') THEN
         PERROR = .TRUE.
      ELSEIF ( COMAND( 1:3) .EQ. 'DIS' ) THEN
        CALL POPARG( COMAND, COMAND)
        IF ( COMAND( 1:1) .GE. 'A' .AND. COMAND( 1:1) .LE. 'Z') THEN
          ITEMP1 = ICHAR( COMAND( 1:1)) - ICHAR( 'A') + 1
          ITEMP2 = ICHAR( COMAND( 2:2)) - ICHAR( 'A') + 1
          ITEMP = 26*(ITEMP2-1) + ITEMP1
          NDIST( ITEMP) = 1
        ELSEIF( COMAND( 1:1).GE.'1' .AND. COMAND( 1:1).LE.'9') THEN
          ITEMP = READA( COMAND, 1, ERROR)
          NDIST( ITEMP) = 1
        ELSE
          CALL DEBUGR('I do not understand which atom: '//COMAND(1:5) )
        ENDIF
      ELSEIF( COMAND( 1:2) .EQ. 'AN') THEN
        CALL POPARG( COMAND, COMAND)
        IF ( COMAND( 1:1) .GE. 'A' .AND. COMAND( 1:1) .LE. 'Z') THEN
          ITEMP1 = ICHAR( COMAND( 1:1)) - ICHAR( 'A') + 1
          ITEMP2 = ICHAR( COMAND( 2:2)) - ICHAR( 'A') + 1
          ITEMP = 26*(ITEMP2-1) + ITEMP1
          NANGLE( ITEMP) = 1
        ELSEIF( COMAND( 1:1).GE.'1' .AND. COMAND( 1:1).LE.'9') THEN
          ITEMP = READA( COMAND, 1, ERROR)
          NANGLE( ITEMP) = 1
        ELSE
          CALL DEBUGR('I do not understand which atom: '//COMAND(1:5) )
        ENDIF
      ELSEIF( COMAND( 1:2) .EQ. 'DIH') THEN
        CALL POPARG( COMAND, COMAND)
        IF ( COMAND( 1:1) .GE. 'A' .AND. COMAND( 1:1) .LE. 'Z') THEN
          ITEMP1 = ICHAR( COMAND( 1:1)) - ICHAR( 'A') + 1
          ITEMP2 = ICHAR( COMAND( 2:2)) - ICHAR( 'A') + 1
          ITEMP = 26*(ITEMP2-1) + ITEMP1
          NDIHED( ITEMP) = 1
        ELSEIF( COMAND( 1:1).GE.'1' .AND. COMAND( 1:1).LE.'9') THEN
          ITEMP = READA( COMAND, 1, ERROR)
          NDIHED( ITEMP) = 1
        ELSE
          CALL DEBUGR('I do not understand which atom: '//COMAND(1:5) )
        ENDIF
      ELSE
         CALL DEBUGR( 'I do not recognize: '//COMAND(1: 20) )
      ENDIF
      CALL POPARG( COMAND, COMAND)
      GOTO 10
*  NOW EXTRACT THE INFORMATION
 20   CONTINUE
          CALL DRCRD( IR, NATOUT,IEOUT,COOUT,NAOUT,NBOUT,NCOUT,
     +             IA, IB, IC, ISYM, KEYWRD, KOMENT, TITLE, IOERR )
          IF (IOERR.NE.0) GO TO 9100
      RETURN
 9100 CONTINUE
      RETURN
      END
