



C

C











































C
C
      SUBROUTINE SETLEV (UNT,SUBJ)




















      IMPLICIT      NONE
      CHARACTER*(*) UNT, SUBJ




      CALL ERRLEV (UNT,SUBJ)
      CALL TEXLEV (UNT,SUBJ)





      RETURN
      END
      SUBROUTINE ERRLEV (UNT,SUBJ)



















      IMPLICIT      NONE
      INCLUDE       'PDBINC.INC'
      INCLUDE       'BIGINC.INC'
      INTEGER       GVFLEN, NUM, L, LS, I, IERR
      CHARACTER*(*) UNT, SUBJ
      CHARACTER*80  ERR_CMPND, CMPND, OUTL
      SAVE          ERR_CMPND, NUM
      DATA          ERR_CMPND  /'NoNsEnSe-StRiNg'/







      CMPND=FILNMS(62)
      IF (UNT(1:3).EQ.'NOT'.OR.
     +    UNT(1:3).EQ.'WAR'.OR.
     +    UNT(1:3).EQ.'ERR') THEN
         IF (ERR_CMPND.NE.CMPND) THEN
            ERR_CMPND=CMPND
            NUM=1
            CALL PDBOUT_OPEN (IERR)
            IF (IERR.NE.0) GOTO 999
            L=GVFLEN(CMPND)
            IF (L.GT.0) THEN
               WRITE (PDBUNT,1000,ERR=999) CMPND(1:L)
            ELSE
               WRITE (PDBUNT,1000,ERR=999) 'No Name'
            END IF
         ELSE
            NUM=NUM+1
         END IF
      ELSE



         CALL GVSFMT ('?FMT439')
         WRITE (LINE,FMT,ERR=999)
         CALL GVSTO6 (LINE)
         GOTO 997
      END IF
      LS=GVFLEN(SUBJ)
      IF (LS.EQ.0) LS=1
      IF (LS.GT.60) THEN
         LS=60
         CALL GVSSTX (SUBJ(57:60),' ...')
      END IF
      IF (UNT(1:3).EQ.'NOT') THEN
         WRITE (OUTL,1012,ERR=999) NUM, SUBJ(1:LS)
      ELSE IF (UNT(1:3).EQ.'WAR') THEN
         WRITE (OUTL,1011,ERR=999) NUM, SUBJ(1:LS)
      ELSE
         WRITE (OUTL,1010,ERR=999) NUM, SUBJ(1:LS)
      END IF
      CALL GVSRDB (OUTL)



      WRITE (PDBUNT,1020,ERR=999) ' '
      WRITE (PDBUNT,1020,ERR=999) OUTL(1:GVFLEN(OUTL))
      CALL GVSFMT ('?FMT439')
      WRITE (LINE,FMT,ERR=999)
      CALL GVSTO6 (LINE)
      CALL GVSTO6 (OUTL)
      DO 30 I=1,GVFLEN(OUTL)
         OUTL(I:I)='='
   30 CONTINUE
      CALL GVSTO6 (OUTL)
      GOTO 997



 999  CONTINUE
      CALL GVSTTB ('?PDB001')
      CALL GVSCLF (PDBUNT)



 997  CONTINUE


 1000 FORMAT (/,72('=')/
     +        ,'==== Compound code ',a,t69,'===='/,72('='))
 1010 FORMAT ('#',i6,' # Error: ',a)
 1011 FORMAT ('#',i6,' # Warning: ',a)
 1012 FORMAT ('#',i6,' # Note: ',a)
 1020 FORMAT (A)

      RETURN
      END
      SUBROUTINE TEXLEV (UNT,SUBJ)



















      IMPLICIT      NONE
      INCLUDE       'PDBINC.INC'
      INCLUDE       'BIGINC.INC'
      INTEGER       GVFLEN, LS, IERR
      CHARACTER*(*) UNT, SUBJ
      CHARACTER*80  CMPND, LASTCMPND, LIN
      SAVE          LASTCMPND
      DATA LASTCMPND /'=='/







      CALL PDBOUT_OPEN (IERR)
      IF (IERR.NE.0) GOTO 998



      IF (TEXLEVEL(1:3).EQ.'ERR') THEN
         WRITE (TEXUNT,1010,ERR=999)
      ELSE IF (TEXLEVEL(1:3).EQ.'WAR') THEN
         WRITE (TEXUNT,1020,ERR=999)
      ELSE IF (TEXLEVEL(1:3).EQ.'NOT') THEN
         WRITE (TEXUNT,1030,ERR=999)
      ELSE IF (TEXLEVEL(1:3).NE.'   ') THEN
         CALL GVSTTB ('?PDB004')
         PRINT *,'''',TEXLEVEL(1:3),''''
      END IF



      IF (UNT.EQ.'NONE') THEN
         TEXLEVEL=' '
      ELSE
         TEXLEVEL=UNT
      END IF
      IF (TEXLEVEL.NE.' ') THEN







         CMPND=FILNMS(62)
         CALL TEXVER (CMPND)
         CALL RHNO61 (CMPND)
         IF (LASTCMPND.NE.CMPND) THEN
            LASTCMPND=CMPND
            IF (GVFLEN(CMPND).GT.0) THEN
               WRITE (TEXUNT,1070,ERR=999) CMPND(1:GVFLEN(CMPND))
            ELSE
               WRITE (TEXUNT,1070,ERR=999) 'Unnamed compound'
            END IF
         END IF



         IF (GVFLEN(SECTION).GT.0) WRITE (TEXUNT,1100,ERR=999) 
     +    SECTION(1:GVFLEN(SECTION))
         SECTION=' '



         IF (TEXLEVEL(1:3).EQ.'ERR') THEN
            WRITE (TEXUNT,1040,ERR=999)
         ELSE IF (TEXLEVEL(1:3).EQ.'WAR') THEN
            WRITE (TEXUNT,1050,ERR=999)
         ELSE IF (TEXLEVEL(1:3).EQ.'NOT') THEN
            WRITE (TEXUNT,1060,ERR=999)
         ELSE IF (TEXLEVEL(1:3).NE.'   ') THEN
            CALL GVSTTB ('?PDB005')
            CALL GVSTT6 (TEXLEVEL)
         END IF



         LS=GVFLEN(SUBJ)
         IF (LS.EQ.0) THEN
            CALL TEXSUBJ ('?PDHDR18')
            CALL GVSTTB ('?PDB014')
         ELSE IF (TEXLEVEL(1:3).EQ.'ERR') THEN
            CALL GVSCCCB (LIN,'?XERROR',SUBJ(1:LS))
            CALL TEXSUBJ (LIN)
         ELSE IF (TEXLEVEL(1:3).EQ.'WAR') THEN
            CALL GVSCCCB (LIN,'?XWARN',SUBJ(1:LS))
            CALL TEXSUBJ (LIN)
         ELSE IF (TEXLEVEL(1:3).EQ.'NOT') THEN
            CALL GVSCCCB (LIN,'?XNOTE',SUBJ(1:LS))
            CALL TEXSUBJ (LIN)
         END IF
      END IF
      GOTO 997



 998  CONTINUE
      CALL GVSTTE ('?PDB006')
      CALL GVSCLF (TEXUNT)
      GOTO 997
 999  CONTINUE
      TEXLEVEL=' '
      CALL GVSTTE ('?PDB007')
      CALL GVSCLF (TEXUNT)



 997  CONTINUE



 1010 FORMAT ('\\end{error}'/)
 1020 FORMAT ('\\end{warning}'/)
 1030 FORMAT ('\\end{note}'/)
 1040 FORMAT ('\\begin{error}')
 1050 FORMAT ('\\begin{warning}')
 1060 FORMAT ('\\begin{note}')
 1070 FORMAT ('\\sect{',a,'}')
 1100 FORMAT ('\\ssect{',a,'}')


      RETURN
      END
      SUBROUTINE TEXCLOSE



















      IMPLICIT      NONE
      INCLUDE       'PDBINC.INC'
      INCLUDE       'BIGINC.INC'
      INTEGER       GVFLEN, IU12, IERR
      LOGICAL       GVFFOP, FIRST
      CHARACTER*80  LOCLIN, OLOCLIN, HEDNAM







      IU12=0
      IF (.NOT.GVFFOP(TEXUNT)) GOTO 997



      FIRST=.TRUE.
      CALL TEXLEV ('NONE','NONE')
      IF (GVFFOP(80)) THEN
         CALL GVSCLF (80)
         CALL GVSOPF ('TEXSTORE.DAT',80,'OLD')
         IF (.NOT.GVFFOP(80)) THEN
            CALL GVSTTE ('?M4867')
            GOTO 90
         END IF
         READ (80,1040,END=90,ERR=998) OLOCLIN
   10    CONTINUE
         READ (80,1040,END=20,ERR=998) LOCLIN
         IF (GVFLEN(OLOCLIN).GT.0) THEN
            IF (FIRST) WRITE(TEXUNT,1010,ERR=999)
            FIRST=.FALSE.
            WRITE (TEXUNT,1020,ERR=999) OLOCLIN(1:GVFLEN(OLOCLIN))
         END IF
         OLOCLIN=LOCLIN
         GOTO 10
   20    CONTINUE
         IF (.NOT.FIRST) THEN
            IF (GVFLEN(OLOCLIN).GT.0) THEN
               WRITE (TEXUNT,1021,ERR=999) OLOCLIN(1:GVFLEN(OLOCLIN))
            END IF
         END IF
   90    CALL GVSCLF (80)
         WRITE (TEXUNT,1030,ERR=999)
      END IF



      CALL GVSROF (IU12,IERR)
      IF (IU12.EQ.0.OR.IERR.NE.0) GOTO 997
      CALL GVSCLF (IU12)
      CALL GVSCCC (HEDNAM,WHERIS,'TRAILER.TEX')
      CALL GVSOPF (HEDNAM,IU12,'OLD')
      IF (.NOT.GVFFOP(IU12)) THEN
         CALL GVSTT6 ('?PDB003')
         CALL GVSCLF (TEXUNT)
         GOTO 997
      END IF
 11   CONTINUE
      READ (IU12,1040,ERR=998,END=21) LOCLIN
      IF (GVFLEN(LOCLIN).EQ.0) THEN
         WRITE(TEXUNT,1030,ERR=999)
      ELSE
         WRITE (TEXUNT,1040,ERR=999) LOCLIN(1:GVFLEN(LOCLIN))
      END IF
      GOTO 11



 21   CONTINUE
      CALL GVSCLF (IU12)



      CALL GVSCCC (HEDNAM,WHERIS,'TRAILER.TXT')
      CALL GVSOPF (HEDNAM,IU12,'OLD')
      IF (.NOT.GVFFOP(IU12)) THEN
         CALL GVSTT6 ('?PDB003')
         CALL GVSCLF (TEXUNT)
         GOTO 997
      END IF
 12   CONTINUE
      READ (IU12,1040,ERR=998,END=22) LOCLIN
      IF (GVFLEN(LOCLIN).EQ.0) THEN
         WRITE(PDBUNT,1030,ERR=999)
      ELSE
         WRITE (PDBUNT,1040,ERR=999) LOCLIN(1:GVFLEN(LOCLIN))
      END IF
      GOTO 12



 22   CONTINUE
      GOTO 997



 998  CONTINUE
      TEXLEVEL=' '
      CALL GVSTTE ('?M4868')
      GOTO 997
 999  CONTINUE
      TEXLEVEL=' '
      CALL GVSTTE ('?PDB008')



 997  CONTINUE
      IF (IU12.NE.0) CALL GVSCLF (IU12)



 1010    FORMAT ('\\appendix'/,
     +           '\\section{List of PDB files studied}'/,
     +           '\\raggedright')





 1020 FORMAT (a,',')
 1021 FORMAT (a,'.')
 1030 FORMAT ()
 1040 FORMAT (A)

      RETURN
      END
      SUBROUTINE TEXSECT (SECT)



















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INCLUDE       'PDBINC.INC'
      CHARACTER*(*) SECT
      CHARACTER*80  LASTSECT, LASTMOL
      SAVE          LASTSECT, LASTMOL
      DATA          LASTSECT, LASTMOL /2*' '/







      IF (LASTMOL.EQ.FILNMS(62).AND.SECT.EQ.LASTSECT) THEN
         GOTO 998
      ELSE
         CALL GVSSTX (LASTSECT,SECT)
         CALL GVSSTX (LASTMOL,FILNMS(62))
         CALL GVSSTX (SECTION,SECT)
      END IF



  998 CONTINUE


      RETURN
      END
      SUBROUTINE TEXSUBJ (SUBJECT)



















      IMPLICIT      NONE
      INCLUDE       'PDBINC.INC'
      CHARACTER*(*) SUBJECT
      CHARACTER*80  LOCSUB
      INTEGER       GVFLEN
      LOGICAL       GVFFOP







      IF (TEXLEVEL.EQ.' ') GOTO 998



      IF (.NOT.GVFFOP(TEXUNT)) THEN
         CALL GVSTTB ('?PDB009')
         GOTO 998
      END IF



      CALL GVSSTX (LOCSUB,SUBJECT)
      IF (GVFLEN(LOCSUB).GT.0) WRITE (TEXUNT,1010,ERR=999) 
     + LOCSUB(1:GVFLEN(LOCSUB))
      GOTO 998



 999  CONTINUE
      TEXLEVEL=' '
      CALL GVSTTE ('?PDB010')



  998 CONTINUE



 1010 FORMAT('\\showsect{',a,'}')




      RETURN
      END
      SUBROUTINE PDBMES (ERR)



















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INCLUDE       'SUGARS.INC'
      INCLUDE       'ESPACE.INC'
      INTEGER       GVFLEN, I, L, NLINES, IST
      CHARACTER*(*) ERR
      CHARACTER*80  WORD, BUF(60)
      CHARACTER*11  MESID







      IF (ERR(1:1).EQ.'?') THEN
         CALL GVSTTB ('?M0102')
         CALL GVSTT6 (ERR(2:))
         GOTO 998
      ENDIF



      IF (WIFPAR(279).LE.0) GOTO 998



      MESID(1:1)='?'
      L=GVFLEN(ERR)
      DO 10 I=1,MIN(L,10)
         MESID(I+1:I+1)=ERR(I:I)
   10 CONTINUE
      L=L+1
      CALL CGETTEXT (MESID,L,BUF,NLINES,60)



      IF (NLINES.LT.4) THEN
         CALL GVSTTB ('?M1002')
         CALL GVST6C ('Id:',ERR,.TRUE.)
      END IF





      IF (BUF(1)(1:3).EQ.'NOT') THEN
         IF (WIFPAR(279).LE.1) GOTO 998
      ELSE IF (BUF(1)(1:3).EQ.'WAR') THEN
         IF (WIFPAR(279).LE.0) GOTO 998
      ELSE IF (BUF(1)(1:3).EQ.'ERR') THEN
         IF (WIFPAR(279).LE.0) GOTO 998
      END IF
      CALL SETLEV (BUF(1),BUF(3))




      IST=4
      IF (INDEX(BUF(2),'ERRLNS').GT.0) IST=7



      DO 15 I=IST,NLINES
         CALL GVSTT6 (BUF(I))
 15   CONTINUE      



   20 CONTINUE
      CALL SPLITLINE (BUF(2),WORD,BUF(2))



      IF (GVFLEN(WORD).EQ.0) GOTO 999
      CALL GVSNL6 (1)



      IF (WORD.NE.'ERRLNS'.AND.WORD.NE.'HST'.AND.
     +    WORD.NE.'ALLMAT') CALL TEXSUN



      CALL PDB099 (WORD)



      IF (WORD.NE.'ERRLNS'.AND.WORD.NE.'HST'.AND.
     +    WORD.NE.'ALLMAT') CALL TEXEUN



      GOTO 20



  999 CONTINUE



      CALL SETLEV ('NONE','NONE')



  998 CONTINUE


      RETURN
      END
      SUBROUTINE PDB099 (WORD)



















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INCLUDE       'PDBINC.INC'
      INCLUDE       'SYMINC.INC'
      INCLUDE       'RESULT.INC'
      INTEGER       GVFLEN, ISYM
      REAL          GVFDET
      LOGICAL       GVFRIN
      CHARACTER*(*) WORD




      
      IF (WORD.EQ.'CRYST1') THEN
         CALL PDBHDR ('?PDHDR1')
         CALL TEXTXT (' ')
         CALL CELPRN (CELDIM)
      ELSE IF (WORD.EQ.'CELSCAL') THEN
         CALL PDB003
      ELSE IF (WORD.EQ.'ALLMAT') THEN
         DO 200 ISYM=1,NUMSYM
            CALL TEXSUN
            IF (ISYM.EQ.1) THEN
               CALL GVSCTB (LINE,80)
               WRITE (LINE,122,ERR=998) NUMSYM
 122           FORMAT ('Matrices used:',I4)
               CALL GVSRDB (LINE)
               CALL TEXTXT (LINE)
               CALL TEXTXT (' ')
            END IF
            CALL TEXNL
            CALL GVSCTB (LINE,80)
            WRITE (LINE,123,ERR=998) ISYM
 123        FORMAT ('Symmetry operation number',I4)
            CALL GVSRDB (LINE)
            CALL TEXTXT (LINE)
            CALL TEXNL
            CALL GVSWM3V (SYMMAT(1,1,ISYM),SYMVEC(1,ISYM))
            CALL TEXNL
            CALL TEXEUN
 200     CONTINUE
      ELSE IF (WORD.EQ.'VAR6') THEN
         CALL GVSTTR ('?PDHDR34',GENRVL(27))
         CALL TEXTXT (' ')
         CALL GVSTTR ('?PDHDR35',SQRT(GENRVL(27)*15.1/27.8))
      ELSE IF (WORD.EQ.'BDISZ') THEN
         CALL GVSTTR ('?PDHDR21',GENRVL(8))
         CALL TEXTXT (' ')
         CALL GVSTTR ('?PDHDR25',GENRVL(21))
      ELSE IF (WORD.EQ.'BANGZ') THEN
         CALL GVSTTR ('?PDHDR24',GENRVL(20))
         CALL TEXTXT (' ')
         CALL GVSTTR ('?PDHDR26',GENRVL(22))
      ELSE IF (WORD.EQ.'POLYMULT') THEN
         CALL GVSTTI ('?PDHDR27B',SYMZ)
         CALL TEXTXT (' ')
         CALL GVSTTI ('?PDHDR27',GENIVL(3))
         CALL TEXTXT (' ')
         IF (CELMUL.GE.1) THEN
            CALL GVSTTI ('?PDHDR27A',CELMUL)
            CALL TEXTXT (' ')
         END IF
         IF (CELMUL.EQ.SYMZ) THEN
            CALL GVSTT6 ('?PDHDR27C')
            CALL TEXTXT (' ')
         END IF
      ELSE IF (WORD.EQ.'NCSRMS') THEN
         CALL GVSTTR ('?PDHDR56',GENRVL(37))
         CALL TEXTXT (' ')
         CALL GVSTTR ('?PDHDR58',GENRVL(43))
      ELSE IF (WORD.EQ.'NUMTLS') THEN
         CALL TEXTXT (' ')
         CALL GVSTTI ('?NUMTLS',NUMTLS)
      ELSE IF (WORD.EQ.'MVM') THEN
         CALL GVSTTR ('?PDHDR28',GENRVL(25))
         CALL TEXTXT (' ')
         CALL GVSTTR ('?PDHDR29',ABS(GVFDET(SYMINV)))
         IF (SYMZ/GENIVL(3)*GENIVL(3).EQ.SYMZ) THEN
            CALL TEXTXT (' ')
            CALL GVSTTI ('?PDHDR30',SYMZ/GENIVL(3))
         END IF
         CALL TEXTXT (' ')
         CALL GVSTTR ('?PDHDR31',GENRVL(24))
      ELSE IF (WORD.EQ.'SYMZ') THEN
         CALL GVSTTI ('?PDHDR32',SYMZ)
      ELSE IF (WORD.EQ.'NUMSYM') THEN
         CALL GVSTTI ('?PDHDR33',GENIVL(4))
      ELSE IF (WORD.EQ.'CELDIM') THEN
         CALL PDBHDR ('?PDHDR2')
         CALL TEXTXT (' ')
         CALL CELPRN (CELDIM)
      ELSE IF (WORD.EQ.'IMPZ') THEN
         CALL GVSTTR ('?PDHDR53',GENRVL(35))
      ELSE IF (WORD.EQ.'TAUZ') THEN
         CALL GVSTTR ('?PDHDR63',GENRVL(49))
      ELSE IF (WORD.EQ.'ERRLNS') THEN
         CALL TEXTXT (' ')
         CALL PDBOTB
      ELSE IF (WORD.EQ.'SCALE') THEN
         CALL PDBHDR ('?PDHDR4')
         CALL TEXTXT (' ')
         CALL GVSWM3 (SYMSCL)
      ELSE IF (WORD.EQ.'NEWSCALE') THEN
         CALL PDBHDR ('?PDHDR5')
         CALL TEXTXT (' ')
         CALL GVSWM3 (SYMSCL)
      ELSE IF (WORD.EQ.'SYMMAT') THEN
         CALL PDBHDR ('?PDHDR6')
         CALL TEXTXT (' ')
         CALL GVSWM3 (SYMMAT(1,1,NUMSYM))
      ELSE IF (WORD.EQ.'SPCNAM') THEN
         CALL GVST6C ('?NEXY2A',SPCNAM,.TRUE.)
      ELSE IF (WORD.EQ.'SPCNAMB') THEN
         CALL GVST6C ('?NEXY3A',SPCNAMB,.TRUE.)
      ELSE IF (WORD.EQ.'SCALES') THEN
         CALL PDBHD2 ('?PDHDR7')
         CALL TEXHD2 ('?PDHDR8','?PDHDR8A')
         CALL TEXTXT (' ')
         CALL GVSW2M (SYMSCL,SYMCEL)
      ELSE IF (WORD.EQ.'SCALCELL') THEN
         CALL PDBHDR ('?PDHDR9')
         CALL TEXTXT (' ')
         CALL CELPRN (CELDIMS)
      ELSE IF (WORD.EQ.'CRYST1S') THEN
         CALL PDBHDR ('?PDHDR10')
         CALL TEXTXT (' ')
         CALL GVSWM3 (SYMCEL)
      ELSE IF (WORD.EQ.'CLASS') THEN
         CALL GVST6C ('?NEWT538',CLASS,.TRUE.)
      ELSE IF (WORD.EQ.'CCLASS') THEN
         CALL GVST6C ('?PDHDR11',CCLASS,.TRUE.)
      ELSE IF (WORD.EQ.'CLASS2') THEN
         CALL GVST6C ('?PDHDR12',CLASS2,.TRUE.)
      ELSE IF (WORD.EQ.'AVQUA') THEN
         IF (GENIVL(1).NE.GENIVL(2)) THEN
            CALL GVSFMT ('?M0100')
            CALL GVSCTB (LINE,80)
            WRITE (LINE,FMT,ERR=998) GENIVL(1),GENIVL(2),GENRVL(1)
         ELSE
            CALL GVSFMT ('?M0101')
            CALL GVSCTB (LINE,80)
            WRITE (LINE,FMT,ERR=998) GENIVL(1),GENRVL(1)
         END IF
         CALL GVSNL6 (1)
         CALL GVSTT6 (LINE)
      ELSE IF (WORD.EQ.'AVNQA') THEN
         IF (GENIVL(8).GT.0) THEN
            CALL GVSFMT ('?NQAM035')
            WRITE (LINE,FMT,ERR=998) GENRVL(38),GENRVL(15)
            CALL GVSTT6 (LINE)
            CALL TEXTXT (' ')
            CALL GVSFMT ('?NQAM036')
            WRITE (LINE,FMT,ERR=998) GENRVL(39),GENRVL(16)
            CALL GVSTT6 (LINE)
            CALL TEXTXT (' ')
            CALL GVSFMT ('?NQAM037')
            WRITE (LINE,FMT,ERR=998) GENRVL(40),GENRVL(17)
            CALL GVSTT6 (LINE)
            CALL TEXTXT (' ')
            CALL GVSFMT ('?NQAM037A')
            WRITE (LINE,FMT,ERR=998) GENRVL(41),GENRVL(18)
            CALL GVSTT6 (LINE)
            CALL TEXTXT (' ')
            CALL GVSFMT ('?NQAM037B')
            WRITE (LINE,FMT,ERR=998) GENRVL(42),GENRVL(19)
            CALL GVSTT6 (LINE)
         ELSE
            CALL GVSFMT ('?NQAM035')
            WRITE (LINE,FMT,ERR=998) GENRVL(38)
            CALL GVSTT6 (LINE)
            CALL TEXTXT (' ')
            CALL GVSFMT ('?NQAM036')
            WRITE (LINE,FMT,ERR=998) GENRVL(39)
            CALL GVSTT6 (LINE)
            CALL TEXTXT (' ')
            CALL GVSFMT ('?NQAM037')
            WRITE (LINE,FMT,ERR=998) GENRVL(40)
            CALL GVSTT6 (LINE)
            CALL TEXTXT (' ')
            CALL GVSFMT ('?NQAM037A')
            WRITE (LINE,FMT,ERR=998) GENRVL(41)
            CALL GVSTT6 (LINE)
            CALL TEXTXT (' ')
            CALL GVSFMT ('?NQAM037B')
            WRITE (LINE,FMT,ERR=998) GENRVL(42)
            CALL GVSTT6 (LINE)
            CALL GVSTT6 ('?NQAM037C')
         END IF
      ELSE IF (WORD.EQ.'TWOVER') THEN
         IF (FIXLST(13).GT.0.5) THEN
            CALL GVSTT6 ('Please also see the previous check')
            CALL TEXTXT (' ')
            CALL SHOWTEXT ('?M5208')
            CALL TEXTXT (' ')
         END IF
      ELSE IF (WORD.EQ.'SOUNOT') THEN
         CALL SC2006
      ELSE IF (WORD.EQ.'MURTHY') THEN
         CALL GVSTTR ('The M-factor =',GENRVL(50))
      ELSE IF (WORD.EQ.'XBFAVE') THEN
         CALL GVSFMT ('?XBFAVE1')
         CALL GVSCTB (LINE,80)
         WRITE (LINE,FMT,ERR=998) GENRVL(6)
         CALL GVSTT6 (LINE)
      ELSE IF (WORD.EQ.'XBTEMP') THEN
         IF (GVFRIN(PDTEMP,-1.1,-0.9)) THEN
            CALL GVSSTX (LINE,'?M5204')
            CALL GVSTT6 (LINE)
            CALL TEXTXT (' ')
            CALL GVSSTX (LINE,'?M5205')
            CALL GVSTT6 (LINE)
            CALL TEXTXT (' ')
         ELSE IF (GVFRIN(PDTEMP,-0.1,0.1)) THEN
            CALL GVSSTX (LINE,'?M5206')
            CALL GVSTT6 (LINE)
            CALL TEXTXT (' ')
         ELSE
            CALL GVSFMT ('?XBFTEMP')
            CALL GVSCTB (LINE,80)
            WRITE (LINE,FMT,ERR=998) PDTEMP
            CALL GVSTT6 (LINE)
         END IF
      ELSE IF (WORD.EQ.'XBFVAR') THEN
         CALL GVSFMT ('?XBFVAR1')
         WRITE (LINE,FMT,ERR=998) GENRVL(7),GENIVL(5)
         CALL GVSTT6 (LINE)
         CALL TEXTXT (' ')
         CALL GVSFMT ('?XBFVAR2')
         WRITE (LINE,FMT,ERR=998) GENRVL(26)
         CALL GVSTT6 (LINE)
         CALL TEXTXT (' ')
         CALL GVSFMT ('?XBFVAR3')
         WRITE (LINE,FMT,ERR=998) GENRVL(28)
         CALL GVSTT6 (LINE)
      ELSE IF (WORD.EQ.'XBFLT5') THEN
         CALL GVSFMT ('?XBFLT5')
         WRITE (LINE,FMT,ERR=998) 100.0*GENRVL(5)
         CALL GVSTT6 (LINE)
      ELSE IF (WORD.EQ.'CHANAM') THEN
         IF (WIFPAR(846).EQ.0) THEN
            IF (FILNMS(72)(1:1).NE.' ') THEN
               CALL GVSFMT ('?M0104')
            ELSE
               CALL GVSFMT ('?M0104A')
            END IF
            WRITE (LINE,FMT,ERR=998) FILNMS(72)(1:1)
         ELSE 
            IF (FILNMS(72)(1:1).NE.' ') THEN
               CALL GVSFMT ('?M0104D')
            ELSE
               CALL GVSFMT ('?M0104E')
            END IF
            WRITE (LINE,FMT,ERR=998) FILNMS(72)(1:1), WIFPAR(846)
         END IF
         CALL PDBHDR (LINE)
      ELSE IF (WORD.EQ.'CAONLY') THEN
         CALL GVSFMT ('?CAONLYF')
         WRITE (LINE,FMT,ERR=998) GENIVL(15)
         CALL GVSTT6 (LINE)
         
      ELSE IF (WORD.EQ.'CHANAM2') THEN
         CALL GVSFMT ('?M0104C')
         CALL GVSCTB (LINE,80)
         WRITE (LINE,FMT,ERR=998) FILNMS(72)(1:1), FILNMS(72)(2:2)
         CALL PDBHDR (LINE)
      ELSE IF (WORD.EQ.'CHANMS') THEN
         CALL GVSFMT ('?M0104B')
         CALL GVSCTB (LINE,80)
         WRITE (LINE,FMT,ERR=998) FILNMS(72)(1:GVFLEN(FILNMS(72)))
         CALL PDBHDR (LINE)
      ELSE IF (WORD.EQ.'SUMACNOK') THEN
         CALL GVSFMT ('?ACCSC1')
         CALL GVSCTB (LINE,80)
         WRITE (LINE,FMT,ERR=998) GENRVL(2)
         CALL GVSTT6 (LINE)
         CALL TEXTXT (' ')
         CALL GVSFMT ('?ACCSC2')
         CALL GVSCTB (LINE,80)
         WRITE (LINE,FMT,ERR=998) GENRVL(3)
         CALL GVSTT6 (LINE)
         CALL TEXTXT (' ')
         CALL GVSFMT ('?ACCSC3')
         CALL GVSCTB (LINE,80)
         WRITE (LINE,FMT,ERR=998) GENRVL(4)
         CALL GVSTT6 (LINE)
         CALL GVSTT6 ('?ACCSC4')
      ELSE IF (WORD.EQ.'OMEDEV') THEN
         CALL GVSTTR ('?PDHDR36',GENRVL(30))
      ELSE IF (WORD.EQ.'RAMAZ') THEN
         CALL GVSTTR ('?PDHDR37',GENRVL(29))
      ELSE IF (WORD.EQ.'RESOL') THEN
         CALL GVSFMT ('?PDHDR57')
         WRITE (LINE,FMT,ERR=998) FLOAT(WIFPAR(941))/100.0
         CALL GVSTT6 (LINE)
         IF (WIFPAR(1295).NE.0) THEN
            CALL GVSFMT ('?PDHDR61')
            WRITE (LINE,FMT,ERR=998) FLOAT(WIFPAR(1291))/100.0
            CALL GVSTT6 (LINE)
            CALL GVSFMT ('?PDHDR62')
            WRITE (LINE,FMT,ERR=998) FLOAT(WIFPAR(1292))/100.0
            CALL GVSTT6 (LINE)
         END IF
      ELSE IF (WORD.EQ.'CHI12Z') THEN
         CALL GVSTTR ('?PDHDR38',GENRVL(31))
      ELSE IF (WORD.EQ.'SYMZ') THEN
         CALL GVSTTI ('?NEWZ85',SYMZ)
      ELSE IF (WORD.EQ.'RCELDIM') THEN
         CALL PDBHDR ('?PDHDR13')
         CALL TEXTXT (' ')
         CALL CELPRN (RCELDIM)
      ELSE IF (WORD.EQ.'CCELDIM') THEN
         CALL PDBHDR ('?PDHDR14')
         CALL TEXTXT (' ')
         CALL CELPRN (CCELDIM)
      ELSE IF (WORD.EQ.'CELTR') THEN
         CALL PDBHDR ('?PDHDR15')
         CALL TEXTXT (' ')
         CALL GVSWM3 (CELTR)
      ELSE IF (WORD.EQ.'HST') THEN
         CALL TEXTXT (' ')
         CALL PDBHDR ('?PDHDR19')
         CALL TEXTXT (' ')
         CALL DSP001 (.TRUE.)
      ELSE IF (WORD.EQ.'BRAVAIS') THEN
         CALL GVST6C ('?NEWT539',BRAVAIS,.TRUE.)
      ELSE IF (WORD.EQ.'SPLOT') THEN
         CALL TEXSTEREO
         CALL NOTEXTXT ('?PDHDR16')
      ELSE IF (WORD.EQ.'MPLOT') THEN
         CALL TEXMONO
         CALL NOTEXTXT ('?PDHDR16')
      ELSE IF (WORD.EQ.'SCATTER') THEN
         CALL SCATTEX
         CALL NOTEXTXT ('?PDHDR16')
      ELSE IF (WORD.EQ.'INV*CEL') THEN
         CALL PDB004
      ELSE IF (WORD.EQ.'SUMMARY') THEN
         CALL PDB001
      ELSE IF (WORD.EQ.'XSUMMARY') THEN
         CALL PDB001A
      ELSE IF (WORD.EQ.'BBCZ') THEN
         CALL GVSTTR ('?PDHDR50',GENRVL(34))
      ELSE IF (WORD.EQ.'NMRTAB') THEN
         CALL PDB006
      ELSE IF (WORD.EQ.'INOUT') THEN
         CALL GVSTTR ('?R00210',GENRVL(36))
      ELSE IF (WORD.EQ.'PH') THEN
         IF (GENIVL(9).GT.0) CALL GVSTTI ('?R00253',GENIVL(9))
         IF (GENIVL(9).GT.0.AND.GENIVL(10).GT.0) CALL TEXTXT (' ')
         IF (GENIVL(10).GT.0) CALL GVSTTI ('?R00254',GENIVL(10))
      ELSE
         CALL GVSTTE ('?PDB012')
         CALL GVSTT6 (WORD)
         CALL GVSKIL
      END IF
      GOTO 999



  998 CONTINUE
      CALL GVSEIW ('PDB099')



 999  CONTINUE


      RETURN
      END
      SUBROUTINE PDB001



















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INCLUDE       'RESULT.INC'
      REAL          R
      LOGICAL       HASPROTEIN
      CHARACTER*10  Q







      IF (HASPROTEIN()) THEN
         CALL TEXTXT (' ')
         CALL GVSTT6 ('?PDHDR39')
      END IF
      CALL TEXTXT (' ')



         CALL TEXTXT ('\\begin{tabular}{lrc}')




      IF (GENRVL(1).LT.-3.0) THEN
         Q='bad'
      ELSE IF (GENRVL(1).LT.-2.0) THEN
         Q='poor'
      ELSE
         Q=' '
      END IF
      IF (GENRVL(1).GT.-900.)
     +     CALL PDB002 ('?PDHDR44',(GENRVL(1)+0.5)/0.4,Q)



      IF (GENRVL(15).LT.-4.0) THEN
         CALL GVSSTX (Q,'bad')
      ELSE IF (GENRVL(15).LT.-3.0) THEN
         CALL GVSSTX (Q,'poor')
      ELSE
         Q=' '
      END IF
      IF (GENRVL(15).GT.-900.) CALL PDB002 ('?PDHDR42',GENRVL(15),Q)



      IF (GENRVL(29).LT.-4.0) THEN
         CALL GVSSTX (Q,'bad')
      ELSE IF (GENRVL(29).LT.-3.0) THEN
         CALL GVSSTX (Q,'poor')
      ELSE
         Q=' '
      END IF
      IF (GENRVL(29).GT.-900.) CALL PDB002 ('?PDHDR45',GENRVL(29),Q)



      IF (GENRVL(31).LT.-4.0) THEN
         CALL GVSSTX (Q,'bad')
      ELSE IF (GENRVL(31).LT.-3.0) THEN
         CALL GVSSTX (Q,'poor')
      ELSE
         Q=' '
      END IF
      IF (GENRVL(31).GT.-900.) CALL PDB002 ('?PDHDR46',GENRVL(31),Q)



      IF (GENRVL(34).LT.-4.0) THEN
         CALL GVSSTX (Q,'bad')
      ELSE IF (GENRVL(34).LT.-3.0) THEN
         CALL GVSSTX (Q,'poor')
      ELSE
         Q=' '
      END IF
      IF (GENRVL(34).GT.-900.) CALL PDB002 ('?PDHDR51',GENRVL(34),Q)



      IF (WIFPAR(1294).NE.0) THEN
         IF (GENRVL(48).GT.0.01) CALL GVSSTX (Q,'poor')
         IF (GENRVL(48).GT.0.1) CALL GVSSTX (Q,'bad')
         CALL PDB002 ('?PDHDR59',GENRVL(47),Q)
         CALL PDB002 ('?PDHDR60',GENRVL(48),Q)
      END IF






         CALL TEXTXT ('\\end{tabular}')




      CALL GVSNL6 (1)
      CALL TEXTXT (' ')
      CALL GVSTT6 ('?PDHDR40')
      CALL TEXTXT (' ')



         CALL TEXTXT ('\\begin{tabular}{lrc}')




      IF (GENRVL(8).LT.0.666) THEN
         CALL GVSSTX (Q,'tight')
      ELSE IF (GENRVL(8).GT.1.5) THEN
         CALL GVSSTX (Q,'loose')
      ELSE
         Q=' '
      END IF
      IF (GENRVL(8).GT.-900.) CALL PDB002 ('?PDHDR47',GENRVL(8),Q)



      IF (GENRVL(20).LT.0.666) THEN
         CALL GVSSTX (Q,'tight')
      ELSE IF (GENRVL(20).GT.2.0) THEN
         CALL GVSSTX (Q,'loose')
      ELSE
         Q=' '
      END IF
      IF (GENRVL(20).GT.-900.) CALL PDB002 ('?PDHDR48',GENRVL(20),Q)



      IF (GENRVL(30).LT.4.0) THEN
         CALL GVSSTX (Q,'tight')
      ELSE IF (GENRVL(30).GT.7.0) THEN
         CALL GVSSTX (Q,'loose')
      ELSE
         Q=' '
      END IF
      IF (GENRVL(30).GT.-900.) CALL PDB002 ('?PDHDR43',GENRVL(30)/5.5,Q)



      IF (GENIVL(6)+GENIVL(7).GT.0) THEN
         R=GENIVL(6)*GENRVL(32)**2+GENIVL(7)*GENRVL(33)**2
         R=SQRT(R/(GENIVL(6)+GENIVL(7)))
         IF (R.LT.0.666) THEN
            Q='tight'
         ELSE IF (R.GT.2.0) THEN
            Q='loose'
         ELSE
            Q=' '
         END IF
         CALL PDB002 ('?PDHDR49',R,Q)
      END IF



      IF (GENRVL(35).GT.0.0) THEN
         IF (GENRVL(35).GT.1.5) THEN
            Q='loose'
         ELSE
            Q=' '
         END IF
         CALL PDB002 ('?PDHDR54',GENRVL(35),Q)
      END IF



      IF (GENRVL(7).GT.1.5) THEN
         Q='loose'
      ELSE
         Q=' '
      END IF
      IF (GENRVL(7).GT.0.0) CALL PDB002 ('?PDHDR52',GENRVL(7),Q)



      IF (GENRVL(36).GT.1.16) THEN
         Q='unusual'
      ELSE
         Q=' '
      ENDIF 
      IF (GENRVL(36).GT.0.0) CALL PDB002 ('?PDHDR55',GENRVL(36),Q)




         CALL TEXTXT ('\\end{tabular}')






      RETURN
      END
      SUBROUTINE PDB001A



















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INCLUDE       'RESULT.INC'
      CHARACTER*10  Q
      REAL          R, AVE, STD







      CALL TEXTXT (' ')
      CALL GVSTT6 ('?PDHDR39')
      CALL TEXTXT (' ')



         CALL TEXTXT ('\\begin{tabular}{lrc}')




      IF (GENRVL(1).GT.-900.) THEN
         R=(GENRVL(1)+0.5)/0.4
         CALL PDB005 (AVE,STD,1)
         R=(R-AVE)/STD
         IF (R.LT.-4.0) THEN
            Q='bad'
         ELSE IF (GENRVL(1).LT.-3.0) THEN
            Q='poor'
         ELSE
            Q=' '
         END IF
         CALL PDB002A ('?PDHDR44',R,Q)
      END IF



      IF (GENRVL(15).GT.-900.) THEN
         CALL PDB005 (AVE,STD,2)
         R=(GENRVL(15)-AVE)/STD
         IF (R.LT.-4.0) THEN
            Q='bad'
         ELSE IF (R.LT.-3.0) THEN
            Q='poor'
         ELSE
            Q=' '
         END IF
         CALL PDB002A ('?PDHDR42',R,Q)
      END IF



      IF (GENRVL(29).GT.-900.) THEN
         CALL PDB005 (AVE,STD,3)
         R=(GENRVL(29)-AVE)/STD
         IF (R.LT.-4.0) THEN
            Q='bad'
         ELSE IF (R.LT.-3.0) THEN
            Q='poor'
         ELSE
            Q=' '
         END IF
         CALL PDB002A ('?PDHDR45',R,Q)
      END IF



      IF (GENRVL(31).GT.-900.) THEN
         CALL PDB005 (AVE,STD,4)
         R=(GENRVL(31)-AVE)/STD
         IF (R.LT.-4.0) THEN
            Q='bad'
         ELSE IF (R.LT.-3.0) THEN
            Q='poor'
         ELSE
            Q=' '
         END IF
         CALL PDB002A ('?PDHDR46',R,Q)
      END IF



      IF (GENRVL(34).GT.-900.) THEN
         CALL PDB005 (AVE,STD,5)
         R=(GENRVL(34)-AVE)/STD
         IF (R.LT.-4.0) THEN
            Q='bad'
         ELSE IF (R.LT.-3.0) THEN
            Q='poor'
         ELSE
            Q=' '
         END IF
         CALL PDB002A ('?PDHDR51',R,Q)
      END IF



      IF (WIFPAR(1294).NE.0) THEN
         IF (GENRVL(48).GT.0.01) CALL GVSSTX (Q,'poor')
         IF (GENRVL(48).GT.0.1) CALL GVSSTX (Q,'bad')
         CALL PDB002 ('?PDHDR59',GENRVL(47),Q)
         CALL PDB002 ('?PDHDR60',GENRVL(48),Q)
      END IF






         CALL TEXTXT ('\\end{tabular}')




      CALL GVSNL6 (1)
      CALL TEXTXT (' ')
      CALL GVSTT6 ('?PDHDR40')
      CALL TEXTXT (' ')



         CALL TEXTXT ('\\begin{tabular}{lrc}')




      IF (GENRVL(8).LT.0.666) THEN
         Q='tight'
      ELSE IF (GENRVL(8).GT.1.5) THEN
         Q='loose'
      ELSE
         Q=' '
      END IF
      IF (GENRVL(8).GT.-900.) CALL PDB002 ('?PDHDR47',GENRVL(8),Q)



      IF (GENRVL(20).LT.0.666) THEN
         Q='tight'
      ELSE IF (GENRVL(20).GT.2.0) THEN
         Q='loose'
      ELSE
         Q=' '
      END IF
      IF (GENRVL(20).GT.-900.) CALL PDB002 ('?PDHDR48',GENRVL(20),Q)



      IF (GENRVL(30).LT.4.0) THEN
         Q='tight'
      ELSE IF (GENRVL(30).GT.7.0) THEN
         Q='loose'
      ELSE
         Q=' '
      END IF
      IF (GENRVL(30).GT.-900.) CALL PDB002 ('?PDHDR43',GENRVL(30)/5.5,Q)



      IF (GENIVL(6)+GENIVL(7).GT.0) THEN
         R=GENIVL(6)*GENRVL(32)**2+GENIVL(7)*GENRVL(33)**2
         R=SQRT(R/(GENIVL(6)+GENIVL(7)))
         IF (R.LT.0.666) THEN
            Q='tight'
         ELSE IF (R.GT.2.0) THEN
            Q='loose'
         ELSE
            Q=' '
         END IF
         CALL PDB002 ('?PDHDR49',R,Q)
      END IF



      IF (GENRVL(35).GT.0.0) THEN
         IF (GENRVL(35).GT.1.5) THEN
            Q='loose'
         ELSE
            Q=' '
         END IF
         CALL PDB002 ('?PDHDR54',GENRVL(35),Q)
      END IF



      IF (GENRVL(7).GT.1.5) THEN
         Q='loose'
      ELSE
         Q=' '
      END IF
      IF (GENRVL(7).GT.0.) CALL PDB002 ('?PDHDR52',GENRVL(7),Q)



      IF (GENRVL(36).GT.1.16) THEN
         Q='unusual'
      ELSE
         Q=' '
      ENDIF 
      IF (GENRVL(36).GT.0.0) CALL PDB002 ('?PDHDR55',GENRVL(36),Q)



         CALL TEXTXT ('\\end{tabular}')




      IF (GENRVL(8).GT.3.0.OR.GENRVL(20).GT.3.0.OR.GENRVL(32).GT.3.0.OR.
     +    GENRVL(33).GT.3.0.OR.GENRVL(35).GT.3.0) THEN
         WIFPAR(942)=WIFPAR(942)+1
      END IF





      RETURN
      END
      SUBROUTINE PDB002 (S,R,Q)



















      IMPLICIT      NONE
      CHARACTER*80  L1,L2
      CHARACTER*(*) S,Q
      REAL          R
      INTEGER       GVFLEN





      CALL GVSSTX (L1,S)
      IF (GVFLEN(Q).GT.0) THEN
         WRITE (L2,1000,ERR=999) L1(1:GVFLEN(L1)),R,Q(1:GVFLEN(Q))
      ELSE
         WRITE (L2,1000,ERR=999) L1(1:GVFLEN(L1)),R
      END IF
      CALL NOTEXTXT (L2)

      IF (GVFLEN(Q).GT.0) THEN
         WRITE (L2,1020,ERR=999) L1(1:GVFLEN(L1)),R,Q(1:GVFLEN(Q))
      ELSE
         WRITE (L2,1010,ERR=999) L1(1:GVFLEN(L1)),R
      END IF
      CALL TEXTXT (L2)
      GOTO 998



  999 CONTINUE
      CALL GVSEIW ('PDB002')



  998 CONTINUE


 1000 FORMAT (A,F8.3,:,' (',A,')')




 1010    FORMAT (A,'&',F8.3,'\\\\')
 1020    FORMAT (A,'&',F8.3,'& (',A,')\\\\')


      RETURN
      END
      SUBROUTINE PDB002A (S,R,Q)



















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      CHARACTER*80  L1,L2
      CHARACTER*(*) S,Q
      REAL          R
      INTEGER       GVFLEN







      IF (R.LT.-2.0) WIFPAR(942)=WIFPAR(942)+1
      IF (R.LT.-3.0) WIFPAR(942)=WIFPAR(942)+1

      CALL GVSSTX (L1,S)
      IF (GVFLEN(Q).GT.0) THEN
         WRITE (L2,1000,ERR=999) L1(1:GVFLEN(L1)),R,Q(1:GVFLEN(Q))
      ELSE
         WRITE (L2,1000,ERR=999) L1(1:GVFLEN(L1)),R
      END IF
      CALL NOTEXTXT (L2)

      IF (GVFLEN(Q).GT.0) THEN
         WRITE (L2,1020,ERR=999) L1(1:GVFLEN(L1)),R,Q(1:GVFLEN(Q))
      ELSE
         WRITE (L2,1010,ERR=999) L1(1:GVFLEN(L1)),R
      END IF
      CALL TEXTXT (L2)
      GOTO 998



  999 CONTINUE
      CALL GVSTTE ('?R00120')



  998 CONTINUE


 1000 FORMAT (A,F6.1,:,' (',A,')')




 1010    FORMAT (A,'&',F6.1,'\\\\')
 1020    FORMAT (A,'&',F6.1,'& (',A,')\\\\')

      RETURN
      END
      SUBROUTINE PDB003



















      IMPLICIT      NONE
      INCLUDE       'SYMINC.INC'
      INCLUDE       'PDBINC.INC'
      INCLUDE       'RESULT.INC'
      INTEGER       IERR
      REAL          N(3,3), C(6), NEWSCL(3,3), NEWINV(3,3), GVFRTD, 
     +              GVFDTR, XD
      LOGICAL       GVFRIN




      
      N(1,1)=GENRVL(9)
      N(2,2)=GENRVL(10)
      N(3,3)=GENRVL(11)
      N(1,2)=GENRVL(14)
      N(2,1)=GENRVL(14)
      N(1,3)=GENRVL(13)
      N(3,1)=GENRVL(13)
      N(2,3)=GENRVL(12)
      N(3,2)=GENRVL(12)
      CALL PDBHDR ('?PDHDR20')
      CALL TEXTXT (' ')
      CALL GVSWM3 (N)
      CALL GVSCPR (NEWINV,SYMINV,9)
      CALL GVSNX3 (N,NEWINV)
      CALL GVSCPR (NEWINV,N,9)
      CALL GVSMI2 (NEWSCL,NEWINV,3,IERR)
      IF (IERR.NE.0) GOTO 998
      CALL TEXTXT (' ')
      CALL PDBHDR ('?PDHDR22')
      CALL TEXTXT (' ')
      CALL GVSWM3 (NEWSCL)
      CALL CEL004 (NEWSCL,C(1),C(2),C(3),C(4),C(5),C(6))
      C(4)=GVFRTD(C(4))
      C(5)=GVFRTD(C(5))
      C(6)=GVFRTD(C(6))
      CALL TEXTXT (' ')
      CALL PDBHDR ('?PDHDR23')
      CALL TEXTXT (' ')
      CALL CELPRN (C)



      IF (.NOT.GVFRIN(CELDIM(1)/C(1),0.99,1.01).AND.
     +    ABS(CELDIM(1)-C(1)).GT.0.5) THEN
         FIXLST(6)=1.0
      END IF
      IF (.NOT.GVFRIN(CELDIM(2)/C(2),0.99,1.01).AND.
     +    ABS(CELDIM(2)-C(2)).GT.0.5) THEN
         FIXLST(6)=1.0
      END IF
      IF (.NOT.GVFRIN(CELDIM(3)/C(3),0.99,1.01).AND.
     +    ABS(CELDIM(3)-C(3)).GT.0.5) THEN
         FIXLST(6)=1.0
      END IF
      XD=TAN(GVFDTR(CELDIM(4)-C(4)))*MAX(CELDIM(2),CELDIM(3))
      XD=MAX(XD,TAN(GVFDTR(CELDIM(5)-C(5)))*MAX(CELDIM(1),CELDIM(3)))
      XD=MAX(XD,TAN(GVFDTR(CELDIM(6)-C(6)))*MAX(CELDIM(1),CELDIM(2)))
      IF (XD.GT.0.5) FIXLST(6)=1.0



  998 CONTINUE

      
      RETURN
      END
      SUBROUTINE PDB004



















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INCLUDE       'SYMINC.INC'
      REAL          TMPDET, GVFDET, GVFRTD, GVFGTA
      CHARACTER*80  LOCLIN





      CALL GVS3X3 (MAT_1,SYMINV,SYMCEL)
      CALL PDBHDR ('?PDHDR17')
      CALL TEXTXT (' ')
      CALL GVSWM3 (MAT_1)
      TMPDET=GVFDET(MAT_1)
      IF (ABS(TMPDET-1.).LT.0.002) THEN
         CALL GVSFMT ('?PDBFMT2')
         WRITE (LOCLIN,FMT,ERR=998) GVFRTD(GVFGTA(MAT_1))
         CALL GVSTT6 (LOCLIN)
      END IF



 998  CONTINUE


      RETURN
      END
      SUBROUTINE PDB005 (AVE,STD,ICOL)























      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INTEGER       MAXDAT
      PARAMETER     (MAXDAT=200)
      REAL          AVE, STD, X(5), RESOL, CURRES
      INTEGER       ICOL, LUN, IERR, NDAT, IX
      REAL          SUM, SUM2, WIDTH
      LOGICAL       SHRUNK







      AVE=0.0
      STD=2.0
      WIDTH=0.12
      SHRUNK=.FALSE.
      CURRES=0.01*WIFPAR(941)



      IF (CURRES.LE.0.0) THEN
         CALL GVSTTB ('No resolution in PDB005')
         GOTO 998
      END IF
      IF (ICOL.LT.1.OR.ICOL.GT.5) THEN
         CALL GVSTTB ('Illegal column in PDB005')
         GOTO 998
      END IF



      CALL GVSROF (LUN,IERR)
      IF (IERR.NE.0) GOTO 998
      CALL GVSCCC (LINE,WHERIS,'XCALIB.DAT')
      CALL GVSOPF (LINE,LUN,'OLD')
    5 CONTINUE
      NDAT=0
      CALL GVSREW (LUN)
      SUM=0.0
      SUM2=0.0
   10 CONTINUE
      READ (LUN,1000,ERR=999,END=30) RESOL,X
      IF (ABS(RESOL-CURRES).LT.WIDTH) THEN
         IF (X(ICOL).LT.-900.0) GOTO 10
         DO 20 IX=1,5



            IF (X(IX).GT.-900.0.AND.X(IX).LT.-5.0) GOTO 10
   20    CONTINUE



         IF (2*NDAT.EQ.MAXDAT) THEN
            IF (WIDTH.GT.0.056) THEN
               WIDTH=WIDTH*0.8
               SHRUNK=.TRUE.
               GOTO 5
            END IF
         ELSE IF (NDAT.GE.MAXDAT) THEN
            GOTO 30
         END IF
         NDAT=NDAT+1
         SUM=SUM+X(ICOL)
         SUM2=SUM2+X(ICOL)**2
      END IF
      GOTO 10
   30 CONTINUE



      IF (NDAT.LT.50.AND.WIDTH.LT.2.0.AND..NOT.SHRUNK) THEN
         WIDTH=WIDTH*1.2
         GOTO 5
      END IF



      CALL GVSCLF (LUN)
      IF (NDAT.GT.2) THEN
         AVE=SUM/NDAT
         STD=SQRT((SUM2-SUM*SUM/FLOAT(NDAT))/FLOAT(NDAT-1))
         IF (STD.LT.0.1) THEN
            CALL GVSTTE ('Standarddev LOW in PDB005')
            STD=1.0
         END IF
      END IF

      GOTO 998



  999 CONTINUE
      CALL GVSTTE ('Reading XCALIB.DAT')




  998 CONTINUE
      CALL GVSCLF (LUN)


 1000 FORMAT (4X,1X,F6.2,5(1X,F8.3))

      RETURN
      END
      SUBROUTINE PDB006



















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INCLUDE       'PDBINC.INC'
      INTEGER       IMOD, NUMMDL, ISET, IONE
      LOGICAL       GVFIBN







      IF (MAXSETS.LT.1) THEN
         CALL GVSTTB ('?M2396')
         GOTO 998
      END IF
      IF (.NOT.GVFIBN(VALACT,1,MAXSETS)) THEN
         IONE=1
         CALL GVSTTB ('?R00272')
         CALL GVSTTI3 ('?M2395',VALACT,IONE,MAXSETS)
         CALL GVSKIL
         GOTO 998
      END IF



      DO 100 IMOD=1,NUMMDL()
         IF (NMRVAL(1,IMOD).GT.-900.0) THEN
            CALL GVSFMT ('?R00273')
            WRITE (LINE,FMT,ERR=999) IMOD,(NMRVAL(ISET,IMOD),
     +       ISET=1,VALACT)
            CALL GVSTT6 (LINE)
            CALL TEXTXT (' ')
         END IF
 100  CONTINUE
      GOTO 998



  999 CONTINUE
      CALL GVSEIW ('PDB006')



 998  CONTINUE


      RETURN
      END
      SUBROUTINE NOTEXTXT (LIN)



















      IMPLICIT      NONE
      INCLUDE       'PDBINC.INC'
      CHARACTER*(*) LIN
      CHARACTER*3   TMPLEV





      TMPLEV=TEXLEVEL
      TEXLEVEL=' '
      CALL GVSTT6 (LIN)
      TEXLEVEL=TMPLEV





      RETURN
      END
      SUBROUTINE TEXTXT (LIN)






















      IMPLICIT      NONE
      INCLUDE       'PDBINC.INC'
      INTEGER       NSEA
      PARAMETER     (NSEA=14)
      CHARACTER*15  SEA(NSEA),REP(NSEA)
      CHARACTER*(*) LIN
      CHARACTER*132 LOCLIN
      CHARACTER     C
      INTEGER       L, LS, LR, L2, I, J, I2, K, GVFLEN
      LOGICAL       OK, LET
      DATA SEA      /'alpha','beta','gamma','delta','chi','psi','phi',
     +             'omega','epsilon','+/-','Angstrom','...','<','>'/






         DATA REP   /'$\\alpha$','$\\beta$','$\\gamma$','$\\delta$',
     +               '$\\chi$','$\\psi$','$\\phi$','$\\omega$',
     +               '$\\epsilon','$\\pm$','{\\AA}','{\\ldots}',
     +               '$<$','$>$'/








      IF (TEXLEVEL.EQ.' ') GOTO 998
      L=GVFLEN(LIN)
      IF (L.EQ.0) THEN
         WRITE (TEXUNT,1000,ERR=999)
         RETURN
      END IF



      I=1
      L2=0
      CALL GVSCTB (LOCLIN,LEN(LOCLIN))



 5    CONTINUE
         IF (I.GT.L) GOTO 20
         DO 10 J=1,NSEA




            LS=GVFLEN(SEA(J))
            LET=.FALSE.
            DO 30 K=1,LS
               C=SEA(J)(K:K)
               IF (C.GT.'A'.AND.C.LT.'Z') LET=.TRUE.
               IF (C.GT.'a'.AND.C.LT.'z') LET=.TRUE.
   30       CONTINUE



            I2=I+LS-1
            IF (I2.LE.L) THEN
               IF (SEA(J)(1:LS).EQ.LIN(I:I2)) THEN




                  OK=.TRUE.
                  IF (I2.LT.L.AND.LET) THEN
                     C=LIN(I2+1:I2+1)
                     IF (C.GT.'A'.AND.C.LT.'Z') OK=.FALSE.
                     IF (C.GT.'a'.AND.C.LT.'z') OK=.FALSE.
                  END IF
                  IF (I.GT.1.AND.LET) THEN
                     C=LIN(I-1:I-1)
                     IF (C.GT.'A'.AND.C.LT.'Z') OK=.FALSE.
                     IF (C.GT.'a'.AND.C.LT.'z') OK=.FALSE.
                  END IF



                  IF (OK) THEN
                     LR=GVFLEN(REP(J))
                     LOCLIN(L2+1:L2+LR)=REP(J)(1:LR)
                     L2=L2+LR
                     I=I2+1
                     GOTO 5
                  END IF
               END IF
            END IF
 10      CONTINUE
         LOCLIN(L2+1:L2+1)=LIN(I:I)
         L2=L2+1
         I=I+1
         GOTO 5
 20   CONTINUE
      L=L2
      WRITE (TEXUNT,1010,ERR=999) LOCLIN(1:L)
      GOTO 998



 999  CONTINUE
      TEXLEVEL=' '
      WRITE(6,1050)



 998  CONTINUE


 1000 FORMAT()
 1010 FORMAT(A)
 1050 FORMAT (' ERROR. Could not write to TEXUNT in TEXTXT'/,
     +     ' Disk full?')

      RETURN
      END
      SUBROUTINE TEXHDR (LIN)



















      IMPLICIT      NONE
      INCLUDE       'PDBINC.INC'
      CHARACTER*(*) LIN
      INTEGER       L, GVFLEN





      L=GVFLEN(LIN)
      IF (L.GT.0.AND.TEXLEVEL.NE.' ')
     + WRITE (TEXUNT,1010,ERR=999) LIN(1:L)
      GOTO 998



 999  CONTINUE
      TEXLEVEL=' '
      CALL GVSTTE ('?PDB019')



 998  CONTINUE



 1010    FORMAT('\\hdr{',A,'}')




      RETURN
      END
      SUBROUTINE TEXNL

















      IMPLICIT      NONE
      INCLUDE       'PDBINC.INC'







      CALL TEXTXT (' ')
      WRITE (TEXUNT,1000,ERR=998) 



 998  CONTINUE



 1000    FORMAT('\\hdr{  }')




      RETURN
      END
      SUBROUTINE PDBHDR (LIN)



















      IMPLICIT      NONE
      CHARACTER*(*) LIN
      CHARACTER*80  LOCLIN
      INCLUDE       'PDBINC.INC'







      CALL GVSSTX (LOCLIN,LIN)
      CALL PDBHD2 (LOCLIN)
      IF (TEXLEVEL.NE.' ') CALL TEXHDR (LOCLIN)





      RETURN
      END
      SUBROUTINE PDBHD2 (LIN)



















      IMPLICIT      NONE
      INCLUDE       'PDBINC.INC'
      INTEGER       L, GVFLEN
      LOGICAL       GVFFOP
      CHARACTER*(*) LIN
      CHARACTER*80  LOCLIN







      CALL GVSSTX (LOCLIN,LIN)
      L=GVFLEN(LOCLIN)
      WRITE(6,1000,ERR=999) LOCLIN(1:L)
      IF (GVFFOP(PDBUNT)) WRITE (PDBUNT,1000,ERR=999) LOCLIN(1:L)
      GOTO 998



 999  CONTINUE
      CALL GVSTT6 ('?PDB020')



 998  CONTINUE


 1000 FORMAT(1X,A)

      RETURN
      END
      SUBROUTINE TEXHD2 (LIN,LIN2)



















      IMPLICIT      NONE
      INCLUDE       'PDBINC.INC'
      CHARACTER*(*) LIN,LIN2
      CHARACTER*80  LOCLIN, LOCLI2
      INTEGER       L, L2, GVFLEN







      CALL GVSSTX (LOCLIN,LIN)
      CALL GVSSTX (LOCLI2,LIN2)
      L=GVFLEN(LOCLIN)
      L2=GVFLEN(LOCLI2)
      IF (TEXLEVEL.EQ.' ') GOTO 998
      IF (L.EQ.0.OR.L2.EQ.0) THEN
         CALL GVSTTB ('?NEWB162')
      END IF
      WRITE (TEXUNT,1010,ERR=999) LOCLIN(1:L),LOCLI2(1:L2)
      GOTO 998



 999  CONTINUE
      TEXLEVEL=' '
      CALL GVSTTE ('?PDB021')



 998  CONTINUE



 1010    FORMAT ('\\hdrhdr{',A,'}{',A,'}')




      RETURN
      END
      SUBROUTINE TEXVER (STR)



















      IMPLICIT      NONE
      INTEGER       I1, I2, I3
      CHARACTER*(*) STR
      CHARACTER*120 LOCAL
      INTEGER       I, J, GVFLEN
      CHARACTER*3   SPC

         DATA SPC /'^~\\'/                                              













      IF (STR(2:8).EQ.'chapter') GOTO 998
      IF (STR(2:8).EQ.'section') GOTO 998
      LOCAL=STR
      J=0
      DO 10 I=1,GVFLEN(LOCAL)
         IF (INDEX('$&%#_{}',LOCAL(I:I)).GT.0) THEN
            J=J+1
            IF (J.GT.LEN(STR)) GOTO 998
            STR(J:J)=SPC(3:3)
         ELSE IF (INDEX('<|>',LOCAL(I:I)).GT.0) THEN
            J=J+3
            IF (J.GT.LEN(STR)) GOTO 998
            STR(J-2:J-2)='$'
            STR(J-1:J-1)=LOCAL(I:I)
            STR(J:J)='$'
            GOTO 10
         ELSE IF (INDEX(SPC,LOCAL(I:I)).GT.0) THEN
            I1=0
            I2=INDEX(SPC,LOCAL(I:I))
            I3=0
            IF (I.GT.1) I1=INDEX(SPC,LOCAL(I-1:I-1))
            IF (I.LT.GVFLEN(LOCAL)) I3=INDEX(SPC,LOCAL(I+1:I+1))
            IF (I2.EQ.3.AND.(I1.NE.I2.AND.I2.NE.I3)) LOCAL(I:I)='-'
         END IF
         J=J+1
         IF (J.GT.LEN(STR)) GOTO 998
         STR(J:J)=LOCAL(I:I)
 10   CONTINUE



 998  CONTINUE


      RETURN
      END
      SUBROUTINE RHNO61 (STR)



















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INTEGER       GVFLEN, L
      CHARACTER*(*) STR




 
      L=GVFLEN(FILNMS(61))
      IF (GVFLEN(STR).LE.L) GOTO 998
      IF (STR(1:L).EQ.FILNMS(61)) THEN
         STR=STR(L+1:)
      END IF



 998  CONTINUE


      RETURN
      END
      SUBROUTINE TEXSTORE (STR)



















      IMPLICIT      NONE
      CHARACTER*(*) STR
      CHARACTER*80  LOCSTR, OLOCSTR
      LOGICAL       GVFFOP
      INTEGER       GVFLEN
      SAVE          OLOCSTR
      DATA OLOCSTR  /' '/







      IF (.NOT.GVFFOP(80)) THEN
         CALL GVSOPF ('TEXSTORE.DAT',80,'UNKNOWN')
      END IF
      IF (.NOT.GVFFOP(80)) GOTO 998
      LOCSTR=STR



      CALL RHNO61 (LOCSTR)
      CALL TEXVER (LOCSTR)



      IF (LOCSTR.EQ.OLOCSTR) GOTO 998
      OLOCSTR=LOCSTR



      WRITE (80,1000,ERR=999) LOCSTR(1:GVFLEN(LOCSTR))
      GOTO 998



 999  CONTINUE
      CALL GVSTTE ('Could not write to TEXSTORE.DAT')



 998  CONTINUE


 1000 FORMAT (A)

      RETURN
      END
      SUBROUTINE TEXSUN





















      IMPLICIT      NONE
      LOGICAL       WITHIN
      COMMON /TEXUNIT/ WITHIN





      IF (WITHIN) THEN
         CALL GVSTTB ('?PDB023')
         GOTO 998
      END IF
      WITHIN=.TRUE.
      CALL TEXTXT (' ')



 998  CONTINUE



         CALL TEXTXT ('\\parbox{1\\textwidth}{')




      RETURN
      END
      SUBROUTINE TEXEUN



















      IMPLICIT      NONE
      LOGICAL       WITHIN
      COMMON /TEXUNIT/ WITHIN





      IF (.NOT.WITHIN) GOTO 998
      WITHIN=.FALSE.
      CALL TEXTXT ('}% End of ParBox')
      CALL TEXTXT (' ')



 998  CONTINUE


      RETURN
      END
      SUBROUTINE PDBTT6 (LIN)



















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INCLUDE       'PDBINC.INC'
      CHARACTER*(*) LIN
      LOGICAL       GVFFOP







      IF (WIFPAR(1296).NE.0.OR.WIFPAR(318).NE.0.OR.WIFPAR(279).LE.0) 
     + GOTO 998
      IF (.NOT.GVFFOP(79)) THEN
         CALL GVSTTE ('?M4622')
         CALL GVST6C ('While printing:',LIN(1:MIN(60,LEN(LIN))),.TRUE.)
         CALL GVSKIL
         GOTO 998
      END IF



      CALL GVSTTU (79,LIN)
      TABANY=.TRUE.



 998  CONTINUE


      RETURN
      END
      SUBROUTINE PDBTTI (LIN,VAL)



















      IMPLICIT      NONE
      CHARACTER*(*) LIN
      CHARACTER*80  TMP
      INTEGER       VAL, GVFLEN





      WRITE (TMP,1000,ERR=999) LIN(1:MIN(70,GVFLEN(LIN))),VAL
      CALL GVSRDB (TMP)
      CALL PDBTT6 (TMP)
      GOTO 998



 999  CONTINUE
      CALL GVSEIW ('PDBTTI')



 998  CONTINUE


 1000 FORMAT (A,1X,I10)

      RETURN
      END
      SUBROUTINE PDBTAB (LIN)



















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INCLUDE       'PDBINC.INC'
      CHARACTER*(*) LIN
      INTEGER       GVFLEN
      LOGICAL       GVFFOP







      IF (WIFPAR(279).LE.0) RETURN
      IF (WIFPAR(1296).NE.0.OR.WIFPAR(318).NE.0) GOTO 998
      IF (GVFLEN(LIN).GT.100) THEN
         CALL GVSTTB ('?PDB027')
         GOTO 998
      END IF
      IF (GVFFOP(79)) THEN
         CALL GVSTTB ('?PDB026')
         CALL GVSCLF (79)
         CALL GVSKIL
         GOTO 998
      END IF



      CALL GVSSTX (TABHED,LIN)
      PDBTLN=WIFPAR(593)
      CALL GVSOPF ('TEXTABLE.DAT',79,'UNKNOWN')
      TABANY=.FALSE.
      TABCOLHED=' '



 998  CONTINUE


      RETURN
      END
      SUBROUTINE PDBTCH (COLHED)



















      IMPLICIT      NONE
      INCLUDE       'PDBINC.INC'
      CHARACTER*(*) COLHED





      TABCOLHED=COLHED





      RETURN
      END
      SUBROUTINE PDBSTL (LENB)



















      IMPLICIT      NONE
      INCLUDE       'PDBINC.INC'
      INTEGER       LENB





      PDBTLN=MAX(1,LENB)





      RETURN
      END
      SUBROUTINE PDBTND (IERR)



















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INCLUDE       'PDBINC.INC'
      INTEGER       IERR
      LOGICAL       GVFFOP







      IF (WIFPAR(279).LE.0) GOTO 998
      IF (.NOT.GVFFOP(79).OR.(.NOT.TABANY)) THEN
         IERR=1
         TABANY=.FALSE.
      ELSE
         IERR=0
      END IF



      CALL GVSCLF (79)



 998  CONTINUE


      RETURN
      END
      SUBROUTINE PDBOTB



















      IMPLICIT      NONE
      INCLUDE       'PDBINC.INC'
      INCLUDE       'BIGINC.INC'
      INTEGER       NUM, GVFLEN
      LOGICAL       GVFFOP
      CHARACTER*3   TMPLEV
      CHARACTER*132 LOCLIN, UNTEXL, ELINE







      IF (.NOT.TABANY) GOTO 997



      CALL GVSOPF ('TEXTABLE.DAT',79,'OLD')
      IF (.NOT.GVFFOP(79)) THEN
         CALL GVSTTE ('?M4907')
         GOTO 997
      END IF



      CALL TEXTXT (' ')
      WRITE (LOCLIN,1010,ERR=999) TABHED(1:GVFLEN(TABHED))
      CALL GVSSTX (ELINE,LOCLIN)
      CALL TEXTXT (ELINE)



      IF (GVFLEN(TABCOLHED).GT.0) THEN 
         CALL SHOWTEXTTEX (TABCOLHED)
      END IF



      NUM=0
 1    CONTINUE
      READ (79,1040,END=2,ERR=999) LOCLIN
      NUM=NUM+1
      GOTO 1
 2    CONTINUE
      CALL GVSREW (79)



      IF (NUM.GT.PDBTLN) PDBTLN=(PDBTLN+1)/2



      NUM=0
 10   CONTINUE
      READ (79,1040,END=100,ERR=999) LOCLIN
      NUM=NUM+1



      IF (NUM.LE.PDBTLN) THEN



         CALL GVSSTX (ELINE,LOCLIN)
         CALL TEXTXT (ELINE)



         CALL PDBUTX (UNTEXL,LOCLIN)



         TMPLEV=TEXLEVEL
         TEXLEVEL=' '



         CALL PDBGUTX (UNTEXL)
         CALL GVSTT6 (UNTEXL)



         TEXLEVEL=TMPLEV
      END IF
      GOTO 10
 100  CONTINUE
      WRITE (LOCLIN,1000,ERR=998)
      CALL TEXTXT (LOCLIN)



      IF (NUM.GT.PDBTLN) THEN
         CALL GVSFMT ('?PDBFMT1')
         WRITE (LOCLIN,FMT,ERR=998) NUM
         CALL GVSTT6 (LOCLIN)
      END IF



      CALL GVSCTB (TABHED,80)
      CALL GVSCLF (79)
      CALL GVSDEL ('TEXTABLE.DAT')
      GOTO 997



 998  CONTINUE
      CALL GVSEIW ('PDBOTB')
      GOTO 997
 999  CONTINUE
      CALL GVSTTE ('?M4908')



 997  CONTINUE






 1000    FORMAT ('\\end{supertabular}\\end{center}')
 1010    FORMAT ('\\begin{center}\\begin{supertabular}{',a,'}')

 1040 FORMAT (A)

      RETURN
      END
      SUBROUTINE PDBGUTX (UNTEXL)

















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INTEGER       GVFLEN, LENU, I
      CHARACTER*(*) UNTEXL







      IF (LEN(UNTEXL).LE.0) GOTO 998



      LENU=GVFLEN(UNTEXL)



      DO 10 I=1,LENU
         IF (UNTEXL(I:I).EQ.'$') UNTEXL(I:I)=' '
 10   CONTINUE
      DO 20 I=1,LENU-5
         IF (UNTEXL(I:I+5).EQ.'hspace') CALL GVSCTB (UNTEXL(I:I+5),6)
         IF (UNTEXL(I:I+5).EQ.'vspace') CALL GVSCTB (UNTEXL(I:I+5),6)
 20   CONTINUE



  998 CONTINUE


      RETURN
      END   
      SUBROUTINE PDBUTX (OUT,IN)



















      IMPLICIT      NONE
      INCLUDE       'PDBINC.INC'
      INCLUDE       'BIGINC.INC'
      CHARACTER*(*) IN,OUT
      INTEGER       I, J, K, L, IBS, ICB, ICH, GVFLEN
      LOGICAL       COPY
      CHARACTER     BS







      CALL GVSCTB (OUT,LEN(OUT))
      L=GVFLEN(IN)
      J=0
      K=1
      COPY=.TRUE.



         BS='\\'

      IBS=ICHAR(BS)
      ICB=ICHAR('}')



      CALL TEXBCL (TABHED,K,OUT,J)
      DO 10 I=1,L
         ICH=ICHAR(IN(I:I))
         IF (ICH.EQ.ICHAR('{')) THEN
            COPY=.FALSE.
         ELSE IF (ICH.EQ.ICHAR(' ')) THEN
            IF (.NOT.COPY) THEN
               COPY=.TRUE.
               GOTO 10
            END IF
         END IF
         IF (ICH.EQ.ICHAR('&')) THEN
            K=K+1
            IF (TABHED(K:K).EQ.'|') K=K+1
            IF (TABHED(K:K+1).EQ.'@{') THEN



               CALL TEXBCL (TABHED,K,OUT,J)
            ELSE
               J=J+1
               OUT(J:J)=' '
            END IF
         ELSE IF (COPY.AND.ICH.NE.IBS.AND.ICH.NE.ICB) THEN
            J=J+1
            OUT(J:J)=IN(I:I)
         END IF
 10   CONTINUE
      IF (K+3.LE.LEN(TABHED)) THEN
         K=K+1



         CALL TEXBCL (TABHED,K,OUT,J)
      END IF





      RETURN
      END
      SUBROUTINE TEXBCL (TABHED,K,OUT,J)



















      IMPLICIT      NONE
      CHARACTER*(*) TABHED,OUT
      INTEGER       J,K
      CHARACTER     BS








         BS='\\'

      IF (TABHED(K:K+1).NE.'@{') GOTO 998
      K=K+2
 10   CONTINUE
      IF (TABHED(K:K).EQ.BS.AND.TABHED(K+1:K+1).EQ.',') THEN
         J=J+1
         OUT(J:J)=' '
         K=K+2
         GOTO 10
      ELSE IF (TABHED(K:K).EQ.'}') THEN
         K=K+1
      ELSE
         J=J+1
         OUT(J:J)=TABHED(K:K)
         K=K+1
         GOTO 10
      END IF



 998  CONTINUE


      RETURN
      END
      SUBROUTINE RHSSRP (STR,IN,OUT)









      IMPLICIT      NONE 
      CHARACTER*(*) STR,IN,OUT
      INTEGER       I, IST, IEND, GVFPOS, LOLI, L, GVFLEN







      IF (LEN(IN).LE.0.OR.LEN(OUT).LE.0.OR.LEN(STR).LE.0) THEN
         CALL GVSTTE ('Zero length argument to RHSSRP')
         GOTO 998
      END IF



      LOLI=LEN(OUT)-LEN(IN)
      L=GVFLEN(STR)



 100  CONTINUE
         IST=GVFPOS(STR,IN)
         IF (IST.EQ.0) GOTO 998
         IF (L+LOLI.GT.LEN(STR)) THEN
            CALL GVSTTE ('String would overflow in RHSSRP')
            GOTO 998
         END IF
         IEND=IST+LEN(IN)
         IF (LOLI.GT.0) THEN
            DO 10 I=L,IEND,-1
               STR(I+LOLI:I+LOLI)=STR(I:I)
 10         CONTINUE
         ELSE IF (LOLI.LT.0) THEN
            DO 20 I=IEND,L
               STR(I+LOLI:I+LOLI)=STR(I:I)
 20         CONTINUE
         END IF
         DO 30 I=IST,IEND-1
            STR(I:I)=OUT(I-IST+1:I-IST+1)
 30      CONTINUE
         L=L+LOLI
      GOTO 100



 998  CONTINUE


      RETURN
      END
      SUBROUTINE SCATTEX



















      IMPLICIT      NONE 
      INCLUDE       'BIGINC.INC'
      INTEGER       SCATNUM
      SAVE          SCATNUM
      DATA SCATNUM /0/







      IF (WIFPAR(473).GE.1) GOTO 998



      SCATNUM=SCATNUM+1




         CALL GVSSTX(LINE,'fig2dev')
         WRITE (BIGLIN,1000,ERR=999) LINE,SCATNUM
 1000    FORMAT('cat SCATTER.fig | ',
     +    A,' -Leps -p x > sct',i4.4,'.eps')

      CALL GVSSPL (BIGLIN)
      WRITE (BIGLIN,1010,ERR=999) SCATNUM
      CALL TEXTXT (BIGLIN)
      GOTO 998



 999  CONTINUE
      CALL GVSEIW ('SCATTEX')



 998  CONTINUE





 1010 FORMAT('\\bsplot{sct',i4.4,'.eps}')


      RETURN
      END

      SUBROUTINE SCTPRP (IFT1,IFT2,INTEXT,INARG)



















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INCLUDE       'HSTINC.INC'
      CHARACTER*(*) INTEXT, INARG
      CHARACTER*132 SCTARG
      CHARACTER*80  TEXT
      CHARACTER*1   HST
      INTEGER       IUNIT, IFT1, IFT2, GVFLEN, IAA, IERR, SMOOTH
      REAL          SY, EY, VY
      LOGICAL       APPEND





      IF (WIFPAR(932).GT.0.OR.WIFPAR(473).GE.1) GOTO 998

      CALL SCTPARSE (INARG, SCTARG, SMOOTH, SY, EY)
      CALL GVSROF (IUNIT,IERR)
      IF (IERR.NE.0) GOTO 998
      CALL GVSOPF ('SCATTER.DAT',IUNIT,'UNKNOWN')



      IF (SY.EQ.0.0.AND.EY.EQ.0.0) THEN
         SY=999.9
         EY=-999.9
         DO 10 IAA=IFT1,IFT2
            IF (PRPVAL(IAA).GT.-999.0) THEN
               SY=MIN(SY,PRPVAL(IAA))
               EY=MAX(EY,PRPVAL(IAA))
            END IF
 10      CONTINUE
         VY=EY*1.03-SY*0.03
         EY=VY
      ELSE
         VY=EY
      END IF



      APPEND=.FALSE.
      DO 20 IAA=IFT1,IFT2
         IF (PRPVAL(IAA).GT.-999.0) THEN
            IF (HSTDON) THEN
               HST=LOCHST(IAA)
               IF (HST.EQ.' ') HST='C'
            ELSE
               HST='-'
            END IF
            WRITE (IUNIT,1010,ERR=999) IAA, PRPVAL(IAA), VY, HST
         END IF
 20   CONTINUE
      CALL GVSCLF (IUNIT)



      IF (HSTDON) THEN
         CALL GVSOPF ('SCATTER.SCC',IUNIT,'UNKNOWN')
         WRITE (IUNIT,1000,ERR=999) SY, EY, SCTARG(1:GVFLEN(SCTARG))
         WRITE (IUNIT,1030,ERR=999) IFT1, IFT2
         CALL GVSCLF (IUNIT)



            CALL GVSCCC (BIGLIN,FILDIR(11),'scatter @SCATTER.SCC')

         CALL GVSSPL (BIGLIN)
         APPEND=.TRUE.
      END IF



      CALL GVSOPF ('SCATTER.SCC',IUNIT,'UNKNOWN')
      IF (GVFLEN(INTEXT).EQ.0) THEN
         CALL GVSSTX (TEXT,'?M4618')
      ELSE
         CALL GVSSTX (TEXT,INTEXT)
      END IF
      WRITE (IUNIT,1020,ERR=999) TEXT, SY, EY, SCTARG(1:GVFLEN(SCTARG))
      WRITE (IUNIT,1030,ERR=999) IFT1, IFT2
      IF (SMOOTH.GT.0) WRITE (IUNIT,1040,ERR=999) SMOOTH
      IF (APPEND) WRITE (IUNIT,1050,ERR=999)

      CALL GVSCLF (IUNIT)



         CALL GVSCCC (BIGLIN,FILDIR(11),'scatter @SCATTER.SCC')

      CALL GVSSPL (BIGLIN)
      GOTO 998



 999  CONTINUE
      CALL GVSEIW ('SCTPRP')



 998  CONTINUE


 1000 FORMAT ('NOTEXT FILE SCATTER.DAT'/,
     +        'AXDIV 80 SY ',F10.5,' EY ',F10.5/,
     +        'NX 1 NY 3 SECSTR 4 RAD 0.8'/,
     +        A/,
     +        'LIN 0 WI 18 HI 12')
 1010 FORMAT (I5,1X,F10.5,1X,F10.5,1X,A1)
 1020 FORMAT ('XTEXT'/,
     +        'WHOLE Residue number'/,
     +        'YTEXT '/,
     +        'WHOLE ',A/,
     +        'SY ',F10.5,' EY ',F10.5,/,
     +        'NOTITLE FULLNUM ',A,/,
     +        'FILE SCATTER.DAT AXDIV 80 WI 18 HI 12')
 1030 FORMAT ('SX ',I4,' EX ',I4)
 1040 FORMAT ('SMOOTH ',I4)
 1050 FORMAT ('APPEND')

      RETURN
      END
      SUBROUTINE SCTMDL (MDLPRP,TAG,NMODEL,INARG,INTEXT)



















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INTEGER       NMODEL, IMODEL
      INTEGER       TAG(NMODEL), IUNIT, IERR, GVFLEN 
      REAL          MDLPRP(*), SY, EY
      CHARACTER*(*) INARG, INTEXT
      CHARACTER*132 SCTARG, TEXT
      INTEGER       SMOOTH





      IF (WIFPAR(932).GT.0.OR.WIFPAR(473).GE.1) GOTO 998

      CALL SCTPARSE (INARG, SCTARG, SMOOTH, SY, EY)
      IF (SMOOTH.GT.1) CALL GVSTTB ('?M4619')
      CALL GVSROF (IUNIT,IERR)
      IF (IERR.NE.0) GOTO 998
      CALL GVSOPF ('SCATTER.DAT',IUNIT,'UNKNOWN')



      IF (SY.EQ.0.0.AND.EY.EQ.0.0) THEN
         SY=999.9
         EY=-999.9
         DO 10 IMODEL=1,NMODEL
            IF (MDLPRP(TAG(IMODEL)).GT.-999.0) THEN
               SY=MIN(SY,MDLPRP(TAG(IMODEL)))
               EY=MAX(EY,MDLPRP(TAG(IMODEL)))
            END IF
 10      CONTINUE
      END IF



      DO 20 IMODEL=1,NMODEL
         WRITE (IUNIT,1010,ERR=999) IMODEL, MDLPRP(TAG(IMODEL))
 20   CONTINUE
      CALL GVSCLF (IUNIT)



      CALL GVSOPF ('SCATTER.SCC',IUNIT,'UNKNOWN')
      IF (GVFLEN(INTEXT).EQ.0) THEN
         CALL GVSSTX (TEXT,'?M4618')
      ELSE
         CALL GVSSTX (TEXT,INTEXT)
      END IF
      WRITE (IUNIT,1020,ERR=999) TEXT, SY, EY, SCTARG(1:GVFLEN(SCTARG))
      CALL GVSCLF (IUNIT)






         CALL GVSCCC (BIGLIN,FILDIR(11),'scatter @SCATTER.SCC')

      CALL GVSSPL (BIGLIN)
      GOTO 998



 999  CONTINUE
      CALL GVSEIW ('SCTMDL')



 998  CONTINUE


 1010 FORMAT (I5,1X,F10.5)
 1020 FORMAT ('XTEXT'/,
     +        'WHOLE Model number'/,
     +        'YTEXT '/,
     +        'WHOLE ',A/,
     +        'SY ',F10.5,' EY ',F10.5,/,
     +        'NOTITLE FULLNUM Y=0 SX 0',A,/,
     +        'FILE SCATTER.DAT AXDIV 80 WI 18 HI 12 RA .5 DOT 7')

      RETURN
      END
      SUBROUTINE SCTPARSE (INTEXT, SCTARG, SMOOTH, SY, EY)



















      IMPLICIT      NONE
      CHARACTER*(*) SCTARG,INTEXT
      CHARACTER*132 S
      CHARACTER*20  WORD
      INTEGER       GVFLEN, SMOOTH
      REAL          SY,EY







      CALL GVSSTX (S,INTEXT)
      SY=0.0
      EY=0.0
      SMOOTH=0
      CALL GVSCTB (SCTARG,LEN(SCTARG))



   10 CONTINUE
         IF (GVFLEN(S).EQ.0) GOTO 998
         CALL SPLITLINE (S, WORD, S)
         IF (WORD.EQ.'SMOOTH') THEN
            CALL SPLITLINE (S, WORD, S)
            READ (WORD,*,ERR=999) SMOOTH
         ELSE IF (WORD.EQ.'SY') THEN
            CALL SPLITLINE (S, WORD, S)
            READ (WORD,*,ERR=999) SY
         ELSE IF (WORD.EQ.'EY') THEN
            CALL SPLITLINE (S, WORD, S)
            READ (WORD,*,ERR=999) EY
         ELSE
            CALL GVSSTX (SCTARG(2+GVFLEN(SCTARG):),
     +       WORD(1:GVFLEN(WORD)))
            CALL GVSSHL (SCTARG)
         END IF
      GOTO 10



  999 CONTINUE
      CALL GVSTTB ('?M4620')



 998  CONTINUE


      RETURN
      END
      SUBROUTINE TEXMONO ()



















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INCLUDE       'PDBINC.INC'
      INCLUDE       'VECTOR.INC'
      INTEGER       GVFLEN
      LOGICAL       GVFFOP
      CHARACTER*80  EPSNEW, FILENAME, TEXCOMMAND







      IF (WIFPAR(473).GE.1) GOTO 998
      IF (.NOT.GVFFOP(TEXUNT)) THEN
         CALL GVSTTB ('?NEWB205')
         GOTO 998
      END IF
      IF (TEXLEVEL.EQ.' ') THEN
         CALL GVSTTB ('?NEWB206')
         GOTO 998
      END IF
      IF (NUMGRV.EQ.0) THEN
         CALL GVSTTB ('?NEWB207')
         GOTO 998
      END IF
      FILENAME=EPSNEW()
      CALL EPS008 (XMOL,YMOL,HUEVAL,NUMGRV,0.2,.FALSE.)
      CALL EPSCLOSE
      WRITE(TEXCOMMAND,1000,ERR=999) FILENAME(1:GVFLEN(FILENAME))
      CALL TEXTXT (TEXCOMMAND)
      GOTO 998



 999  CONTINUE
      CALL GVSEIW ('TEXMONO')



 998  CONTINUE





 1000    FORMAT('\\psplot{',a,'}')


      RETURN
      END
      SUBROUTINE TEXSTEREO



















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INCLUDE       'PDBINC.INC'
      INCLUDE       'VECTOR.INC'
      INTEGER       GVFLEN
      LOGICAL       GVFFOP
      CHARACTER*80  EPSNEW, FILENAME, FILENAM2, TEXCOMMAND







      IF (WIFPAR(473).GE.1) GOTO 998
      IF (.NOT.GVFFOP(TEXUNT)) THEN
         CALL GVSTTB ('?NEWB208')
         GOTO 998
      END IF
      IF (TEXLEVEL.EQ.' ') THEN
         CALL GVSTTB ('?NEWB209')
         GOTO 998
      END IF
      IF (NUMGRV.EQ.0) THEN
         CALL GVSTTB ('?NEWB210')
         GOTO 998
      END IF
      FILENAME=EPSNEW()
      CALL EPS008 (XMOL,YMOL,HUEVAL,NUMGRV,0.2,.FALSE.)
      CALL EPSCLOSE
      FILENAM2=EPSNEW()
      CALL EPS008 (XMOL,YMOL,HUEVAL,NUMGRV,0.2,.TRUE.)
      CALL EPSCLOSE
      WRITE(TEXCOMMAND,1000,ERR=999) FILENAME(1:GVFLEN(FILENAME)),
     +     FILENAM2(1:GVFLEN(FILENAM2))
      CALL TEXTXT (TEXCOMMAND)
      GOTO 998



 999  CONTINUE
      CALL GVSEIW ('TEXSTEREO')



 998  CONTINUE





 1000    FORMAT('\\psstereoplot{',a,'}{',a,'}')


      RETURN
      END
      SUBROUTINE PDBOUT_OPEN (IERR)

















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INCLUDE       'PDBINC.INC'
      INTEGER       IUNIT, GVFLEN, IERR
      LOGICAL       GVFFOP, GRTFILE
      CHARACTER*10  LOC1, DATESTR
      CHARACTER*13  VERSION, GETVERSION
      CHARACTER*80  LOCLIN, LIN







      IUNIT=0
      IERR=0



      IF (.NOT.GVFFOP(PDBUNT)) THEN
         CALL GVSOPF ('pdbout.txt',PDBUNT,'NEW')
         IF (.NOT.GVFFOP(PDBUNT)) THEN
            CALL GVSTTB ('?PDB001')
            GOTO 999
         END IF



         CALL GVSCCC (LOCLIN,WHERIS,'HEADER.TXT')
         IF (.NOT.GRTFILE(IUNIT,LOCLIN)) GOTO 999
 10      CONTINUE
            CALL GETLINE (IUNIT,LIN,IERR)
            IF (IERR.EQ.1) GOTO 998
            IF (IERR.EQ.2) GOTO 20
            IF (GVFLEN(LIN).EQ.0) THEN
               WRITE (PDBUNT,1090,ERR=999)
            ELSE IF (LIN.EQ.'% Fill in date here') THEN
               LOC1=DATESTR()
               WRITE (PDBUNT,1080,ERR=999) LOC1

                  VERSION=WCVERSION



               CALL GVSFMT ('?FMT029')
               WRITE (PDBUNT,FMT,ERR=999) VERSION
            ELSE
               CALL GVSTTU (PDBUNT,LIN(1:GVFLEN(LIN)))
            END IF
         GOTO 10
         END IF
 20   CONTINUE



      IF (.NOT.GVFFOP(TEXUNT)) THEN



         CALL GVSOPF ('pdbout.tex',TEXUNT,'NEW')
         IF (.NOT.GVFFOP(TEXUNT)) THEN
            CALL GVSTTB ('?PDB002')
            GOTO 999
         END IF



         IF (IUNIT.NE.0) CALL GVSCLF (IUNIT)
         CALL GVSCCC (LOCLIN,WHERIS,'HEADER.TEX')
         IF (.NOT.GRTFILE(IUNIT,LOCLIN)) GOTO 999
 30      CONTINUE
            CALL GETLINE (IUNIT,LIN,IERR)
            IF (IERR.EQ.1) GOTO 998
            IF (IERR.GE.2) GOTO 40
            IF (GVFLEN(LIN).EQ.0) THEN
               WRITE (TEXUNT,1090,ERR=999)
            ELSE IF (LIN.EQ.'% Fill in date here') THEN
               LOC1=DATESTR()
               CALL GVSFMT ('?FMT248')
               WRITE (TEXUNT,FMT,ERR=999) LOC1

                    VERSION=WCVERSION



               CALL GVSFMT ('?FMT247')
               WRITE (TEXUNT,FMT,ERR=999) VERSION
            ELSE
               CALL GVSTTU (TEXUNT,LIN(1:GVFLEN(LIN)))
            END IF
         GOTO 30



 40      CONTINUE
      END IF
      IERR=0
      GOTO 998



  999 CONTINUE
      IERR=1
      CALL GVSEIW ('PDBOUT_OPE')



  998 CONTINUE
      IF (IUNIT.NE.0) CALL GVSCLF (IUNIT)


 1080 FORMAT ('Date : ',A)
 1090 FORMAT ()

      RETURN
      END   
      SUBROUTINE PDBSUG

















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INCLUDE       'PDBINC.INC'
      INTEGER       IAA, MAXIAA, GVFLEN, IUNIT
      REAL          MAXVAL
      LOGICAL       GVFRIN, FIX34, GVFISF, GOTFILE







      IUNIT=0



      IF (WIFPAR(105).EQ.0) GOTO 998
      IF (WIFPAR(1503).NE.0) GOTO 998



      CALL TEXSECT ('?M5202')
      CALL PDBMES ('FX0')
      IF (ABS(FIXLST(1)).LT.0.1.AND.ABS(FIXLST(2)).LT.0.1.AND.
     +    ABS(FIXLST(6)).LT.0.1) CALL PDBMES ('FX0_OK')
      IF (PDRESO.LT.0.0) THEN
         CALL PDBMES ('FX0_NR')
         GOTO 998
      END IF












      IF (ABS(FIXLST(13)+FIXLST(14)).GT.5.1) THEN
         CALL PDBMES ('FX13M')
      ELSE IF (ABS(FIXLST(13)+FIXLST(14)).GT.1.1) THEN
         CALL PDBMES ('FX13F')
      ELSE IF (ABS(FIXLST(13)+FIXLST(14)).GT.0.1) THEN
         CALL PDBMES ('FX13A')
      END IF
      IF (ABS(FIXLST(1)).GT.0.1) CALL PDBMES ('FX1')
      IF (ABS(FIXLST(2)).GT.0.1) CALL PDBMES ('FX2')
      IF (ABS(FIXLST(5)).GT.0.1) THEN
         IF (ABS(FIXLST(6)).LT.0.1) THEN
            CALL PDBMES ('FX5A')
         ELSE
            CALL PDBMES ('FX5B')
         END IF
      END IF
      IF (ABS(FIXLST(7)).GT.0.1) CALL PDBMES ('FX7')
      IF (ABS(FIXLST(10)).GT.1.16) THEN
         CALL PDBMES ('FX010VH')
      ELSE IF (ABS(FIXLST(10)).GT.1.1) THEN
         CALL PDBMES ('FX010H')
      END IF











      FIX34=.FALSE.
      IF (PDRESO.GT.3.0) THEN
         IF (FIXLST(3).GT.1.0) THEN
            CALL PDBMES ('FX3_3B')
            FIX34=.TRUE.
         ELSE IF (FIXLST(3).GT.0.5) THEN
            CALL PDBMES ('FX3_3.0')
         END IF
      ELSE IF (PDRESO.GT.2.5) THEN
         IF (GVFRIN(FIXLST(3),0.75,1.5)) THEN
            CALL PDBMES ('FX3_2.5')
            FIX34=.TRUE.
         ELSE IF (FIXLST(3).GT.1.5) THEN
            CALL PDBMES ('FX3_2.5B')
            FIX34=.TRUE.
         END IF
      ELSE IF (PDRESO.GT.1.5) THEN
         IF (FIXLST(3).GT.1.5) THEN
            CALL PDBMES ('FX3_2.0B')
            FIX34=.TRUE.
         ELSE IF (FIXLST(3).GT.1.0) THEN
            CALL PDBMES ('FX3_2.0H')
            FIX34=.TRUE.
         ELSE IF (GVFRIN(FIXLST(3),0.25,0.5)) THEN
            CALL PDBMES ('FX3_2.0L')
         ELSE IF (FIXLST(3).LT.0.25) THEN
            CALL PDBMES ('FX3_2.0VL')
         END IF
      ELSE
         IF (FIXLST(3).GT.2.0) THEN
            CALL PDBMES ('FX3_1.0VH')
            FIX34=.TRUE.
         ELSE IF (FIXLST(3).GT.1.5) THEN
            CALL PDBMES ('FX3_1.0H')
            FIX34=.TRUE.
         ELSE IF (FIXLST(3).LT.0.5) THEN
            CALL PDBMES ('FX3_1.0VL')
         ELSE IF (FIXLST(3).LT.0.75) THEN
            CALL PDBMES ('FX3_1.0L')
         END IF
      END IF
      IF (PDRESO.GT.3.0) THEN
         IF (FIXLST(4).GT.1.0) THEN
            CALL PDBMES ('FX4_3B')
            FIX34=.TRUE.
         ELSE IF (FIXLST(4).GT.0.5) THEN
            CALL PDBMES ('FX4_3.0')
         END IF
      ELSE IF (PDRESO.GT.2.5) THEN
         IF (GVFRIN(FIXLST(4),0.75,1.5)) THEN
            CALL PDBMES ('FX4_2.5')
            FIX34=.TRUE.
         ELSE IF (FIXLST(4).GT.1.5) THEN
            CALL PDBMES ('FX4_2.5B')
            FIX34=.TRUE.
         END IF
      ELSE IF (PDRESO.GT.1.5) THEN
         IF (FIXLST(4).GT.1.5) THEN
            CALL PDBMES ('FX4_2.0B')
            FIX34=.TRUE.
         ELSE IF (FIXLST(4).GT.1.0) THEN
            CALL PDBMES ('FX4_2.0H')
            FIX34=.TRUE.
         ELSE IF (GVFRIN(FIXLST(4),0.25,0.5)) THEN
            CALL PDBMES ('FX4_2.0L')
         ELSE IF (FIXLST(4).LT.0.25) THEN
            CALL PDBMES ('FX4_2.0VL')
         END IF
      ELSE
         IF (FIXLST(4).GT.2.0) THEN
            CALL PDBMES ('FX4_1.0VH')
            FIX34=.TRUE.
         ELSE IF (FIXLST(4).GT.1.5) THEN
            CALL PDBMES ('FX4_1.0H')
            FIX34=.TRUE.
         ELSE IF (FIXLST(4).LT.0.5) THEN
            CALL PDBMES ('FX4_1.0VL')
         ELSE IF (FIXLST(4).LT.0.75) THEN
            CALL PDBMES ('FX4_1.0L')
         END IF
      END IF
      IF (FIXLST(8).GT.0.1) THEN
         IF (ABS(FIXLST(8)-1.0).LT.0.1) THEN
            CALL PDBMES ('FX8_U')
         ELSE IF (ABS(FIXLST(8)-2.0).LT.0.1) THEN
            CALL PDBMES ('FX8_R')
         ELSE 
            CALL PDBMES ('FX8')
         END IF
      END IF
      IF (PDRESO.GT.3.0) THEN
         IF (FIXLST(9).GT.10.0) THEN
            CALL PDBMES ('FX9_3.0VH')
         ELSE IF (FIXLST(9).GT.7.0) THEN
            CALL PDBMES ('FX9_3.0H')
         ELSE IF (GVFRIN(FIXLST(9),4.0,7.0)) THEN
            CALL PDBMES ('FX9_3.0')
         END IF
      ELSE IF (PDRESO.GT.2.5) THEN
         IF (FIXLST(9).GT.10.0) THEN
            CALL PDBMES ('FX9_2.5VH')
         ELSE IF (FIXLST(9).GT.7.0) THEN
            CALL PDBMES ('FX9_2.5H')
         ELSE IF (GVFRIN(FIXLST(9),4.0,7.0)) THEN
            CALL PDBMES ('FX9_2.5')
         END IF
      ELSE IF (PDRESO.GT.1.5) THEN
         IF (FIXLST(9).GT.10.0) THEN
            CALL PDBMES ('FX9_1.5VH')
         ELSE IF (FIXLST(9).GT.7.0) THEN
            CALL PDBMES ('FX9_1.5H')
         END IF
      ELSE
         IF (FIXLST(9).GT.10.0) THEN
            CALL PDBMES ('FX9_1.0')
         END IF
      END IF
      IF (ABS(FIXLST(10)).GT.1.05.AND.ABS(FIXLST(10)).LT.1.1) 
     + CALL PDBMES ('FX010')
      IF (ABS(FIXLST(11)).GT.0.1) CALL PDBMES ('FX011')
      IF (ABS(FIXLST(12)).GT.10.1) THEN
         CALL PDBMES ('FX012H')
      ELSE IF (ABS(FIXLST(12)).GT.0.1) THEN
         CALL PDBMES ('FX012')
      END IF



      IF (GVFISF('BADAA.LIST')) CALL GVSDEL ('BADAA.LIST')
      IF (.NOT.GOTFILE(IUNIT,'BADAA.LIST')) GOTO 999
      CALL TEXSECT ('?M5203')
      CALL CDB013 ('BADSALL','NEUSALL','GOODSALL')



 10   CONTINUE
      MAXIAA=0
      MAXVAL=-5.0
      DO 20 IAA=1,NUMAAF
         IF (FIXRES(IAA).GT.MAXVAL.AND.FIXRES(IAA).GT.1.0) THEN
            MAXVAL=FIXRES(IAA)
            MAXIAA=IAA
         END IF
 20   CONTINUE
      IF (MAXIAA.GT.0) THEN
         CALL GVSCTB (BIGLIN,132)
         CALL PDBC92A (MAXIAA,0)
         CALL GVSFMT ('?FMT635')
         WRITE (BIGLIN,FMT,ERR=998) LINE92(1:GVFLEN(LINE92)),
     +    FIXRES(MAXIAA)
         CALL PDBC93 (BIGLIN)
         CALL GVSCTB (BIGLIN,132)
         WRITE (BIGLIN,1000,ERR=999) MAXIAA,ONESA3(MAXIAA),
     +    NUMNAM(MAXIAA),CHANAM(MAXIAA),FIXRES(MAXIAA)
 1000    FORMAT (I5,1X,A4,' (',A4,') ',A1,'  Value=',F6.1)
         CALL GVSTTU (IUNIT,BIGLIN(1:50))



         FIXRES(MAXIAA)=-100.0
         GOTO 10
      END IF



      CALL CDB012
      GOTO 998



  999 CONTINUE
      CALL GVSEIW ('PDBSUG')



  998 CONTINUE
      IF (IUNIT.NE.0) CALL GVSCLF (IUNIT)


      RETURN
      END   
      SUBROUTINE PDBS50 (IAT,JAT,KAT,LAT,VALUE,LIMIT,DIVIDE)

















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INCLUDE       'PDBINC.INC'
      INTEGER       IAT, JAT, KAT, LAT
      REAL          VALUE, LIMIT, DIVIDE, ADD, LDIV







      IF (ABS(VALUE).LT.LIMIT) GOTO 998
      IF (ABS(DIVIDE).LT.0.0001) THEN
         LDIV=1.0
      ELSE
         LDIV=DIVIDE
      END IF



      ADD=VALUE/LDIV



      IF (IAT.NE.0) FIXRES(ATIAA(IAT))=FIXRES(ATIAA(IAT))+ADD
      IF (JAT.NE.0.AND.JAT.NE.IAT) FIXRES(ATIAA(JAT))=
     + FIXRES(ATIAA(JAT))+ADD
      IF (KAT.NE.0.AND.JAT.NE.IAT.AND.KAT.NE.JAT) FIXRES(ATIAA(KAT))=
     + FIXRES(ATIAA(KAT))+ADD
      IF (LAT.NE.0.AND.JAT.NE.IAT.AND.KAT.NE.JAT.AND.LAT.NE.KAT) 
     + FIXRES(ATIAA(LAT))=FIXRES(ATIAA(LAT))+ADD



  998 CONTINUE


      RETURN
      END   
      SUBROUTINE PDBS51 (IAA,VALUE,LIMIT,DIVIDE)

















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INCLUDE       'PDBINC.INC'
      INTEGER       IAA
      REAL          VALUE, LIMIT, DIVIDE, ADD, LDIV







      IF (ABS(VALUE).LT.LIMIT) GOTO 998
      IF (ABS(DIVIDE).LT.0.0001) THEN
         LDIV=1.0
      ELSE
         LDIV=DIVIDE
      END IF



      ADD=VALUE/LDIV



      IF (IAA.NE.0) FIXRES(IAA)=FIXRES(IAA)+ADD



  998 CONTINUE


      RETURN
      END   

      BLOCK DATA PDB
      IMPLICIT      NONE
      INCLUDE       'PDBINC.INC'
      LOGICAL       WITHIN
      COMMON        /TEXUNIT/ WITHIN
      DATA WITHIN   /.FALSE./
      DATA TEXLEVEL /' '/
      DATA SECTION  /' '/
      END
