C
C THIS ROUTINE CHANGES THE CHARACTERISTICS OF A LIST, AND
C  SHOULD BE USED ONLY BY EXPERIENCED CRAPS PROGRAMMERS!
C  
C INPUT: LIST   - THE LIST NUMBER WHICH IS TO BE CHANGED.
C        SYTYPL - THE NEW SYMMETRY TYPE FOR THE BRA INDICES.
C        SYTYPR - THE NEW SYMMETRY TYPE FOR THE KET INDICES.
C        CHANGE - LOGICAL VARIABLE WHICH CONTROLS WHETHER OR
C                 NOT THE CORRESPONDING ISYTYP ENTRIES ARE
C                 CHANGED TO CORRESPOND TO THE NEW LIST TYPE.
C                 SET THIS TO .TRUE. UNLESS YOU REALLY KNOW
C                 WHAT YOU ARE DOING.
C
      SUBROUTINE NEWTYP(LIST,SYTYPL,SYTYPR,CHANGE)
      IMPLICIT INTEGER (A-Z)
      LOGICAL CHANGE
      COMMON /IOPOS/ ICRSIZ,ICHCSZ,IOFF(2),LENREC
      COMMON /LISTS/ MOIO(10,500),MOIOWD(10,500),MOIOSZ(10,500),
     &              MOIODS(10,500),MOIOFL(10,500)
      COMMON /SYMPOP/ IRPDPD(8,22),ISYTYP(2,500),ID(18)
      COMMON /SYMINF/ NSTART,NIRREP,IRREPA(255),IRREPB(255),
     &                DIRPRD(8,8)
      COMMON /MACHSP/ IINTLN,IFLTLN,IINTFP,IALONE,IBITWD
      COMMON /AUXCACHE/ QUIKGET(10,500)
#ifdef _ASSERT
      if ((SYTYPL.lt.1).or.(22.lt.SYTYPL).or.
     &    (SYTYPR.lt.1).or.(22.lt.SYTYPR)    ) then
         print *, '@NEWTYP: Assertion failed.'
         print *, '   SYTYPL = ',SYTYPL
         print *, '   SYTYPR = ',SYTYPR
         print *, '   LIST   = ',LIST
         call errex
      end if
#endif /* _ASSERT */ 
      TOTNEW=0
      TOTOLD=0
      IWORD2=QUIKGET(1,LIST)
      IWORD=MOIOWD(1,LIST)
      IREC =MOIO(1,LIST)
      ILIST=LIST
      IF(LIST.GT.100) ILIST=LIST
      DO 10 IRREP=1,NIRREP
       NUMDIS=IRPDPD(IRREP,SYTYPR)
       DISSIZ=IRPDPD(IRREP,SYTYPL)
       TOTNEW=TOTNEW+NUMDIS*DISSIZ
       TOTOLD=TOTOLD+IRPDPD(IRREP,ISYTYP(1,ILIST))*
     &               IRPDPD(IRREP,ISYTYP(2,ILIST))
       MOIODS(IRREP,LIST)=NUMDIS
       MOIOSZ(IRREP,LIST)=DISSIZ
       MOIOWD(IRREP,LIST)=IWORD
       MOIO  (IRREP,LIST)=IREC
       IF(QUIKGET(IRREP,LIST).NE.0)QUIKGET(IRREP,LIST)=IWORD2
       IWORD=IWORD+NUMDIS*DISSIZ*IINTFP
       IWORD2=IWORD2+NUMDIS*DISSIZ*IINTFP
       IF(IWORD.GT.LENREC)THEN
        INC=(IWORD-1)/LENREC
        IWORD=IWORD-INC*LENREC
        IREC=IREC+INC
       ENDIF
10    CONTINUE
      IF(CHANGE) THEN
      ISYTYP(1,ILIST)=SYTYPL
      ISYTYP(2,ILIST)=SYTYPR
      ENDIF
      IF(TOTNEW.GT.TOTOLD)THEN
       WRITE(6,100)LIST,TOTNEW,TOTOLD
100    FORMAT(T3,'@NEWTYP-F, Length of new list ',I3,'[',I8,' words]',
     &          /,'exceeds original length [',I8,' words].')
       CALL ERREX
      ENDIF
      RETURN
      END 
