      SUBROUTINE GETSYM
      IMPLICIT REAL (A-H,O-Z)
      CHARACTER*80 KEYWRD, KOMENT, TITLE
      COMMON /KEYS/ KEYWRD, KOMENT, TITLE
      COMMON /GEOSYM/ NDEP, LOCPAR(200), IDEPFN(200), LOCDEP(200)
C***********************************************************************
C
C   GETSYM READS IN THE SYMMETRY DEPENDENCE RELATIONSHIPS.
C
C   ON EXIT     NDEP    = NUMBER OF SYMMETRY RELATIONS.
C               LOCPAR  = ARRAY OF REFERENCE FUNCTION INDICES.
C               IDEPFN  = ARRAY OF REFERENCE ATOM LOCATIONS.
C               LOCDEP  = ARRAY OF DEPENDENT ATOM LOCATIONS.
C
C***********************************************************************
C
C     LOCDEP IS THE ATOM WHOSE COORDINATES DEPEND ON THE COORDINATES OF
C     LOCPAR.
C     LOCPAR IS THE ATOM WHOSE COORDINATES ARE USED TO CALCULATE THOSE
C     OF LOCDEP
C     IDEPFN POINTS TO THE PARTICULAR FUNCTION TO BE USED (SEE NDDO)
C
C***********************************************************************
      DIMENSION IVALUE(40),VALUE(40)
      CHARACTER  TEXT(18)*60, LINE*80, CLEAN*80
      LOGICAL PARAM
      DATA TEXT/
     -' BOND LENGTH    IS SET EQUAL TO THE REFERENCE BOND LENGTH   ',
     -' BOND ANGLE     IS SET EQUAL TO THE REFERENCE BOND ANGLE    ',
     -' DIHEDRAL ANGLE IS SET EQUAL TO THE REFERENCE DIHEDRAL ANGLE',
     +' DIHEDRAL ANGLE VARIES AS  90 DEGREES - REFERENCE DIHEDRAL  ',
     1' DIHEDRAL ANGLE VARIES AS  90 DEGREES + REFERENCE DIHEDRAL  ',
     2' DIHEDRAL ANGLE VARIES AS 120 DEGREES - REFERENCE DIHEDRAL  ',
     3' DIHEDRAL ANGLE VARIES AS 120 DEGREES + REFERENCE DIHEDRAL  ',
     4' DIHEDRAL ANGLE VARIES AS 180 DEGREES - REFERENCE DIHEDRAL  ',
     5' DIHEDRAL ANGLE VARIES AS 180 DEGREES + REFERENCE DIHEDRAL  ',
     6' DIHEDRAL ANGLE VARIES AS 240 DEGREES - REFERENCE DIHEDRAL  ',
     7' DIHEDRAL ANGLE VARIES AS 240 DEGREES + REFERENCE DIHEDRAL  ',
     8' DIHEDRAL ANGLE VARIES AS 270 DEGREES - REFERENCE DIHEDRAL  ',
     9' DIHEDRAL ANGLE VARIES AS 270 DEGREES - REFERENCE DIHEDRAL  ',
     A' DIHEDRAL ANGLE VARIES AS - REFERENCE DIHEDRAL              ',
     B' BOND LENGTH VARIES AS HALF THE REFERENCE BOND LENGTH       ',
     C' BOND ANGLE VARIES AS HALF THE REFERENCE BOND ANGLE         ',
     D' BOND ANGLE VARIES AS 90 DEGREES - REFERENCE BOND ANGLE     ',
     E' THE USER HAS TO SUPPLY THIS FUNCTION IN HADDON             '/
C
C TITLE OUTPUT
      PARAM=(INDEX(KEYWRD,'PARAM') .NE. 0)
      IF( .NOT. PARAM)WRITE (6,90)
   90 FORMAT (///5X,25HPARAMETER DEPENDENCE DATA//                      
     +'        REFERENCE ATOM      FUNCTION NO.    DEPENDENT ATOM(S)')  
C
C INPUT SYMMETRY : FUNCTION, REFERANCE PARAMETER, AND DEPENDENT ATOMS
C
      NDEP=0
 100  READ(5,'(A)',END=140) LINE
      CALL NUCHAR(LINE,VALUE,NVALUE)
C   INTEGER VALUES
       DO 105 I=1,NVALUE
105      IVALUE(I)=VALUE(I)
C   FILL THE LOCDEP ARRAY
      IF(NVALUE.EQ.0.OR.IVALUE(3).EQ.0) GO TO 140
      DO 113 I=3,NVALUE
      IF(IVALUE(I).EQ.0) GOTO 114
      NDEP=NDEP+1
      LOCDEP(NDEP)=IVALUE(I)
      LOCPAR(NDEP)=IVALUE(1)
      IDEPFN(NDEP)=IVALUE(2)
  113 CONTINUE
  114 LL=I-1
      IF(.NOT. PARAM)WRITE(6,116)IVALUE(1),IVALUE(2),(IVALUE(J),J=3,LL)
  116 FORMAT(I13,I19,I14,20I3)
      GO TO 100
C
C CLEAN UP
  140 CONTINUE
      IF( .NOT. PARAM)WRITE(6,145)
  145 FORMAT(/10X,'   DESCRIPTIONS OF THE FUNCTIONS USED',/)
      DO 142 J=1,18
      DO 141 I=1,NDEP
      IF(IDEPFN(I).EQ.J) GOTO 143
  141 CONTINUE
      GOTO 142
  143 IF( .NOT. PARAM)WRITE(6,144)J,TEXT(J)
  144 FORMAT(I4,5X,A)
  142 CONTINUE
      RETURN
      END
