



      SUBROUTINE GETFILE (NUMUNT,TEXT,FILEIN,IERR)




























      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INTEGER       NUMUNT, GVFLEN, LEN, IERR
      LOGICAL       GVFFOP,  GVFISF
      CHARACTER*(*) TEXT, FILEIN
      CHARACTER*132 FILE
      CHARACTER*132 LOCLIN







      CALL GVSCLF (NUMUNT)



      IERR=0
      WIFPAR(803)=0
      LEN=GVFLEN(FILEIN)
      IF (LEN.GT.80) CALL GVST6C ('?M2285',FILEIN,.TRUE.)
      IF (LEN.LE.0) THEN
         CALL GVSCTB (FILE,132)
      ELSE
         CALL GVSSTX (FILE,FILEIN(1:MIN(132,LEN)))
      END IF



      IF (GVFLEN(FILE).LE.0) THEN



   10    CONTINUE
         IF (GVFLEN(TEXT).LE.0) THEN
            CALL IPROMPT ('?FILNAM')
         ELSE
            CALL IPROMPT (TEXT)
         END IF



         CALL GVSCTB (LOCLIN,132)
         CALL GETWORD (LOCLIN,IERR)
         IF (IERR.EQ.2.AND.GVFLEN(LOCLIN).LE.0) THEN
            CALL GVSDIR ('*')
            GOTO 10
         END IF
         CALL GVSSHL (LOCLIN)



         IF (IERR.NE.0) THEN
            IERR=1
            CALL GVSCLF (NUMUNT)
            GOTO 998
         END IF



         IF (LOCLIN(1:2).EQ.'0 ') THEN
            IERR=1
            CALL GVSCLF (NUMUNT)
            CALL FLUSHAHEAD
            GOTO 998
         END IF



         IF (LOCLIN(1:2).EQ.'!$'.AND.GVFLEN(FILNMS(74)).NE.0) THEN
            CALL GVSSTX (LOCLIN,FILNMS(74))
         END IF



         IF (.NOT.GVFISF(LOCLIN)) THEN
            CALL GVSTTE ('?FILNOF')
            CALL GVSTT6 (LOCLIN)
            GOTO 10
         END IF
         CALL GVSSTX (FILNMS(74),LOCLIN)



      ELSE
         IF (.NOT.GVFISF(FILE)) THEN
            CALL GVSTTE ('?FILNOF')
            CALL GVSTT6 (FILE)
            IERR=1
            GOTO 998
         END IF
         CALL GVSSTX (LOCLIN,FILE)
      END IF



      CALL GVSSHL (LOCLIN)
      CALL GVSOPF (LOCLIN,NUMUNT,'OLD')



      IERR=0
      IF (.NOT.GVFFOP(NUMUNT)) THEN
         CALL GVSTTE ('?FILNPO')
         IERR=1
      END IF



  998 CONTINUE


      RETURN
      END
      SUBROUTINE GETFILD (NUMUNT,TEXT,FILE,IERR)




























      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INTEGER       NUMUNT, GVFLEN, IERR
      CHARACTER*(*) TEXT, FILE
      CHARACTER*132 LOCLIN
      LOGICAL       GVFFOP,  GVFISF











      CALL GVSCLF (NUMUNT)



      IERR=0
      WIFPAR(803)=0



  10  CONTINUE
      IF (GVFLEN(TEXT).LE.0) THEN
         CALL IPROMPT ('?FILNAM')
      ELSE
         IF (GVFISF(FILE)) THEN
            CALL IPROMPT (TEXT)
         ELSE
            CALL IPROMPT ('?FILNAM')
         END IF
      END IF



      CALL GETWORD (LOCLIN,IERR)



      IF (IERR.EQ.1) THEN
         CALL GVSCLF (NUMUNT)
         GOTO 998
      END IF



      IF (LOCLIN(1:2).EQ.'!$'.AND.GVFLEN(FILNMS(74)).NE.0) THEN
         CALL GVSSTX (LOCLIN,FILNMS(74))
      END IF



      IF (GVFLEN(LOCLIN).LE.0) THEN



         IF (GVFLEN(FILE).LE.0) THEN
            CALL WIFBO1 (12,'?M0903')
            GOTO 10
         ELSE IF (GVFISF(FILE)) THEN
            CALL GVSSTX (LOCLIN,FILE)
            CALL GVSSTX (FILNMS(74),LOCLIN)
         ELSE
            CALL GVSDIR ('*')
            GOTO 10
         END IF
      END IF
      IF (.NOT.GVFISF(LOCLIN)) THEN
         CALL GVSTTE ('?FILNOF')
         CALL GVSTT6 (LOCLIN)
         GOTO 10
      END IF
      CALL WIFBO1 (0,' ')




      CALL GVSSHL (LOCLIN)
      CALL GVSOPF (LOCLIN,NUMUNT,'OLD')









      IERR=0
      IF (.NOT.GVFFOP(NUMUNT)) THEN
         CALL GVSOUF (LOCLIN,NUMUNT,'OLD')
         IF (.NOT.GVFFOP(NUMUNT)) THEN
            CALL GVSTTE ('?FILNPO')
            IERR=1
         END IF
         WIFPAR(803)=1
      END IF



  998 CONTINUE


      RETURN
      END
      SUBROUTINE GETFILN (NUMUNT,TEXT,FILE,IERR)

















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INTEGER       IERR, NUMUNT, GVFLEN
      LOGICAL       GVFFOP, GVFYON, GVFISF
      CHARACTER*(*) TEXT, FILE
      CHARACTER*250 LOCLIN







      IF (GVFFOP(NUMUNT)) THEN
         CALL GVSCLF (NUMUNT)
         CALL GVSTTI ('?M3771',NUMUNT)
         CALL GVSKIL
      END IF



      IERR=0



      IF (GVFLEN(FILE).LE.0) THEN



         IF (GVFLEN(TEXT).LE.0) THEN
            CALL IPROMPT ('?FILNAM')
         ELSE
            CALL IPROMPT (TEXT)
         END IF



         CALL NEEDWORD (LOCLIN,' ',IERR)
         CALL GVSSHL (LOCLIN)



         IF (IERR.NE.0) THEN
            CALL GVSCLF (NUMUNT)
            GOTO 998
         END IF



         IF (LOCLIN(1:2).EQ.'0 ') THEN
            IERR=1
            CALL FLUSHAHEAD
            GOTO 998
         END IF



         IF (LOCLIN(1:2).EQ.'!$'.AND.GVFLEN(FILNMS(74)).NE.0) THEN
            CALL GVSSTX (LOCLIN,FILNMS(74))
         END IF
         CALL GVSSTX (FILNMS(74),LOCLIN)
      ELSE
         CALL GVSSTX (LOCLIN,FILE)
      END IF



      IF (GVFISF(LOCLIN)) THEN



         IF (GVFLEN(FILE).LE.0) THEN
            CALL GVST6C ('?M0545',LOCLIN,.TRUE.)
            CALL GVSTT6 ('?WALB13')
            IF (.NOT.GVFYON('?WALB14',' ')) THEN
               IERR=1
               CALL GVSCLF (NUMUNT)
               GOTO 998
            END IF



         ELSE
            CALL GVSDEL (LOCLIN)
         END IF
      END IF



      IF (WIFPAR(370).NE.0.AND.OPTIN.EQ.'MAKMOL') THEN
         CALL GVSFMT ('?FMT024')
         CALL GVSCTB (LINE,80)
         WRITE (LINE(1:4),FMT,ERR=998) WIFPAR(370)
         CALL GVSCPC (LOCLIN,LINE(1:4))
         CALL GVSTCP (LOCLIN)
      END IF



      CALL GVSOPF (LOCLIN,NUMUNT,'NEW')



      IERR=0
      IF (.NOT.GVFFOP(NUMUNT)) THEN
         CALL GVSTTE ('?FILNPD')
         CALL GVSCLF (NUMUNT)
         IERR=1
         CALL GVSKIL
      END IF



  998 CONTINUE


      RETURN
      END
      SUBROUTINE GETUFILE (NUMUNT,TEXT,IERR)

















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INTEGER       IERR, NUMUNT, GVFLEN
      LOGICAL       GVFFOP, GVFISF
      CHARACTER*(*) TEXT
      CHARACTER*132 LOCLIN







      CALL GVSCLF (NUMUNT)



      CALL GVSCTB (LOCLIN,132)
      IERR=0



   10 CONTINUE
      CALL GVSSTX (LOCLIN,TEXT)
      IF (GVFLEN(LOCLIN).LE.0) THEN
         CALL GVSSTX (LOCLIN,'?FILNAM')
      END IF
      CALL IPROMPT (LOCLIN)
      CALL GVSCTB (LOCLIN,132)
      CALL NEEDWORD (LOCLIN,' ',IERR)



      IF (IERR.EQ.1) GOTO 998



      IF (.NOT.GVFISF(LOCLIN)) THEN
         CALL GVSTTE ('?FILNOF')
         GOTO 10
      END IF



      CALL GVSSHL (LOCLIN)
      CALL GVSOUF (LOCLIN,NUMUNT,'OLD')
      CALL GVSSTX (FILNMS(74),LOCLIN)



      IF (.NOT.GVFFOP(NUMUNT)) THEN
         CALL GVSTTE ('?FILNPO')
         IERR=1
      END IF
      WIFPAR(803)=1



  998 CONTINUE


      RETURN
      END
      SUBROUTINE GETUFILED (NUMUNT,TEXT,FILE,IERR)




















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INTEGER       IERR, NUMUNT, GVFLEN
      LOGICAL       GVFFOP, GVFISF
      CHARACTER*(*) TEXT, FILE
      CHARACTER*132 LOCLIN







      CALL GVSCLF (NUMUNT)



      CALL GVSCTB (LOCLIN,132)
      IERR=0



   10 CONTINUE
      IF (GVFLEN(FILE).LE.0) THEN



         CALL IPROMPT (TEXT)
         CALL NEEDWORD (LOCLIN,' ',IERR)



         IF (IERR.EQ.1) GOTO 998
      ELSE
         CALL GVSSTX (LOCLIN,FILE)
      END IF



      IF (LOCLIN(1:2).EQ.'0 ') THEN
         IERR=1
         CALL FLUSHAHEAD
         GOTO 998
      END IF



      IF (.NOT.GVFISF(LOCLIN)) THEN
         CALL GVST6C ('?FILNOF',LOCLIN,.TRUE.)
         IF (GVFLEN(TEXT).LE.0) THEN
            IERR=2
            GOTO 998
         ELSE
            GOTO 10
         END IF
      END IF



      CALL GVSSHL (LOCLIN)
      CALL GVSOUF (LOCLIN,NUMUNT,'OLD')



      IF (.NOT.GVFFOP(NUMUNT)) THEN
         CALL GVSTTE ('?FILNPO')
         IERR=1
      END IF
      WIFPAR(803)=1



  998 CONTINUE


      RETURN
      END
      SUBROUTINE GETUFILN (NUMUNT,TEXT,IERR)

















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INTEGER       IERR, NUMUNT, GVFLEN
      LOGICAL       GVFFOP, GVFYON, GVFISF
      CHARACTER*(*) TEXT
      CHARACTER*132 LOCLIN







      CALL GVSCLF (NUMUNT)



      CALL GVSCTB (LOCLIN,132)
      IERR=0



      IF (GVFLEN(TEXT).LE.0) THEN
         CALL GVSSTX (LINE2,'?FILNAM')
      ELSE
         CALL GVSSTX (LINE2,TEXT)
      END IF



      CALL IPROMPT (LINE2)
      CALL GETWORD (LOCLIN,IERR)



      IF (IERR.NE.0) THEN
         IERR=1
         GOTO 998
      END IF



      IF (LOCLIN(1:2).EQ.'0 ') THEN
         IERR=1
         GOTO 998
      END IF



      IF (GVFISF(LOCLIN)) THEN
         CALL GVSTTE ('?WALB13')
         IF (GVFYON('?WALB14',' ')) THEN
            CALL GVSDEL (LOCLIN)
         ELSE
            IERR=1
            GOTO 998
         END IF
      END IF



      CALL GVSSHL (LOCLIN)
      CALL GVSOUF (LOCLIN,NUMUNT,'NEW')



      IF (.NOT.GVFFOP(NUMUNT)) THEN
         CALL GVSTTE ('?FILNPD')
         IERR=1
         CALL GVSKIL
      END IF



  998 CONTINUE


      RETURN
      END
      SUBROUTINE SETFILNAM (FILOUT,FILIN,IERR)

















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INTEGER       IERR, LENIN, LENOUT, GVFLEN
      CHARACTER*(*) FILIN, FILOUT
      LOGICAL       GVFISF







      LENIN=LEN(FILIN)
      IF (LENIN.LE.0) THEN
         IERR=1
         CALL GVSTTB ('?M2287')
         GOTO 998
      END IF
      LENOUT=LEN(FILOUT)
      IF (LENOUT.LE.0) THEN
         IERR=1
         CALL GVSTTB ('?M2288')
         GOTO 998
      END IF
      LENIN=GVFLEN(FILIN)
      IF (LENIN.LE.0) THEN
         IERR=1
         CALL GVSTTE ('?M2289')
         GOTO 998
      END IF
      IF (LENIN.GT.LENOUT) THEN
         IERR=1
         CALL GVST6C ('?M2290',FILIN,.TRUE.)
         GOTO 998
      END IF



      IERR=0
      CALL GVSCTB (FILOUT,LENOUT)



      IF (GVFISF(FILIN)) THEN
         CALL GVSSTX (FILOUT,FILIN(1:MIN(LENIN,LENOUT)))
         GOTO 998
      END IF



      CALL GVSCCC (FILOUT,WHERIS,FILIN)
      IF (GVFISF(FILOUT)) GOTO 998







      CALL GVST6C ('?M2291',FILIN,.TRUE.)
      CALL GVST6C ('?M2292',FILOUT,.TRUE.)
      IERR=1



  998 CONTINUE


      RETURN
      END   
      SUBROUTINE SETWIF

















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INTEGER       IPAR, I, ITEMP, GVFFFI
      LOGICAL       GVFIBN, AHEAD







   10 CONTINUE
      CALL IPROMPT ('?NUMPAR')
      CALL GVSFFI (1,IPAR)
      IF (IPAR.EQ.0) GOTO 998
      IF (IPAR.EQ.1072) THEN
         CALL GVSTT6 ('?M1975')
         CALL GVSNL6 (3)
         STOP
      END IF



      IF (.NOT.GVFIBN(IPAR,1,MAXPAR)) THEN
         CALL GVSTTI ('?BUGG38',MAXPAR)
         CALL FLUSHAHEAD
         GOTO 10
      END IF



      IF (WIFPAR(475).EQ.0) THEN
         IF (WIFPAR(710).EQ.0.AND.WIFPAR(1194).NE.0.AND.
     +    WIFPAR(1105).EQ.0) CALL SHOWIF (IPAR)
      END IF



      CALL IPROMPT ('?PARVL2')
      I=GVFFFI(1,ITEMP)
      IF (I.EQ.0.AND.WIFPAR(710).EQ.0) THEN
         CALL GVSTT6 ('?PARVL3')
      ELSE



         WIFPAR(IPAR)=ITEMP
         IF (.NOT.AHEAD().AND.WIFPAR(1194).EQ.0) 
     +    CALL GVSTTI2 ('?PARVL1',IPAR,WIFPAR(IPAR))
      END IF



      IF (WIFPAR(475).EQ.0.AND.WIFPAR(710).EQ.0.AND.WIFPAR(1105).EQ.0) 
     + CALL SHOWIF (IPAR)



  998 CONTINUE


      RETURN
      END   
      SUBROUTINE SHOWIF (INPAR)

















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INTEGER       IERR, GVFLFR, I, IPAR, IPARIN, INPAR
      REAL          ROW
      LOGICAL       GVFIBN, GVFISF







      IERR=0



      IF (GVFISF('PARAMS.FIG')) THEN
         CALL GVSSTX (LINE,'PARAMS.FIG')
      ELSE
         CALL GVSCCC (LINE,WHERIS,'PARAMS.FIG')
      END IF



      CALL GETFILE (11,' ',LINE,IERR)
      IF (IERR.NE.0) GOTO 998



      IF (INPAR.EQ.0) THEN
         CALL IPROMPT ('?NUMPAR')
         CALL GVSFFI (1,IPARIN)
         IF (IPARIN.EQ.0) GOTO 998
      ELSE
         IPARIN=INPAR
      END IF



      IF (.NOT.GVFIBN(IPARIN,1,MAXPAR)) THEN
         CALL GVSTTI ('?BUGG38',MAXPAR)
         CALL FLUSHAHEAD
         GOTO 998
      END IF



   20 CONTINUE
         CALL GETLINE (11,LINE,IERR)
         IF (IERR.NE.0) THEN
            CALL GVSTTB ('?M0951')
            GOTO 998
         END IF
         IF (LINE(1:1).EQ.'*') GOTO 998
         IF (LINE(1:5).EQ.'     ') GOTO 20



         I=GVFLFR(1,ROW,LINE)



         IF (I.NE.1) GOTO 20
         IPAR=NINT(ROW)
      IF (IPAR.NE.IPARIN) GOTO 20



      CALL GVSTT6 (LINE)



   30 CONTINUE
         CALL GETLINE (11,LINE,IERR)
         IF (IERR.NE.0) THEN
            CALL GVSTTB ('?M0951')
            GOTO 998
         END IF
         IF (LINE(1:1).EQ.'*') GOTO 998
         IF (LINE(1:5).NE.'     ') GOTO 40
         CALL GVSTT6 (LINE)
      GOTO 30



   40 CONTINUE
      CALL GVSTTI ('?M0952',WIFPAR(IPARIN))



  998 CONTINUE
      CALL GVSCLF (11)


      RETURN
      END
      SUBROUTINE GETCBETA (IAA,IERR)

















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INCLUDE       'DGLOOP.INC'
      INTEGER       IAA, IERR
      LOGICAL       WIFIRR, WIFBOK, STOBND







      CBETA(1)=0.0
      CBETA(2)=0.0
      CBETA(3)=0.0
      IERR=1
      IF (.NOT.WIFBOK(IAA)) THEN
         CBETA(1)=XCOORD(PNTAAC(IAA))
         CBETA(2)=YCOORD(PNTAAC(IAA))
         CBETA(3)=ZCOORD(PNTAAC(IAA))
         GOTO 998
      END IF
      IF (FAMTYP(RESTYP(IAA)).NE.1) THEN
         CALL GVSTTE ('?RNGNAA')
         CALL SHOIAA (IAA)
         GOTO 998
      END IF
      IF (.NOT.WIFIRR(IAA)) THEN
         CALL GVSTTI ('?IAOORB',IAA)
         GOTO 998
      END IF



      IERR=0



      IF (RESTYP(IAA).NE.6) THEN
         CBETA(1)=XCOORD(PNTAAS(IAA)+4)
         CBETA(2)=YCOORD(PNTAAS(IAA)+4)
         CBETA(3)=ZCOORD(PNTAAS(IAA)+4)



      ELSE
         STOBND=NOBOND(IAA)
         NOBOND(IAA)=.TRUE.
         CALL WIF330 (IAA,1)
         CBETA(1)=XCOORD(PNTAAS(IAA)+4)
         CBETA(2)=YCOORD(PNTAAS(IAA)+4)
         CBETA(3)=ZCOORD(PNTAAS(IAA)+4)
         CALL WIF330 (IAA,6)
         NOBOND(IAA)=STOBND
      END IF



  998 CONTINUE


      RETURN
      END
      SUBROUTINE GETTEXTP (BOOL)

















      IMPLICIT      NONE
      INCLUDE       'IRIGRA.INC'
      LOGICAL       BOOL







      IF (IRSTAT(4).EQ.0) GOTO 998
      IF (.NOT.USE300) GOTO 998



      IF (IRSTAT(7).EQ.1) THEN
         BOOL=.TRUE.
      ELSE
         BOOL=.FALSE.
      END IF



  998 CONTINUE


      RETURN
      END
      SUBROUTINE KILLTEXTP (BOOL)

















      IMPLICIT      NONE
      INCLUDE       'IRIGRA.INC'
      LOGICAL       BOOL







      IF (.NOT.BOOL) GOTO 998
      IF (IRSTAT(4).EQ.0) GOTO 998
      IF (.NOT.USE300) GOTO 998



      CALL GVSCOD (' ')



  998 CONTINUE


      RETURN
      END
      SUBROUTINE WIFTPN (TEXT,ADDONE,IERR)

















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INCLUDE       'IRIGRA.INC'
      INTEGER       IERR, GVFLEN, LENTXT
      LOGICAL       ADDONE
      CHARACTER*(*) TEXT
      CHARACTER*80  LOCTXT







      LENTXT=GVFLEN(TEXT)
      IF (LEN(TEXT)-LENTXT.LT.3) THEN
         CALL GVSTTB ('?ETTSHT')
         IERR=1
         GOTO 998
      END IF



      CALL GVSSTX (LOCTXT,TEXT)
      CALL GVSSTX (TEXT,LOCTXT)



      IERR=0



      IF (ADDONE) THEN
         PLOTNR=PLOTNR+1
         PLOTNR=MOD(PLOTNR,1000)
      END IF



      CALL GVSFMT ('?FMT090')
      WRITE (TEXT(LENTXT+1:LENTXT+3),FMT,ERR=999) PLOTNR
      GOTO 998



  999 CONTINUE
      CALL GVSTTB ('?IEIPNW')



  998 CONTINUE


      RETURN
      END
      SUBROUTINE GRA008 (IAA,IAT)


















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INCLUDE       'IRIGRA.INC'
      LOGICAL       WIFITI, GRAPON
      INTEGER       IAA, IAT, LIST, IERR









      IF (WIFPAR(1451).EQ.2) THEN
         CALL WIFGAT (' ',IAA,IAT,IERR)
         IF (IERR.NE.0) IAA=0
         GOTO 997
      END IF
      IF (.NOT.GRAPON()) THEN
         CALL GVSTTE ('?OPNGRA')
         GOTO 997
      END IF



      IAA=0
      IAT=0
      CALL GVSRT0 (P1XYZ,3)
      CALL GVSRT0 (P2XYZ,3)



   10 CONTINUE
         CALL IRI000



         CALL GRTMES ('?M0953',IERR)



 20      CONTINUE
         CALL IRI016B (IAT,LIST)
         IF (LIST.EQ.0.AND.IAT.EQ.1) GOTO 999
         IF (IAT.LT.1) GOTO 20



         IF (LIST.EQ.5) THEN
            READ (66,REC=IAT,ERR=999) P1XYZ(1),P1XYZ(2),P1XYZ(3)
            GOTO 998
         END IF



         IF (LIST.NE.1) THEN
            WIFPAR(10)=5
            GOTO 10
         END IF



         IF (WIFITI(IAT)) THEN
            IAA=ATIAA(IAT)
            CALL LAB011 (IAT)
            CALL IRI000
            IRSTAT(15)=IAA



         ELSE
            GOTO 10
         END IF
      GOTO 998



  999 CONTINUE
      IAT=0
      IAA=0
  998 CONTINUE
      CALL GRTMES (' ',IERR)



  997 CONTINUE



      RETURN
      END
      SUBROUTINE GRA008A (TXTLIN,IAA,IAT)


















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INCLUDE       'IRIGRA.INC'
      LOGICAL       WIFITI, GRAPON
      INTEGER       IAA, IAT, LIST, IERR
      CHARACTER*(*) TXTLIN









      IF (WIFPAR(1451).EQ.2) THEN
         CALL WIFGAT (' ',IAA,IAT,IERR)
         IF (IERR.NE.0) IAA=0
         GOTO 997
      END IF
      IF (.NOT.GRAPON()) THEN
         CALL GVSTTE ('?OPNGRA')
         GOTO 997
      END IF



      IAA=0
      IAT=0
      CALL GVSRT0 (P1XYZ,3)
      CALL GVSRT0 (P2XYZ,3)



   10 CONTINUE
         CALL IRI000



         CALL GRTMES (TXTLIN,IERR)



 20      CONTINUE
         CALL IRI016B (IAT,LIST)
         IF (LIST.EQ.0.AND.IAT.EQ.1) GOTO 999
         IF (IAT.LT.1) GOTO 20



         IF (LIST.EQ.5) THEN
            READ (66,REC=IAT,ERR=999) P1XYZ(1),P1XYZ(2),P1XYZ(3)
            GOTO 998
         END IF



         IF (LIST.NE.1) THEN
            WIFPAR(10)=5
            GOTO 10
         END IF



         IF (WIFITI(IAT)) THEN
            IAA=ATIAA(IAT)
            CALL LAB011 (IAT)
            CALL IRI000
            IRSTAT(15)=IAA



         ELSE



            IF (IAT.EQ.1) THEN
               IAT=0
               IAA=0
               GOTO 998
            ELSE
               GOTO 10
            END IF
         END IF
      GOTO 998



  999 CONTINUE
      IAT=0
      IAA=0
  998 CONTINUE
      CALL GRTMES (' ',IERR)



  997 CONTINUE



      RETURN
      END
      SUBROUTINE GRA009 (IAA1,IAT1,IAA2,IAT2)


















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INCLUDE       'IRIGRA.INC'
      INTEGER       IAA1, IAT1, IAA2, IAT2, LIST, IERR
      LOGICAL       GRAPON, WIFITI









      IF (WIFPAR(1451).EQ.2) THEN
         CALL WIFGAT ('?M2180',IAA1,IAT1,IERR)
         IF (IERR.NE.0) IAA1=0
         CALL WIFGAT ('?M2181',IAA2,IAT2,IERR)
         IF (IERR.NE.0) IAA1=0
         GOTO 997
      END IF
      IF (.NOT.GRAPON()) THEN
         CALL GVSTTE ('?OPNGRA')
         GOTO 997
      END IF



      IAA1=0
      IAT1=0
      IAA2=0
      IAT2=0
      CALL GVSRT0 (P1XYZ,3)
      CALL GVSRT0 (P2XYZ,3)



   10 CONTINUE



         CALL GRTMES ('?M0954',IERR)



 20      CONTINUE
         CALL IRI016B (IAT1,LIST)



         IF (LIST.EQ.0.AND.IAT1.EQ.5) THEN
            CALL GRTMES (' ',IERR)
            IAA1=0
            IAT1=0
            IAA2=0
            IAT2=5
            CALL IRI000
            GOTO 997
         END IF



         IF (LIST.EQ.0.AND.IAT1.EQ.6) THEN
            CALL GRTMES (' ',IERR)
            IAA1=0
            IAT1=0
            IAA2=0
            IAT2=6
            CALL IRI000
            GOTO 997
         END IF



         IF (LIST.EQ.0.AND.IAT1.EQ.1) THEN
            CALL GRTMES (' ',IERR)
            IAA1=0
            IAT1=0
            IAA2=0
            IAT2=0
            CALL IRI000
            GOTO 997
         END IF
         IF (IAT1.LT.1) GOTO 20



         IF (LIST.EQ.5) THEN
            READ (66,REC=IAT1,ERR=999) P1XYZ(1),P1XYZ(2),P1XYZ(3)
            GOTO 39
         END IF



         IF (LIST.NE.1) THEN
            WIFPAR(10)=5
            GOTO 10
         END IF



         IF (WIFITI(IAT1)) THEN



            IAA1=ATIAA(IAT1)
            CALL LAB011 (IAT1)
            CALL IRI000



         ELSE



            IF (IAT1.EQ.1) THEN
               IAT1=0
               IAA1=0
               IAT2=0
               IAA2=0
               CALL GRTMES (' ',IERR)
               GOTO 998
            ELSE
               GOTO 10
            END IF
         END IF



 39      CONTINUE
         CALL GRTMES ('?M0955',IERR)



 40      CONTINUE
         CALL IRI016B (IAT2,LIST)
         IF (LIST.EQ.0.AND.IAT2.EQ.6) THEN
            GOTO 10
         END IF
         IF (LIST.EQ.0.AND.IAT2.EQ.1) GOTO 999
         IF (IAT2.LT.1) GOTO 40



         IF (LIST.EQ.5) THEN
            READ (66,REC=IAT2,ERR=999) P2XYZ(1),P2XYZ(2),P2XYZ(3)
            GOTO 998
         END IF



         IF (LIST.NE.1) THEN
            WIFPAR(10)=5
            GOTO 40
         END IF
         IF (WIFITI(IAT2)) THEN



            IAA2=ATIAA(IAT2)
            CALL LAB011 (IAT2)
            CALL IRI000
            IRSTAT(15)=IAA2



         ELSE



            IF (IAT2.EQ.1) THEN
               IAT1=0
               IAA1=0
               IAT2=0
               IAA2=0
               CALL GRTMES (' ',IERR)
               GOTO 998
            ELSE
               GOTO 10
            END IF
         END IF



  998 CONTINUE
      CALL GRTMES (' ',IERR)
      GOTO 997



  999 CONTINUE
      CALL GRTMES (' ',IERR)
      IAA1=0
      IAT1=0
      IAA2=0
      IAT2=0



  997 CONTINUE



      RETURN
      END
      LOGICAL FUNCTION INTERRUPTED()



















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'






         INTEGER    COUNT, GETCC
         IF (WIFPAR(914).LT.0) THEN
            INTERRUPTED=.FALSE.
            RETURN
         END IF
         COUNT=GETCC()
         IF (COUNT.EQ.0) THEN 
            INTERRUPTED=.FALSE.
            RETURN
         END IF
         IF (COUNT.LT.0) THEN
            CALL GVSTTB ('?R00108')
            INTERRUPTED=.FALSE.
            RETURN
         END IF
         IF (WIFPAR(914).EQ.0) THEN
            CALL GVSTT6 ('?R00109')
            INTERRUPTED=.FALSE.
         ELSE IF (WIFPAR(914).EQ.1) THEN
            CALL GVSTT6 ('?R00110')
            CALL FLUSHAHEAD
            INTERRUPTED=.TRUE.
         ELSE IF (WIFPAR(914).EQ.2) THEN
            CALL GVSTT6 ('?R00111')
            CALL FLUSHAHEAD
            CALL FULLSTOP
            INTERRUPTED=.FALSE.
         ELSE IF (WIFPAR(914).EQ.3) THEN
            CALL GVSTT6 ('?R00112')
            CALL FLUSHAHEAD
            CALL POKEAHEAD ('Y')
            CALL FULLSTOP
            INTERRUPTED=.FALSE.
         ELSE IF (WIFPAR(914).EQ.4) THEN
            CALL GVSTT6 ('?R00113')
            CALL FLUSHAHEAD
            CALL GVSKIL
            INTERRUPTED=.FALSE.
         ELSE
            CALL GVSTTB ('?R00114')
            CALL FLUSHAHEAD
            INTERRUPTED=.TRUE.
         END IF









      RETURN
      END
      SUBROUTINE RESETINTERRUPT



















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'












         IF (WIFPAR(914).LT.0) RETURN
         CALL SETCC












      RETURN
      END
      LOGICAL FUNCTION GRAPON()





















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INCLUDE       'IRIGRA.INC'
      LOGICAL       GVFYON
      INTEGER       IERR







      GRAPON=.FALSE.



      IF (WIFPAR(1188).EQ.1) THEN
         USE300=.TRUE.
         GRAPON=.TRUE.
         GOTO 998
      END IF



      IF (USE300) THEN
         GRAPON=.TRUE.
         GOTO 998
      END IF
      IF (WIFPAR(279).EQ.0.AND.GVFYON('?OPEWIN',' ')) THEN
         CALL GRA000 (IERR)
         IF (IERR.EQ.0) THEN
            CALL IRI000
            GRAPON=.TRUE.
            GOTO 998
         END IF
      END IF
      CALL GVSTT6 ('?NOGRAP')



  998 CONTINUE


      RETURN
      END
      INTEGER FUNCTION INDAA1(AACID)























      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INTEGER       IAATYP
      CHARACTER*1   AACID







      INDAA1=0






      DO 10 IAATYP=1,NUMUA
         IF (AACID.EQ.A1NAME(IAATYP)) THEN
            INDAA1=IAATYP
            GOTO 998
         END IF
   10 CONTINUE



  998 CONTINUE


      RETURN
      END
      INTEGER FUNCTION INDAA1R(AACID,ILOW,IHGH)























      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INTEGER       IAATYP, ILOW, IHGH
      CHARACTER*1   AACID







      INDAA1R=0






      DO 10 IAATYP=ILOW,IHGH
         IF (AACID.EQ.A1NAME(IAATYP)) THEN
            INDAA1R=IAATYP
            GOTO 998
         END IF
   10 CONTINUE



  998 CONTINUE


      RETURN
      END
      INTEGER FUNCTION INDAA3(AACID)


























      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INTEGER       IAATYP, INDAA1, LENAA, I, J, PREVTP
      CHARACTER*4   LOCAA4, TEXT3, TEXT4
      CHARACTER*(*) AACID
      SAVE          PREVTP, LOCAA4
      DATA LOCAA4   /'$$$$'/
      DATA PREVTP   /-999/







      LENAA=LEN(AACID)
      INDAA3=0
      IF (LENAA.NE.4) THEN
         IF (LENAA.EQ.1) THEN
            INDAA3=INDAA1(AACID)
         ELSE
            CALL GVSTTB ('?ERIND3')
         END IF
         GOTO 998
      END IF



      IF (AACID.EQ.LOCAA4) THEN
         INDAA3=PREVTP
         GOTO 998
      END IF



      LOCAA4(1:1)=AACID(1:1)
      LOCAA4(2:2)=AACID(2:2)
      LOCAA4(3:3)=AACID(3:3)
      LOCAA4(4:4)=AACID(4:4)



      IF (LOCAA4.EQ.'ALA ') THEN
         INDAA3=1
         GOTO 998
      ELSE IF (LOCAA4.EQ.'CYS ') THEN
         INDAA3=2
         GOTO 998
      ELSE IF (LOCAA4.EQ.'ASP ') THEN
         INDAA3=3
         GOTO 998
      ELSE IF (LOCAA4.EQ.'GLU ') THEN
         INDAA3=4
         GOTO 998
      ELSE IF (LOCAA4.EQ.'PHE ') THEN
         INDAA3=5
         GOTO 998
      ELSE IF (LOCAA4.EQ.'GLY ') THEN
         INDAA3=6
         GOTO 998
      ELSE IF (LOCAA4.EQ.'HIS ') THEN
         INDAA3=7
         GOTO 998
      ELSE IF (LOCAA4.EQ.'ILE ') THEN
         INDAA3=8
         GOTO 998
      ELSE IF (LOCAA4.EQ.'LYS ') THEN
         INDAA3=9
         GOTO 998
      ELSE IF (LOCAA4.EQ.'LEU ') THEN
         INDAA3=10
         GOTO 998
      ELSE IF (LOCAA4.EQ.'MET ') THEN
         INDAA3=11
         GOTO 998
      ELSE IF (LOCAA4.EQ.'ASN ') THEN
         INDAA3=12
         GOTO 998
      ELSE IF (LOCAA4.EQ.'PRO ') THEN
         INDAA3=13
         GOTO 998
      ELSE IF (LOCAA4.EQ.'GLN ') THEN
         INDAA3=14
         GOTO 998
      ELSE IF (LOCAA4.EQ.'ARG ') THEN
         INDAA3=15
         GOTO 998
      ELSE IF (LOCAA4.EQ.'SER ') THEN
         INDAA3=16
         GOTO 998
      ELSE IF (LOCAA4.EQ.'THR ') THEN
         INDAA3=17
         GOTO 998
      ELSE IF (LOCAA4.EQ.'VAL ') THEN
         INDAA3=18
         GOTO 998
      ELSE IF (LOCAA4.EQ.'TRP ') THEN
         INDAA3=19
         GOTO 998
      ELSE IF (LOCAA4.EQ.'TYR ') THEN
         INDAA3=20
         GOTO 998
      ELSE IF (LOCAA4.EQ.' ALA') THEN
         INDAA3=1
         GOTO 998
      ELSE IF (LOCAA4.EQ.' CYS') THEN
         INDAA3=2
         GOTO 998
      ELSE IF (LOCAA4.EQ.' ASP') THEN
         INDAA3=3
         GOTO 998
      ELSE IF (LOCAA4.EQ.' GLU') THEN
         INDAA3=4
         GOTO 998
      ELSE IF (LOCAA4.EQ.' PHE') THEN
         INDAA3=5
         GOTO 998
      ELSE IF (LOCAA4.EQ.' GLY') THEN
         INDAA3=6
         GOTO 998
      ELSE IF (LOCAA4.EQ.' HIS') THEN
         INDAA3=7
         GOTO 998
      ELSE IF (LOCAA4.EQ.' ILE') THEN
         INDAA3=8
         GOTO 998
      ELSE IF (LOCAA4.EQ.' LYS') THEN
         INDAA3=9
         GOTO 998
      ELSE IF (LOCAA4.EQ.' LEU') THEN
         INDAA3=10
         GOTO 998
      ELSE IF (LOCAA4.EQ.' MET') THEN
         INDAA3=11
         GOTO 998
      ELSE IF (LOCAA4.EQ.' ASN') THEN
         INDAA3=12
         GOTO 998
      ELSE IF (LOCAA4.EQ.' PRO') THEN
         INDAA3=13
         GOTO 998
      ELSE IF (LOCAA4.EQ.' GLN') THEN
         INDAA3=14
         GOTO 998
      ELSE IF (LOCAA4.EQ.' ARG') THEN
         INDAA3=15
         GOTO 998
      ELSE IF (LOCAA4.EQ.' SER') THEN
         INDAA3=16
         GOTO 998
      ELSE IF (LOCAA4.EQ.' THR') THEN
         INDAA3=17
         GOTO 998
      ELSE IF (LOCAA4.EQ.' VAL') THEN
         INDAA3=18
         GOTO 998
      ELSE IF (LOCAA4.EQ.' TRP') THEN
         INDAA3=19
         GOTO 998
      ELSE IF (LOCAA4.EQ.' TYR') THEN
         INDAA3=20
         GOTO 998
      END IF
      DO 5 IAATYP=WIFPAR(276),21,-1
         IF (AANAME(IAATYP).EQ.LOCAA4) THEN
            INDAA3=IAATYP
            GOTO 998
         END IF
 5    CONTINUE
      DO 30 IAATYP=WIFPAR(276),21,-1
         J=0
         DO 10 I=1,4
            IF (ICHAR(AANAME(IAATYP)(I:I)).NE.ICHAR(' ')) THEN
               J=J+1
               TEXT3(J:J)=AANAME(IAATYP)(I:I)
            END IF
 10      CONTINUE
         IF (J+1.LE.4) THEN
            DO 11 I=J+1,4
               TEXT3(I:I)=' '
 11         CONTINUE
         END IF
         J=0
         DO 20 I=1,4
            IF (ICHAR(LOCAA4(I:I)).NE.ICHAR(' ')) THEN
               J=J+1
               TEXT4(J:J)=LOCAA4(I:I)
            END IF
 20      CONTINUE
         IF (J+1.LE.4) THEN
            DO 21 I=J+1,4
               TEXT4(I:I)=' '
 21         CONTINUE
         END IF
         IF (TEXT3.EQ.TEXT4) THEN
            INDAA3=IAATYP          
            GOTO 998
         END IF
 30   CONTINUE



  998 CONTINUE
      PREVTP=INDAA3


      RETURN
      END
      LOGICAL FUNCTION ISINAA(NUM,IAA)





















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INCLUDE       'EAAINC.INC'
      INTEGER       I, IAA, NUM, LNUM







      ISINAA=.FALSE.




      LNUM=NUM
      IF (NUM.GT.NUMUA) LNUM=NUM-NUMUA



      DO 10 I=1,LENEAA(LNUM)
         IF (MATEAA(I,LNUM).EQ.IAA) THEN
            ISINAA=.TRUE.
            GOTO 998
         END IF
   10 CONTINUE



  998 CONTINUE


      RETURN
      END
      SUBROUTINE OVRFLO (PARAM,INPVAL,DETECT)

















      IMPLICIT      NONE
      INCLUDE       'IRIGRA.INC'
      CHARACTER*(*) PARAM
      CHARACTER*(*) DETECT
      INTEGER       INPVAL, GVFLEN
      LOGICAL       WASS7







      IF (GVFLEN(PARAM).LT.1) THEN
         CALL GVSTTB ('?OVERB1')
         GOTO 998
      END IF
      IF (GVFLEN(DETECT).LT.1) THEN
         CALL GVSTTB ('?OVERB2')
         GOTO 998
      END IF



      IF (IRSTAT(7).EQ.1) THEN
         WASS7=.TRUE.
      ELSE
         WASS7=.FALSE.
      END IF



      CALL GVST6C ('?OVERB4',PARAM,.TRUE.)
      CALL GVSTTI ('?OVERB5',INPVAL)
      CALL GVST6C ('?OVERB6',PARAM,.TRUE.)
      CALL GVSNL6 (1)
      CALL GVSTT6 ('?OVERB3')
      CALL GVSNL6 (1)



      IF (WASS7) THEN
         CALL GVSCOD ('?M2980')
      END IF



  998 CONTINUE


      RETURN
      END
      SUBROUTINE TOOMANY (TEXT)

















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INCLUDE       'IRIGRA.INC'
      CHARACTER*(*) TEXT
      LOGICAL       WASS7







      IF (IRSTAT(7).EQ.1) THEN
         WASS7=.TRUE.
      ELSE
         WASS7=.FALSE.
      END IF



      WIFPAR(1510)=1



      CALL GVSNL6 (3)
      CALL SHOWTEXT ('?TOMANY')
      CALL GVST6C ('?TOMANT',TEXT,.TRUE.)













      RETURN
      END
      SUBROUTINE SETEDT (IERR)

















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INTEGER       IERR, GVFLEN







      CALL GVST6C ('?M1979',FILNMS(67),.TRUE.)



   10 CONTINUE
      CALL IPROMPT ('?M0981')
      CALL GVSCTB (LINE,80)
      CALL GETFULLLINE (LINE,IERR)
      IF (IERR.NE.0) GOTO 998
      IF (GVFLEN(LINE).LE.0) GOTO 998
      IF (LINE(1:2).EQ.'0 ') GOTO 998
      IF (GVFLEN(LINE).GT.20) THEN
         CALL GVSTTE ('?M0982')
         GOTO 10
      END IF



      CALL GVSSTX (FILNMS(67),LINE)



      CALL GVST6C ('?M1978',FILNMS(67),.TRUE.)



  998 CONTINUE


      RETURN
      END   
      SUBROUTINE SETIFT (IFT1,IFT2,JFT1,JFT2)

















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INTEGER       IFT1, IFT2, JFT1, JFT2
      LOGICAL       GVFIBN







      IFT1=0
      IFT2=0



      IF ((.NOT.GVFIBN(JFT1,0,NUMAAT)).OR.
     +    (.NOT.GVFIBN(JFT2,0,NUMAAT))) THEN
         CALL GVSTTB ('?BUGG08')
         GOTO 998
      END IF



      IF (JFT1.NE.0.AND.JFT2.NE.0) THEN
         IFT1=JFT1
         IFT2=JFT2
         IF (IFT1.GT.IFT2) CALL GVSWIP (IFT1,IFT2)
      ELSE



            CALL GVSTTB ('?M1980')

      END IF



  998 CONTINUE


      RETURN
      END   
      SUBROUTINE CLEANLINE (TEXT,NUMB,IERR)

















      IMPLICIT      NONE
      CHARACTER*(*) TEXT
      INTEGER       GVFLEN, IERR, LENLIN, NUMB







      IERR=0
      CALL GVSCTB (TEXT,LEN(TEXT))



   10 CONTINUE
      IF (TEXT(1:1).EQ.'-'.OR.TEXT(1:1).EQ.','.OR.
     +    TEXT(1:1).EQ.';'.OR.TEXT(1:1).EQ.' ') THEN
         TEXT(1:1)=' '
         CALL GVSSHL (TEXT)
         IF (GVFLEN(TEXT).GT.0) GOTO 10
      ELSE
         GOTO 998
      END IF
      LENLIN=GVFLEN(TEXT)



      IF (LENLIN.LE.0) THEN
         CALL IPROMPT ('?M0729')
         IF (NUMB.EQ.1) THEN
   20       CONTINUE
            CALL PEEKWORD (TEXT,IERR)
            IF (IERR.EQ.2) THEN
               CALL SHOSOU
               GOTO 20
            END IF
            CALL NEEDWORD (TEXT,' ',IERR)
         ELSE
            CALL PEEKWORD (TEXT,IERR)
            IF (IERR.EQ.0) THEN
               CALL GETWORD (TEXT,IERR)
            ELSE
               IERR=2
            END IF
         END IF
         IF (IERR.NE.0) GOTO 998
         GOTO 10
      END IF



  998 CONTINUE


      RETURN
      END   
      LOGICAL FUNCTION ISSETNAME(TEXT)

















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INTEGER       LEN1, LEN2, GVFLEN, ISET
      CHARACTER*(*) TEXT







      ISSETNAME=.FALSE.
      LEN1=GVFLEN(TEXT)
      IF (LEN1.LE.0) GOTO 998



      DO 10 ISET=1,MAXSET
         LEN2=GVFLEN(SOUNAM(ISET))
         IF (LEN1.EQ.LEN2) THEN
            IF (TEXT(1:LEN1).EQ.SOUNAM(ISET)(1:LEN1)) THEN
               ISSETNAME=.TRUE.
               GOTO 998
            END IF
         END IF
   10 CONTINUE



  998 CONTINUE


      RETURN
      END   
      INTEGER FUNCTION NUMMDL()



















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INCLUDE       'PDBINC.INC'
      INTEGER       IAA, HIGH







      HIGH=0



      DO 100 IAA=1,NUMAAT
         HIGH=MAX(HIGH,MODNMB(IAA))
  100 CONTINUE
      IF (HIGH.GT.MAXMODEL) THEN
         CALL GVSTTE ('?R00271')
         HIGH=MAXMODEL
      END IF
      NUMMDL=HIGH





      RETURN
      END
      SUBROUTINE WIFVMX (XYZMIN,XYZMAX,XYZCEN)

















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INCLUDE       'VECTOR.INC'
      INTEGER       IGRV
      REAL          XYZMIN(3), XYZMAX(3), XYZCEN(3)







      IF (NUMGRV.LE.0) THEN
         CALL GVSTTB ('?BADRMX')
         GOTO 998
      END IF



      CALL GVSRT0 (XYZCEN,3)
      XYZMIN(1)=1.E6
      XYZMIN(2)=1.E6
      XYZMIN(3)=1.E6
      XYZMAX(1)=-1.E6
      XYZMAX(2)=-1.E6
      XYZMAX(3)=-1.E6



      DO 10 IGRV=1,NUMGRV
         XYZMIN(1)=MIN(XYZMIN(1),XMOL(1,IGRV))
         XYZMIN(2)=MIN(XYZMIN(2),XMOL(2,IGRV))
         XYZMIN(3)=MIN(XYZMIN(3),XMOL(3,IGRV))
         XYZMAX(1)=MAX(XYZMAX(1),XMOL(1,IGRV))
         XYZMAX(2)=MAX(XYZMAX(2),XMOL(2,IGRV))
         XYZMAX(3)=MAX(XYZMAX(3),XMOL(3,IGRV))
         XYZCEN(1)=XYZCEN(1)+XMOL(1,IGRV)
         XYZCEN(2)=XYZCEN(2)+XMOL(2,IGRV)
         XYZCEN(3)=XYZCEN(3)+XMOL(3,IGRV)
   10 CONTINUE



      CALL GVSVDC (XYZCEN,FLOAT(NUMGRV),3)
      XYZCEN(3)=XYZCEN(3)/NUMGRV



  998 CONTINUE


      RETURN
      END
      SUBROUTINE WIFMMX (IFT1,IFT2,XYZMIN,XYZMAX,XYZCEN)

















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INTEGER       IFT1, IFT2, IAA, IAT, NUMUSE
      REAL          XYZMIN(3), XYZMAX(3), XYZCEN(3)







      IF (IFT2.LT.IFT1.OR.IFT1.LE.0.OR.IFT2.GT.NUMAAT) THEN
         CALL GVSTTB ('?BADRMX')
         GOTO 998
      END IF



      XYZMIN(1)=1.E6
      XYZMIN(2)=1.E6
      XYZMIN(3)=1.E6
      XYZMAX(1)=-1.E6
      XYZMAX(2)=-1.E6
      XYZMAX(3)=-1.E6
      XYZCEN(1)=0.0
      XYZCEN(2)=0.0
      XYZCEN(3)=0.0
      NUMUSE=0



      DO 20 IAA=IFT1,IFT2
         DO 10 IAT=PNTAAS(IAA),PNTAAE(IAA)
            IF (.NOT.PROTON(IAT).AND.ISATOK(IAT)) THEN
               NUMUSE=NUMUSE+1
               XYZMIN(1)=MIN(XYZMIN(1),XCOORD(IAT))
               XYZMIN(2)=MIN(XYZMIN(2),YCOORD(IAT))
               XYZMIN(3)=MIN(XYZMIN(3),ZCOORD(IAT))
               XYZMAX(1)=MAX(XYZMAX(1),XCOORD(IAT))
               XYZMAX(2)=MAX(XYZMAX(2),YCOORD(IAT))
               XYZMAX(3)=MAX(XYZMAX(3),ZCOORD(IAT))
               XYZCEN(1)=XYZCEN(1)+XCOORD(IAT)
               XYZCEN(2)=XYZCEN(2)+YCOORD(IAT)
               XYZCEN(3)=XYZCEN(3)+ZCOORD(IAT)
            END IF
 10      CONTINUE
 20   CONTINUE



      IF (NUMUSE.LE.0) THEN
         NUMUSE=0
         XYZMIN(1)=1.E6
         XYZMIN(2)=1.E6
         XYZMIN(3)=1.E6
         XYZMAX(1)=-1.E6
         XYZMAX(2)=-1.E6
         XYZMAX(3)=-1.E6
         XYZCEN(1)=0.0
         XYZCEN(2)=0.0
         XYZCEN(3)=0.0
         DO 40 IAA=IFT1,IFT2
            DO 30 IAT=PNTAAS(IAA),PNTAAE(IAA)
               IF (ISATOK(IAT)) THEN
                  NUMUSE=NUMUSE+1
                  XYZMIN(1)=MIN(XYZMIN(1),XCOORD(IAT))
                  XYZMIN(2)=MIN(XYZMIN(2),YCOORD(IAT))
                  XYZMIN(3)=MIN(XYZMIN(3),ZCOORD(IAT))
                  XYZMAX(1)=MAX(XYZMAX(1),XCOORD(IAT))
                  XYZMAX(2)=MAX(XYZMAX(2),YCOORD(IAT))
                  XYZMAX(3)=MAX(XYZMAX(3),ZCOORD(IAT))
                  XYZCEN(1)=XYZCEN(1)+XCOORD(IAT)
                  XYZCEN(2)=XYZCEN(2)+YCOORD(IAT)
                  XYZCEN(3)=XYZCEN(3)+ZCOORD(IAT)
               END IF
 30         CONTINUE
 40      CONTINUE
      END IF



      IF (NUMUSE.GT.0) THEN
         XYZCEN(1)=XYZCEN(1)/NUMUSE
         XYZCEN(2)=XYZCEN(2)/NUMUSE
         XYZCEN(3)=XYZCEN(3)/NUMUSE
      END IF



  998 CONTINUE


      RETURN
      END
      SUBROUTINE WIFMMX2 (IFT1,IFT2,XYZMIN,XYZMAX)

















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INTEGER       IFT1, IFT2, IAT
      REAL          XYZMIN(3), XYZMAX(3)







      IF (IFT2.LT.IFT1.OR.IFT1.LE.0) THEN
         CALL GVSTTB ('?BADRMX')
         GOTO 998
      END IF



      CALL GVSRTC (XYZMIN,100000.0,3)
      CALL GVSRTC (XYZMAX,-10000.0,3)



      DO 100 IAT=PNTAAS(IFT1),PNTAAE(IFT2)
         IF (ISATOK(IAT)) THEN
            XYZMIN(1)=MIN(XYZMIN(1),XCOORD(IAT)-VDWRAD(IAT))
            XYZMIN(2)=MIN(XYZMIN(2),YCOORD(IAT)-VDWRAD(IAT))
            XYZMIN(3)=MIN(XYZMIN(3),ZCOORD(IAT)-VDWRAD(IAT))
            XYZMAX(1)=MAX(XYZMAX(1),XCOORD(IAT)+VDWRAD(IAT))
            XYZMAX(2)=MAX(XYZMAX(2),YCOORD(IAT)+VDWRAD(IAT))
            XYZMAX(3)=MAX(XYZMAX(3),ZCOORD(IAT)+VDWRAD(IAT))
         END IF
  100 CONTINUE



  998 CONTINUE


      RETURN
      END
      SUBROUTINE WIFMMX3 (XYZMIN,XYZMAX,XYZCEN)

















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INTEGER       IAT, NUMUSE, GVFCBT, IAA
      REAL          XYZMIN(3), XYZMAX(3), XYZCEN(3)







      IF (GVFCBT(WRK1TF,NUMAAT).LE.0) THEN
         CALL GVSTTB ('?BADRMX')
         GOTO 998
      END IF



      CALL GVSRTC (XYZMIN,100000.0,3)
      CALL GVSRTC (XYZMAX,-10000.0,3)
      CALL GVSRT0 (XYZCEN,3)
      NUMUSE=0



      DO 100 IAA=1,NUMAAT
         IF (.NOT.WRK1TF(IAA)) GOTO 100
         DO 90 IAT=PNTAAS(IAA),PNTAAE(IAA)
            IF (ISATOK(IAT)) THEN
               NUMUSE=NUMUSE+1
               XYZMIN(1)=MIN(XYZMIN(1),XCOORD(IAT))
               XYZMIN(2)=MIN(XYZMIN(2),YCOORD(IAT))
               XYZMIN(3)=MIN(XYZMIN(3),ZCOORD(IAT))
               XYZMAX(1)=MAX(XYZMAX(1),XCOORD(IAT))
               XYZMAX(2)=MAX(XYZMAX(2),YCOORD(IAT))
               XYZMAX(3)=MAX(XYZMAX(3),ZCOORD(IAT))
               XYZCEN(1)=XYZCEN(1)+XCOORD(IAT)
               XYZCEN(2)=XYZCEN(2)+YCOORD(IAT)
               XYZCEN(3)=XYZCEN(3)+ZCOORD(IAT)
            END IF
   90    CONTINUE
  100 CONTINUE



      IF (NUMUSE.GT.0) THEN
         XYZCEN(1)=XYZCEN(1)/NUMUSE
         XYZCEN(2)=XYZCEN(2)/NUMUSE
         XYZCEN(3)=XYZCEN(3)/NUMUSE
      END IF



  998 CONTINUE


      RETURN
      END
      SUBROUTINE WIFMMX4 (IFT1,IFT2)


















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INTEGER       IFT1, IFT2, IAT, NUMUSE







      IF (IFT2.LT.IFT1.OR.IFT1.LE.0) THEN
         CALL GVSTTB ('?BADRMX')
         GOTO 998
      END IF



      CALL GVSRT0 (XYZ,3)
      NUMUSE=0



      DO 100 IAT=PNTAAS(IFT1),PNTAAE(IFT2)
         IF (ISATOK(IAT)) THEN
            NUMUSE=NUMUSE+1
            XYZ(1)=XYZ(1)+XCOORD(IAT)
            XYZ(2)=XYZ(2)+YCOORD(IAT)
            XYZ(3)=XYZ(3)+ZCOORD(IAT)
         END IF
  100 CONTINUE



      IF (NUMUSE.GT.0) THEN
         XYZ(1)=XYZ(1)/NUMUSE
         XYZ(2)=XYZ(2)/NUMUSE
         XYZ(3)=XYZ(3)/NUMUSE
      END IF



      WIFPAR(357)=NINT(100.0*XYZ(1))
      WIFPAR(358)=NINT(100.0*XYZ(2))
      WIFPAR(359)=NINT(100.0*XYZ(3))



  998 CONTINUE


      RETURN
      END
      SUBROUTINE WIFMMX5 (IFT1,IFT2,XYZCEN)

















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INTEGER       IFT1, IFT2, IAA, IAT, NUMUSE
      REAL          XYZCEN(3)







      IF (IFT2.LT.IFT1.OR.IFT1.LE.0.OR.IFT2.GT.NUMAAT) THEN
         CALL GVSTTB ('?BADRMX')
         GOTO 998
      END IF



      XYZCEN(1)=0.0
      XYZCEN(2)=0.0
      XYZCEN(3)=0.0
      NUMUSE=0



      DO 20 IAA=IFT1,IFT2
         DO 10 IAT=PNTAAS(IAA),PNTAAE(IAA)
            IF (.NOT.PROTON(IAT).AND.ISATOK(IAT)) THEN
               NUMUSE=NUMUSE+1
               XYZCEN(1)=XYZCEN(1)+XCOORD(IAT)
               XYZCEN(2)=XYZCEN(2)+YCOORD(IAT)
               XYZCEN(3)=XYZCEN(3)+ZCOORD(IAT)
            END IF
 10      CONTINUE
 20   CONTINUE



      IF (NUMUSE.GT.0) THEN
         XYZCEN(1)=XYZCEN(1)/FLOAT(NUMUSE)
         XYZCEN(2)=XYZCEN(2)/FLOAT(NUMUSE)
         XYZCEN(3)=XYZCEN(3)/FLOAT(NUMUSE)
      END IF



  998 CONTINUE


      RETURN
      END
      SUBROUTINE WIFMMX6 (IFT1,IFT2,ICNTRL)

















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INTEGER       IFT1, IFT2, IAA, IAT, NUMUSE, ICNTRL
      REAL          DMIN, DNOW







      IF (IFT2.LT.IFT1) CALL GVSWIP (IFT1,IFT2)
      IF (IFT1.LE.0.OR.IFT2.GT.NUMAAT) THEN
         CALL GVSTTB ('?BADRMX')
         GOTO 998
      END IF



      XYZ(1)=0.0
      XYZ(2)=0.0
      XYZ(3)=0.0
      NUMUSE=0
      ICNTRL=PNTAAS(IFT1)



      DO 20 IAA=IFT1,IFT2
         DO 10 IAT=PNTAAS(IAA),PNTAAE(IAA)
            IF (.NOT.PROTON(IAT).AND.ISATOK(IAT)) THEN
               NUMUSE=NUMUSE+1
               XYZ(1)=XYZ(1)+XCOORD(IAT)
               XYZ(2)=XYZ(2)+YCOORD(IAT)
               XYZ(3)=XYZ(3)+ZCOORD(IAT)
            END IF
 10      CONTINUE
 20   CONTINUE



      IF (NUMUSE.GT.0) THEN
         XYZ(1)=XYZ(1)/FLOAT(NUMUSE)
         XYZ(2)=XYZ(2)/FLOAT(NUMUSE)
         XYZ(3)=XYZ(3)/FLOAT(NUMUSE)
      ELSE
         CALL GVSTTB ('?M5178')
         GOTO 998
      END IF



      DMIN=99999.9
      DO 40 IAA=IFT1,IFT2
         DO 30 IAT=PNTAAS(IAA),PNTAAE(IAA)
            DNOW=(XCOORD(IAT)-XYZ(1))**2+
     +           (YCOORD(IAT)-XYZ(2))**2+
     +           (ZCOORD(IAT)-XYZ(3))**2
            IF (DNOW.LT.DMIN) THEN
               DMIN=DNOW
               ICNTRL=IAT
            END IF
 30      CONTINUE
 40   CONTINUE



  998 CONTINUE


      RETURN
      END
      SUBROUTINE WIFPPO (IANG)



















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INTEGER       IANG, I, GVFFCP, IERR, GVFLEN
      LOGICAL       GVFIBN
      CHARACTER*1   CNAMES(8),CINP
      SAVE          CNAMES
      DATA CNAMES   /'F','P','O','1','2','3','4','5'/







      IANG=0



   10 CONTINUE
      CALL GVSSTX (LINE,'?GIVTNM')
      CALL GVSFMT ('?FMT479')
      WRITE (LINE(71:80),FMT,ERR=999) (CNAMES(I),I=1,8)
      CALL GVSRDB (LINE)
      CALL IPROMPT (LINE)



      CALL NEEDWORD (LINE2,' ',IERR)
      IF (IERR.NE.0) GOTO 998
      CALL GVSSHL (LINE2)
      IF (GVFLEN(LINE2).GT.1) THEN
         CALL GVSTT6 ('?M2798')
         GOTO 10
      END IF
      CALL GVSSTX (CINP,LINE2(1:1))
      CALL GVSCUC (CINP)



      IANG=GVFFCP(CNAMES,CINP,8,1)
      IF (.NOT.GVFIBN(IANG,1,8)) THEN
         CALL GVSTTE ('?BADTOR')
         GOTO 10
      END IF
      GOTO 998



  999 CONTINUE
      CALL GVSEIW ('WIFPPO')



  998 CONTINUE


      RETURN
      END
      LOGICAL FUNCTION WIF1OK(IAA)

















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      LOGICAL       WIFIRI
      INTEGER       IAA, IAT







      IF (.NOT.WIFIRI(IAA)) THEN
         CALL GVSTTI ('?ROORRO',IAA)
         WIF1OK=.FALSE.
         CALL GVSKIL
         GOTO 998
      END IF



      WIF1OK=.FALSE.



      DO 10 IAT=PNTAAS(IAA),PNTAAE(IAA)
         IF (.NOT.PROTON(IAT).AND.ISATOK(IAT)) THEN
            WIF1OK=.TRUE.
            GOTO 998
         END IF
   10 CONTINUE



  998 CONTINUE


      RETURN
      END
      LOGICAL FUNCTION WIFCOK(IAA)


















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      LOGICAL       WIFIRI, WIFIRN
      INTEGER       IAA, IAT







      IF (.NOT.WIFIRI(IAA)) THEN
         CALL GVSTTI ('?ROORRO1',IAA)
         WIFCOK=.FALSE.
         CALL GVSKIL
         GOTO 998
      END IF



      DO 10 IAT=PNTAAS(IAA)+4,PNTAAE(IAA)
         IF (.NOT.PROTON(IAT).AND..NOT.ISATOK(IAT)) THEN



            IF (.NOT.WIFIRN(IAA).OR.(.NOT.ONESAT(IAT)(1:3).NE.
     +          ' O2'.AND.ONESAT(IAT)(4:4).EQ.'''')) THEN
               WIFCOK=.FALSE.
               GOTO 998
            END IF
         END IF
   10 CONTINUE



      WIFCOK=.TRUE.



  998 CONTINUE


      RETURN
      END
      INTEGER FUNCTION WIF51HALF()

















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'







      WIF51HALF=INT(FLOAT(WIFPAR(51))/2.0)





      RETURN
      END   
      SUBROUTINE SCLVAL

















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INTEGER       IAT, IFACT
      REAL          EXTVAL, FACT







      EXTVAL=0.0



      DO 10 IAT=1,NUMATF
         IF (ABS(ATTVAL(IAT)).GE.1.0) THEN
            IF (ATTVAL(IAT).GT.0.0) THEN
               EXTVAL=MAX(EXTVAL,ATTVAL(IAT))
            ELSE
               EXTVAL=MAX(EXTVAL,10.0*ABS(ATTVAL(IAT)))
            END IF
         END IF
 10   CONTINUE
      FACT=LOG10(EXTVAL)
      IF (FACT.GT.3.0) THEN
         IFACT=NINT(FACT)-2
         CALL GVSTTI ('?M3514',IFACT)
         DO 20 IAT=1,NUMATF
            ATTVAL(IAT)=ATTVAL(IAT)/(10**IFACT)
 20      CONTINUE
      END IF





      RETURN
      END   
      LOGICAL FUNCTION WIFALL(IAA)


















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      LOGICAL       WIFIRI
      INTEGER       IAA, IAT







      IF (.NOT.WIFIRI(IAA)) THEN
         CALL GVSTTI ('?ROORRO3',IAA)
         WIFALL=.FALSE.
         CALL GVSKIL
         GOTO 998
      END IF



      WIFALL=.TRUE.
      DO 10 IAT=PNTAAS(IAA),PNTAAE(IAA)
         WIFALL=WIFALL.AND.ISATOK(IAT)
   10 CONTINUE



  998 CONTINUE


      RETURN
      END
      SUBROUTINE WIFSDS (INDSSP,IERR)

















      IMPLICIT      NONE
      INTEGER       IERR, I, INUMB, GVFLEN
      CHARACTER*(*) INDSSP







      IF (LEN(INDSSP).LT.5) THEN
         CALL GVSTTB ('?SDS001')
         GOTO 998
      END IF



      IERR=0



   10 CONTINUE
      CALL IPROMPT ('?SDS002')
      CALL WIFBO1 (1,'?SDS003')
      CALL NEEDWORD (INDSSP,' ',IERR)
      IF (IERR.NE.0) GOTO 998
      INUMB=GVFLEN(INDSSP)
      CALL GVSCUC (INDSSP)



      DO 20 I=1,INUMB
         IF (INDEX('H3STC*',INDSSP(I:I)).EQ.0) THEN
            CALL GVSTTE ('?SDS003')
            GOTO 10
         END IF
   20 CONTINUE



      IF (INDEX(INDSSP,'*').NE.0) THEN
         CALL GVSCTB (INDSSP,LEN(INDSSP))
         INDSSP(1:1)='*'
      END IF
      IF (INDEX(INDSSP,'H').NE.0.AND.
     +    INDEX(INDSSP,'3').NE.0.AND.
     +    INDEX(INDSSP,'S').NE.0.AND.
     +    INDEX(INDSSP,'T').NE.0.AND.
     +    INDEX(INDSSP,'C').NE.0) THEN
         CALL GVSCTB (INDSSP,LEN(INDSSP))
         INDSSP(1:1)='*'
      END IF



  998 CONTINUE


      RETURN
      END
      LOGICAL FUNCTION WIFSOK(IFT1,IFT2)

















      IMPLICIT      NONE
      INTEGER       IAA, IFT1, IFT2
      LOGICAL       WIFROK, WIFIRI







      WIFSOK=.TRUE.



      IF (.NOT.WIFIRI(IFT1)) THEN
         CALL GVSTTB ('?ROORK1')
         GOTO 998
      END IF
      IF (.NOT.WIFIRI(IFT2)) THEN
         CALL GVSTTB ('?ROORK2')
         GOTO 998
      END IF



      DO 10 IAA=IFT1,IFT2
         WIFSOK=WIFSOK.AND.WIFROK(IAA)
   10 CONTINUE



  998 CONTINUE


      RETURN
      END
      LOGICAL FUNCTION WIFTDS(INDSSP,INPCHR)

















      IMPLICIT      NONE
      INTEGER       GVFLEN, LENDSP
      CHARACTER*5   INDSSP
      CHARACTER*1   INPCHR, LOCHAR







      IF (GVFLEN(INDSSP).LT.1) THEN
         CALL GVSTTB ('?BADTDS')
         WIFTDS=.FALSE.
         GOTO 998
      END IF
      IF (INDSSP(1:1).EQ.'*') THEN
         WIFTDS=.TRUE.
         GOTO 998
      END IF



      IF (INPCHR.EQ.' ') THEN
         LOCHAR='C'
      ELSE
         LOCHAR=INPCHR
      END IF



      LENDSP=GVFLEN(INDSSP)
      WIFTDS=INDEX(INDSSP(1:LENDSP),LOCHAR).NE.0



  998 CONTINUE


      RETURN
      END
      SUBROUTINE WIFWAIT

















      IMPLICIT      NONE
      INTEGER       I, GVFFFI, ISEC







      CALL IPROMPT ('?M0039')
      I=GVFFFI(1,ISEC)



      IF (I.EQ.0) GOTO 998
      IF (ISEC.LT.1) ISEC=1
      IF (ISEC.GT.60) ISEC=60



      CALL GVSPAU (ISEC)



  998 CONTINUE


      RETURN
      END   
      SUBROUTINE FULLSTOP

















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INCLUDE       'IRIGRA.INC'
      INTEGER       GVFLEN, IUNIT, IWF914, IOS
      LOGICAL       GVFYON, GVFFOP







      IWF914=WIFPAR(914)
      IF (WIFPAR(914).GT.1) WIFPAR(914)=1



      IF (WIFPAR(75).GT.0) THEN
         WIFPAR(75)=WIFPAR(75)-1
         GOTO 998
      END IF



      IF (USE300.AND.IRISFLAGS(12)) THEN
         CALL GVSTT6 ('?M2293')
         CALL X11PARM (5,0)
      END IF








         IF (GVFLEN(FILNMS(76)).GT.0) THEN



               CALL GVSSTX (LINE,'?M2334')

            CALL GVSSTX (LINE(11:80),FILNMS(76)(1:70))
            CALL GVSSPL (LINE)
         END IF





            CALL TEXCLOSE




         DO 10 IUNIT=20,50
            CALL GVSFMT ('?FMT480')
            CALL GVSCLF (IUNIT)
            CALL GVSCTB (LINE,80)
            WRITE (LINE,FMT,ERR=10) IUNIT
            CALL GVSDLT (LINE)
   10    CONTINUE



         DO 30 IUNIT=1,100
            IF (IUNIT.EQ.5.OR.IUNIT.EQ.6) GOTO 30
            IF (GVFFOP(IUNIT)) THEN
               IF (WIFPAR(1012).GT.0) THEN
                  INQUIRE (UNIT=IUNIT,NAME=LINE,IOSTAT=IOS,ERR=998)
                  CALL GVSTTI ('?M2294',IUNIT)
                  CALL GVST6C ('?M2295',LINE,.FALSE.)
               END IF
               CALL GVSCLF (IUNIT)
            END IF
 30      CONTINUE



         IF (WIFPAR(1053).NE.0) THEN
            CALL GVSTTI ('MOL200  :',SUBUSE(1))
            CALL GVSTTI ('GVSCTB  :',SUBUSE(2))
            CALL GVSTTI ('GVSSTX  :',SUBUSE(3))
            CALL GVSTTI ('GVFLEN  :',SUBUSE(4))
         END IF



         CALL GVSNL6 (4)
         STOP 'Normal end of WHAT IF.           '






 998  CONTINUE


      RETURN
      END
      SUBROUTINE CNTOPEN (CUTOFF)

















      IMPLICIT      NONE
      INTEGER       IUNIT, CUTOFF, COUNTR, IOS
      LOGICAL       ISOPEN, GVFFOP, GVFIBN
      CHARACTER*80  FILNAM







      COUNTR=0
      DO 10 IUNIT=1,256
         IF (IUNIT.EQ.5.OR.IUNIT.EQ.6) GOTO 10
         INQUIRE (UNIT=IUNIT,OPENED=ISOPEN,IOSTAT=IOS,ERR=998)
         IF (ISOPEN) COUNTR=COUNTR+1
 10   CONTINUE
      IF (COUNTR.GT.CUTOFF) THEN
         DO 20 IUNIT=1,256
            IF (IUNIT.EQ.5.OR.IUNIT.EQ.6) GOTO 20
            IF (IUNIT.EQ.22) THEN
               IF (GVFFOP(21).AND.GVFFOP(22)) CALL GVSTT6 ('?M4997')
            END IF
            IF (GVFIBN(IUNIT,22,30)) GOTO 20
            IF (IUNIT.EQ.41) THEN
               IF (GVFFOP(41).AND.GVFFOP(41)) CALL GVSTT6 ('?M4997')
            END IF
            IF (GVFIBN(IUNIT,41,49)) GOTO 20
            INQUIRE (UNIT=IUNIT,OPENED=ISOPEN,IOSTAT=IOS,NAME=FILNAM,
     +       ERR=998)
            IF (ISOPEN) CALL GVSTTI (FILNAM//' : ',IUNIT)
 20      CONTINUE
      END IF       



 998  CONTINUE


      RETURN
      END   
      SUBROUTINE LASTJOKE

















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INTEGER       JOKE, GVFIAN
      REAL          GVFRND
      CHARACTER*7   STRING







      JOKE=NINT(GVFRND(1))
      JOKE=GVFIAN(1,779)+1000




         CALL GVSFMT ('?FMT481')
         CALL GVSCTB (STRING,7)
         WRITE (STRING,FMT,ERR=999) JOKE



         CALL GVSNL6 (2)
         CALL SHOWTEXT (STRING)
         CALL GVSNL6 (2)

      GOTO 998



  999 CONTINUE
      CALL GVSEIW ('LASTJOKE')
  998 CONTINUE


      RETURN
      END   

      SUBROUTINE RESETP

















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INCLUDE       'HSTINC.INC'







      HSTDON=.FALSE.



      CALL WIF080
      CALL ENVINI





      RETURN
      END   

      SUBROUTINE SETUSYM (USYM)


















      IMPLICIT      NONE
      LOGICAL       GVFYON, USYM







      USYM=GVFYON('?NEWY1',' ')
      IF (USYM) THEN
         CALL WIFPUSHPPP (590,1)
      ELSE
         CALL WIFPUSHPPP (590,0)
      END IF





      RETURN
      END   
      SUBROUTINE MYTEST

















      IMPLICIT      NONE









      RETURN
      END   
      SUBROUTINE TYPRNG (ITYPE,ILOW,IHGH,IERR)

















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INTEGER       ITYPE, ILOW, IHGH, IERR, ILOOP
      LOGICAL       GVFIBN







      IF (.NOT.GVFIBN(ITYPE,1,6)) THEN
         CALL GVSTTI ('?M0805',ITYPE)
         IERR=1
         GOTO 998
      END IF



      IERR=0



      DO 10 ILOOP=1,NUMUA
         IF (FAMTYP(ILOOP).EQ.ITYPE) THEN
            ILOW=ILOOP
            GOTO 11
         END IF
   10 CONTINUE
      IERR=1
      GOTO 998
   11 CONTINUE
      DO 20 ILOOP=ILOW,NUMUA
         IF (FAMTYP(ILOOP).NE.ITYPE) THEN
            IHGH=ILOOP-1
            GOTO 998
         END IF
   20 CONTINUE
      IERR=1



  998 CONTINUE


      RETURN
      END   
      SUBROUTINE SETPAR (IPAR,IVAL,IERR)

















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INTEGER       IPAR, IVAL, IERR
      LOGICAL       GVFIBN







      IF (.NOT.GVFIBN(IPAR,1,MAXPAR)) THEN
         CALL GVSTTI ('?M2979',IPAR)
         IERR=1
         GOTO 998
      END IF



      IERR=0



      WIFPAR(IPAR)=IVAL



  998 CONTINUE


      RETURN
      END   
      INTEGER FUNCTION GETWIF(IPAR,IERR)

















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INTEGER       IPAR, IERR
      LOGICAL       GVFIBN







      IF (.NOT.GVFIBN(IPAR,1,MAXPAR)) THEN
         CALL GVSTTI ('?M2979',IPAR)
         GETWIF=0
         IERR=1
         GOTO 998
      END IF



      IERR=0



      GETWIF=WIFPAR(IPAR)



  998 CONTINUE


      RETURN
      END   
      SUBROUTINE WIFPUSHPPP (IWFPPP,VALUE)

















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INTEGER       IWFPPP, VALUE
      LOGICAL       GVFIBN







      IF (.NOT.GVFIBN(IWFPPP,1,MAXPAR)) THEN
         CALL GVSTTI2 ('?M0881',IWFPPP,MAXPAR)
         CALL WIFDUMPPPP (' ')
         GOTO 998
      END IF
      IF (NUMPPP.GE.MAXPAR) THEN
         CALL GVSTTB ('?M0878')
         CALL WIFDUMPPPP (' ')
         GOTO 998
      END IF



      NUMPPP=NUMPPP+1



      WIFPPP(1,NUMPPP)=IWFPPP
      WIFPPP(2,NUMPPP)=WIFPAR(IWFPPP)
      WIFPAR(IWFPPP)=VALUE



      IF (IWFPPP.EQ.1504) CALL SOUPRESET



  998 CONTINUE


      RETURN
      END   
      SUBROUTINE WIFDUMPPPP (TEXT)

















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INTEGER       I, J
      character(*)  TEXT







      IF (NUMPPP.LE.0) THEN
         CALL GVSTT6 ('?M0879')
         GOTO 998
      END IF



      CALL GVSTT6 (TEXT)
      CALL GVSTTI ('?M0880',NUMPPP)



      DO 10 I=0,NUMPPP+30,10
         CALL GVSFMT ('?FMT477')
         CALL GVSCTB (BIGLIN,132)
         WRITE (BIGLIN,FMT,ERR=10) I+1,I+10,(WIFPPP(1,I+J),J=1,10)
         CALL GVSTT6 (BIGLIN)
         CALL GVSFMT ('?FMT478')
         CALL GVSCTB (BIGLIN,132)
         WRITE (BIGLIN,FMT,ERR=10) (WIFPPP(2,I+J),J=1,10)
         CALL GVSTT6 (BIGLIN)
   10 CONTINUE



  998 CONTINUE


      RETURN
      END   
      SUBROUTINE WIFPOPPPP (IWFPPP)

















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INTEGER       IWFPPP, IPAR, JSHIFT
      LOGICAL       GVFIBN







      IF (.NOT.GVFIBN(IWFPPP,1,MAXPAR)) THEN
         CALL GVSTTI2 ('?M0881A',IWFPPP,MAXPAR)
         CALL WIFDUMPPPP (' ')
         GOTO 998
      END IF




      IF (IWFPPP.EQ.WIFPPP(1,NUMPPP)) THEN
         WIFPAR(IWFPPP)=WIFPPP(2,NUMPPP)
         WIFPPP(1,NUMPPP)=0
         WIFPPP(2,NUMPPP)=0
         NUMPPP=NUMPPP-1



         IF (IWFPPP.EQ.1504) CALL SOUPRESET
         GOTO 998
      END IF
      CALL GVSTTI ('?M2297',IWFPPP)
      CALL WIFDUMPPPP (' ')
      CALL GVSNL6 (3)
      CALL WIFDUMPSTK ('?M2139')
      CALL GVSNL6 (3)
      CALL GVSKIL



      DO 20 IPAR=NUMPPP-1,1,-1
         IF (WIFPPP(1,IPAR).EQ.IWFPPP) THEN



            WIFPAR(IWFPPP)=WIFPPP(2,IPAR)



            DO 10 JSHIFT=IPAR,NUMPPP-1
               WIFPPP(1,JSHIFT)=WIFPPP(1,JSHIFT+1)
               WIFPPP(2,JSHIFT)=WIFPPP(2,JSHIFT+1)
   10       CONTINUE



            WIFPPP(1,NUMPPP)=0
            WIFPPP(2,NUMPPP)=0
            NUMPPP=NUMPPP-1
            GOTO 998
         END IF
   20 CONTINUE



      CALL GVSTTI ('?M0882',IWFPPP)
      CALL WIFDUMPPPP (' ')
      CALL GVSKIL



  998 CONTINUE


      RETURN
      END
      SUBROUTINE WIFPUSHSTK (TEXT)

















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INCLUDE       'STACK.INC'
      INTEGER       DEBUNT, IERR
      CHARACTER*(*) TEXT
      CHARACTER*80  LOCLIN
      SAVE          DEBUNT
      DATA DEBUNT   /0/







      IF (DEBUNT.LE.0) THEN
         CALL GVSDEL ('STACK.FIL')
         CALL GVSROF (DEBUNT,IERR)
         IF (DEBUNT.LE.0.OR.IERR.NE.0) STOP
         OPEN (UNIT=DEBUNT,FILE='STACK.FIL',ACCESS='SEQUENTIAL',
     +    FORM='FORMATTED',STATUS='NEW',ERR=998)
         CALL GVSTT6 ('?M2136')
      END IF



      NUMSTK=NUMSTK+1



      IF (NUMSTK.GT.MAXSTK) THEN
         CALL GVSTTI ('?M2137',NUMSTK)
         CALL WIFDUMPSTK ('?M2140')
         GOTO 998
      END IF



      CALL GVSSTX (DBGSTK(NUMSTK),TEXT)



      IF (WIFPAR(1215).GE.1) THEN
         CALL GVSCTB (LOCLIN,80)
         CALL GVSSTX (LOCLIN(NUMSTK:NUMSTK+9),TEXT)
         CALL GVSTTU (DEBUNT,LOCLIN)
      END IF



  998 CONTINUE


      RETURN
      END   
      SUBROUTINE WIFPOPSTK (TEXT)

















      IMPLICIT      NONE
      INCLUDE       'STACK.INC'
      INTEGER       LENTXT, GVFLEN
      CHARACTER*(*) TEXT







      IF (NUMSTK.LE.0) THEN
         CALL GVSTTB ('?M1966')
         GOTO 998
      END IF
      IF (NUMSTK.GT.MAXSTK) THEN
         NUMSTK=NUMSTK-1
         GOTO 998
      END IF
      LENTXT=GVFLEN(TEXT)
      IF (LENTXT.LE.0) THEN
         CALL GVSTTB ('?M1967')
         GOTO 998
      END IF



      IF (TEXT(1:LENTXT).NE.DBGSTK(NUMSTK)(1:LENTXT)) THEN
         CALL GVST6C ('?M1969',TEXT(1:LENTXT),.TRUE.)
         CALL GVST6C ('?M1970',DBGSTK(NUMSTK)(1:LENTXT),.TRUE.)
         CALL WIFDUMPSTK ('?M2138')
         GOTO 998
      END IF



      NUMSTK=NUMSTK-1



  998 CONTINUE


      RETURN
      END   
      SUBROUTINE WIFDUMPSTK (TEXT)

















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INCLUDE       'STACK.INC'
      INTEGER       ILOOP, ISTART, IEND, I
      CHARACTER*(*) TEXT







      IF (NUMSTK.LE.0) THEN
         CALL GVSTTB ('?M1971')
         GOTO 998
      END IF



      CALL GVSNL6 (1)
      CALL GVSTT6 (TEXT)
      CALL GVSNL6 (1)



      DO 10 ILOOP=1,MAXSTK/5
         ISTART=5*(ILOOP-1)+1
         IEND=MIN(5*(ILOOP-1)+5,NUMSTK)
         IF (ISTART.GT.NUMSTK.OR.ISTART.GT.IEND) GOTO 998
         CALL GVSFMT ('?FMT476')
         CALL GVSCTB (LINE,80)
         WRITE (LINE,FMT,ERR=999) ISTART,IEND,(DBGSTK(I),I=ISTART,IEND)
         CALL GVSTT6 (LINE)
   10 CONTINUE
      GOTO 998



  999 CONTINUE
      CALL GVSEIW ('WIFDUMPSTK')



  998 CONTINUE


      RETURN
      END   
      SUBROUTINE WIFIERR (IERR,TEXT)

















      IMPLICIT      NONE
      INTEGER       IERR, GVFLEN
      CHARACTER*(*) TEXT







      IERR=1



      IF (GVFLEN(TEXT).GT.0) THEN
         CALL GVSTTE (TEXT)
      ELSE
         CALL GVSTTE ('?M2298')
         CALL GVSKIL
      END IF





      RETURN
      END   
      SUBROUTINE WIFPUSHRES (IAA,IERR)

















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INCLUDE       'BACKUP.INC'
      INTEGER       IAA, IAT, JAT, IERR, IBND
      LOGICAL       WIFIRA







      IF (RESPNT.GE.MAXBCK) THEN
         CALL GVSTTB ('?M0977')
         CALL GVSKIL
         IERR=1
         GOTO 998
      END IF
      DO 20 IAT=PNTAAS(IAA),PNTAAE(IAA)
         DO 10 IBND=1,8
            IF (BOUND_TO(IBND,IAT).NE.0) THEN
               JAT=BOUND_TO(IBND,IAT)
               BOUND_TO(IBND,IAT)=0
               CALL GVSIT0 (BOUND_TO(1,JAT),8)
               IF ((.NOT.WIFIRA(IAA)).OR.IAT.GT.PNTAAS(IAA)+3) THEN
                  IF (WIFPAR(493).EQ.0) THEN
                     CALL SHOWTEXT ('?M2775')
                     CALL SHOIAA (IAA)
                     CALL GVSKIL
                  END IF
                  GOTO 21
               END IF
            END IF
 10      CONTINUE
 20   CONTINUE
 21   CONTINUE



      IERR=0
      RESPNT=RESPNT+1



      IAABCK(RESPNT)=IAA
      RESBCK(RESPNT)=RESTYP(IAA)
      OLDFUT(RESPNT)=FUTURE(IAA)
      OLDPRP(RESPNT)=PRPVAL(IAA)
      OLDSAC(RESPNT)=SUMACC(IAA)
      OLDHLT(RESPNT)=HASALT(IAA)
      OLD1TF(RESPNT)=WRK1TF(IAA)
      OLD2TF(RESPNT)=WRK2TF(IAA)
      OLDWTF(RESPNT)=LOCWTF(IAA)
      OLDCUT(RESPNT)=CUTFLG(IAA)
      OLDPAS(RESPNT)=PSTFLG(IAA)



      DO 30 IAT=PNTAAS(IAA),PNTAAE(IAA)
         OLDCOL(PINIAA(IAT),RESPNT)=ATCOLR(IAT)
         DO 25 IBND=1,8
            OLDBNT(IBND,PINIAA(IAT),RESPNT)=BOUND_TO(IBND,IAT)
 25      CONTINUE
         OLDXCR(PINIAA(IAT),RESPNT)=XCOORD(IAT)
         OLDYCR(PINIAA(IAT),RESPNT)=YCOORD(IAT)
         OLDZCR(PINIAA(IAT),RESPNT)=ZCOORD(IAT)
         OLDXBF(PINIAA(IAT),RESPNT)=XBFACT(IAT)
         OLDAV1(PINIAA(IAT),RESPNT)=ATTVAL(IAT)
         OLDAV2(PINIAA(IAT),RESPNT)=ATTVL2(IAT)
         OLDWGT(PINIAA(IAT),RESPNT)=WEIGHT(IAT)
         OLDUSA(PINIAA(IAT),RESPNT)=USABLE(IAT)
         OLDIOK(PINIAA(IAT),RESPNT)=ISATOK(IAT)
         OLDNOB(PINIAA(IAT),RESPNT)=NOBIAT(IAT)
         OLDATV(PINIAA(IAT),RESPNT)=ALTATM(IAT)
         CALL GVSSTX (OLDMDV(PINIAA(IAT),RESPNT),MENDLV(IAT))
         CALL GVSSTX (OLDORG(PINIAA(IAT),RESPNT),ORGNAM(IAT))
         OLDPN (PINIAA(IAT),RESPNT)=PDBNUM(IAT)
         OLDXAL(PINIAA(IAT),RESPNT)=ALTX(IAT)
         OLDYAL(PINIAA(IAT),RESPNT)=ALTY(IAT)
         OLDZAL(PINIAA(IAT),RESPNT)=ALTZ(IAT)
         OLDABF(PINIAA(IAT),RESPNT)=ALTXBF(IAT)
         OLDAWT(PINIAA(IAT),RESPNT)=ALTWGT(IAT)
         OLDALT(PINIAA(IAT),RESPNT)=ALALAT(IAT)
   30 CONTINUE



  998 CONTINUE


      RETURN
      END   
      SUBROUTINE WIFPOPRES (IERR)

















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INCLUDE       'BACKUP.INC'
      INTEGER       IAA, IAT, IERR, IBND
      LOGICAL       GVFIBN







      IF (RESPNT.LE.0) THEN
         CALL GVSTTB ('?M0978')
         IERR=1
         GOTO 998
      END IF



      IERR=0
      WIFPAR(275)=0



      IAA=IAABCK(RESPNT)
      IF (.NOT.GVFIBN(IAA,1,NUMAAT)) THEN
         CALL GVSTTI ('?M2791',IAA)
         IERR=1
         GOTO 999     
      END IF
      WIFPAR(275)=IAA



      IF (RESTYP(IAA).NE.RESBCK(RESPNT)) THEN
         CALL WIF330(IAA,RESBCK(RESPNT))
      END IF



      FUTURE(IAA)=OLDFUT(RESPNT)
      PRPVAL(IAA)=OLDPRP(RESPNT)
      SUMACC(IAA)=OLDSAC(RESPNT)
      HASALT(IAA)=OLDHLT(RESPNT)
      WRK1TF(IAA)=OLD1TF(RESPNT)
      WRK2TF(IAA)=OLD2TF(RESPNT)
      LOCWTF(IAA)=OLDWTF(RESPNT)
      CUTFLG(IAA)=OLDCUT(RESPNT)
      PSTFLG(IAA)=OLDPAS(RESPNT)



      DO 10 IAT=PNTAAS(IAA),PNTAAE(IAA)
         ATCOLR(IAT)=OLDCOL(PINIAA(IAT),RESPNT)
         DO 5 IBND=1,8
            BOUND_TO(IBND,IAT)=OLDBNT(IBND,PINIAA(IAT),RESPNT)
 5       CONTINUE
         XCOORD(IAT)=OLDXCR(PINIAA(IAT),RESPNT)
         YCOORD(IAT)=OLDYCR(PINIAA(IAT),RESPNT)
         ZCOORD(IAT)=OLDZCR(PINIAA(IAT),RESPNT)
         XBFACT(IAT)=OLDXBF(PINIAA(IAT),RESPNT)
         ATTVAL(IAT)=OLDAV1(PINIAA(IAT),RESPNT)
         ATTVL2(IAT)=OLDAV2(PINIAA(IAT),RESPNT)
         WEIGHT(IAT)=OLDWGT(PINIAA(IAT),RESPNT)
         USABLE(IAT)=OLDUSA(PINIAA(IAT),RESPNT)
         ISATOK(IAT)=OLDIOK(PINIAA(IAT),RESPNT)
         NOBIAT(IAT)=OLDNOB(PINIAA(IAT),RESPNT)
         ALTATM(IAT)=OLDATV(PINIAA(IAT),RESPNT)
         CALL GVSSTX (MENDLV(IAT),OLDMDV(PINIAA(IAT),RESPNT))
         CALL GVSSTX (ORGNAM(IAT),OLDORG(PINIAA(IAT),RESPNT))
         PDBNUM(IAT)=OLDPN(PINIAA(IAT),RESPNT)
         ALTX(IAT)=OLDXAL(PINIAA(IAT),RESPNT)
         ALTY(IAT)=OLDYAL(PINIAA(IAT),RESPNT)
         ALTZ(IAT)=OLDZAL(PINIAA(IAT),RESPNT)
         ALTXBF(IAT)=OLDABF(PINIAA(IAT),RESPNT)
         ALTWGT(IAT)=OLDAWT(PINIAA(IAT),RESPNT)
         ALALAT(IAT)=OLDALT(PINIAA(IAT),RESPNT)
   10 CONTINUE



      RESPNT=RESPNT-1



      CALL MOL200
      GOTO 998



 999  CONTINUE
      CALL GVSTTB ('?M2793')



  998 CONTINUE


      RETURN
      END   
      SUBROUTINE WIFKILPOP

















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INCLUDE       'BACKUP.INC'
      INTEGER       IERR







      IF (RESPNT.LE.0) THEN
         CALL GVSTTB ('?M0978')
         IERR=1
         GOTO 998
      END IF



      IERR=0



      RESPNT=RESPNT-1



  998 CONTINUE


      RETURN
      END   
      SUBROUTINE WIFPMX (IAA,IAAMX,IAAPX,EXTENT)

















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INTEGER       IAA, IAAMX, IAAPX, EXTENT
      LOGICAL       WIFIRR







      IAAMX=IAA
      IAAPX=IAA



      IF (.NOT.WIFIRR(IAA).OR.EXTENT.LE.0) GOTO 998



      IAAMX=MAX(SOUADM(1,CHAINN(2,IAA)),IAA-EXTENT)
      IAAPX=MIN(SOUADM(2,CHAINN(2,IAA)),IAA+EXTENT)



  998 CONTINUE


      RETURN
      END   
      SUBROUTINE SETSHIT (IFT1,IFT2)

















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INTEGER       IAA, IFT1, IFT2
      LOGICAL       WIFIRI







      IF ((.NOT.WIFIRI(IFT1)).OR.(.NOT.WIFIRI(IFT2))) THEN
         CALL GVSKIL
         GOTO 998
      END IF



      DO 10 IAA=IFT1,IFT2
         ISSHIT(IAA)=.TRUE.
   10 CONTINUE



  998 CONTINUE


      RETURN
      END   
      SUBROUTINE HIGHNAM (NAMHGH)

















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INTEGER       TEMP, IAA, I, GVFLFI, NAMHGH







      NAMHGH=0



      IF (NUMAAT.LE.0) GOTO 998



      DO 10 IAA=1,NUMAAT
         I=GVFLFI(1,TEMP,NUMNAM(IAA))
         IF (I.GE.1) THEN
            NAMHGH=MAX(NAMHGH,TEMP)
         END IF
   10 CONTINUE



  998 CONTINUE


      RETURN
      END   
      LOGICAL FUNCTION AREEQUAL(IFT1,IFT2,JFT1,JFT2)

















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INTEGER       IAA, JAA, IFT1, IFT2, JFT1, JFT2
      LOGICAL       WIFIRI







      IF (.NOT.WIFIRI(IFT1).OR.
     +    .NOT.WIFIRI(IFT2).OR.
     +    .NOT.WIFIRI(JFT1).OR.
     +    .NOT.WIFIRI(JFT2)) THEN
         AREEQUAL=.FALSE.
         GOTO 998
      END IF



      AREEQUAL=.TRUE.
      IAA=IFT1-1
      JAA=JFT1-1



   10 CONTINUE
      IAA=IAA+1
      JAA=JAA+1
      IF (IAA.GT.IFT2.AND.JAA.GT.JFT2) GOTO 998
      IF (ONESA3(IAA).NE.ONESA3(JAA).OR.IAA.GT.IFT2.OR.
     +    JAA.GT.JFT2) THEN
         AREEQUAL=.FALSE.
         GOTO 998
      ELSE
         GOTO 10
      END IF



  998 CONTINUE

         
      END   
      SUBROUTINE WIF015 (IFT1,IFT2)

















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INCLUDE       'TABLES.INC'
      INCLUDE       'CNTINC.INC'
      INTEGER       IAA, IFT1, IFT2, NUMSCO, IERR, JCON
      REAL          RVAL
      LOGICAL       BVAL
      CHARACTER*4   CVAL







      CALL TAB002A
      CALL TAB010
      CALL GVSSTX(TABNAM(NXTTAB),'TAB')
      TABTYP(NXTTAB)=1
      TABLEN(NXTTAB)=IFT2
      CALL TAB029A (NXTTAB)



      CALL WIFPUSHPPP (590,1)



      CALL ENVRNG (IFT1,IFT2)



      DO 20 IAA=IFT1,IFT2
         CALL GVSCTB (CVAL,4)
         RVAL=0.0
         BVAL=.FALSE.
         CALL FCONAA (IAA,FLOAT(WIFPAR(56))/100.0,.FALSE.)
         NUMSCO=0
         IF (NUMCONIAA.GT.0) THEN
            DO 10 JCON=1,NUMCONIAA
               IF (CONSYMAA(JCON).GT.1) NUMSCO=NUMSCO+1
   10       CONTINUE
         END IF
         CALL TAB104 (IAA,NXTTAB,RVAL,NUMSCO,CVAL,BVAL,IERR)
   20 CONTINUE
      CALL WIFPOPPPP (590)





      RETURN
      END   
      INTEGER FUNCTION WIFTOK(IAA) 

















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INTEGER       IAA, IAT
      LOGICAL       WIFIRI







      WIFTOK=0



      IF (.NOT.WIFIRI(IAA)) GOTO 998



      DO 10 IAT=PNTAAS(IAA),PNTAAE(IAA)
         IF (ISATOK(IAT)) WIFTOK=WIFTOK+1
   10 CONTINUE



  998 CONTINUE


      RETURN
      END   
      SUBROUTINE DOBOND

















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INTEGER       IERR, IAA, JAA, IAT, JAT, IBND
      REAL          WIFDST
      LOGICAL       GVFYON







      CALL WIFGAT (' ',IAA,IAT,IERR)
      IF (IAT.LE.0.OR.IERR.NE.0) GOTO 998
      IF (BOUND_TO(1,IAT).NE.0.AND.BOUND_TO(2,IAT).NE.0.AND.
     +    BOUND_TO(3,IAT).NE.0.AND.BOUND_TO(4,IAT).NE.0.AND.
     +    BOUND_TO(5,IAT).NE.0.AND.BOUND_TO(6,IAT).NE.0.AND.
     +    BOUND_TO(7,IAT).NE.0.AND.BOUND_TO(8,IAT).NE.0) THEN
         CALL GVSTTE ('?M1498')
         GOTO 998
      END IF



      CALL WIFGAT (' ',JAA,JAT,IERR)
      IF (JAT.LE.0.OR.IERR.NE.0) GOTO 998
      IF (BOUND_TO(1,JAT).NE.0.AND.BOUND_TO(2,JAT).NE.0.AND.
     +    BOUND_TO(3,JAT).NE.0.AND.BOUND_TO(4,JAT).NE.0.AND.
     +    BOUND_TO(5,JAT).NE.0.AND.BOUND_TO(6,JAT).NE.0.AND.
     +    BOUND_TO(7,JAT).NE.0.AND.BOUND_TO(8,JAT).NE.0) THEN
         CALL GVSTTE ('?M1498')
         GOTO 998
      END IF



      IF (WIFDST(IAT,JAT).LT.0.7) THEN
         CALL GVSTTR ('?M1499',WIFDST(IAT,JAT))
         IF (.NOT.GVFYON('?M1500',' ')) GOTO 998
      END IF
      IF (WIFDST(IAT,JAT).GT.2.5) THEN
         CALL GVSTTR ('?M1501',WIFDST(IAT,JAT))
         IF (.NOT.GVFYON('?M1500',' ')) GOTO 998
      END IF



      DO 10 IBND=1,8
         IF (BOUND_TO(IBND,IAT).EQ.0) THEN
            BOUND_TO(IBND,IAT)=JAT
            GOTO 11
         END IF
 10   CONTINUE
      CALL GVSTTB ('?M1502')
      CALL GVSKIL
 11   CONTINUE
      DO 20 IBND=1,8
         IF (BOUND_TO(IBND,JAT).EQ.0) THEN
            BOUND_TO(IBND,JAT)=IAT
            GOTO 21
         END IF
 20   CONTINUE
      CALL GVSTTB ('?M1502')
      CALL GVSKIL
 21   CONTINUE
      CALL MOL200



  998 CONTINUE


      RETURN
      END   
      SUBROUTINE SOUPRESET


















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INCLUDE       'HSTINC.INC'







      IF (WIFPAR(364).NE.0) GOTO 998



      HSTDON=.FALSE.



      CALL GVSCTB (LOCHST,MAXAA)
      CALL GVSBTF (ACCDON,MAXAA)
      CALL GVSRT0 (SUMACC,MAXAA)
      CALL GVSRT0 (ACCESS,MAXAT)



 998  CONTINUE


      RETURN
      END   
      SUBROUTINE MODULUS (N_DIMENSIONS,VECTOR,UNIT_VECTOR)





















      IMPLICIT      NONE
      INTEGER       I, N_DIMENSIONS
      REAL          SQUAREMODULUS, MODU, VECTOR(1:N_DIMENSIONS),
     +              UNIT_VECTOR(1:N_DIMENSIONS)







      SQUAREMODULUS = 0.0
      DO 100 I = 1 , N_DIMENSIONS
         SQUAREMODULUS = SQUAREMODULUS + VECTOR(I)*VECTOR(I)
 100  CONTINUE
      MODU = SQRT(SQUAREMODULUS)



      IF (MODU.NE.0.0) THEN
         DO 150 I = 1 , N_DIMENSIONS
            UNIT_VECTOR(I) = VECTOR(I)/MODU
 150     CONTINUE
      END IF





      RETURN
      END
      SUBROUTINE NOB001

















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'







      CALL GVSCPB (NOBOND,WRK1TF,MAXAA)
      CALL MOL200
      CALL MOL200





      RETURN
      END   
      SUBROUTINE NOB002

















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'







      CALL GVSBTF (NOBOND,MAXAA)
      CALL GVSBTF (NOBIAT,MAXAT)
      CALL MOL200
      CALL MOL200





      RETURN
      END   
      SUBROUTINE NOB003

















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INTEGER       GVFCBT, IAA, IAT
      LOGICAL       WIFIRA







      IF (GVFCBT(NOBOND,NUMAAT).LE.0) GOTO 998



      DO 30 IAA=1,NUMAAF
         IF (.NOT.NOBOND(IAA)) GOTO 30
         IF (WIFIRA(IAA)) THEN
            DO 10 IAT=PNTAAS(IAA)+3,PNTAAE(IAA)
               IF (.NOT.PROTON(IAT)) NOBIAT(IAT)=.TRUE.
 10         CONTINUE
         ELSE
            DO 20 IAT=PNTAAS(IAA),PNTAAE(IAA)
               IF (.NOT.PROTON(IAT)) NOBIAT(IAT)=.TRUE.
 20         CONTINUE
         END IF
 30   CONTINUE



  998 CONTINUE


      RETURN
      END   
      SUBROUTINE NOB004

















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INTEGER       IAA, IAT, ISET, INOT, ITOT







      DO 100 IAA=1,NUMAAT
         ISET=0
         INOT=0
         ITOT=0
         DO 10 IAT=PNTAAS(IAA),PNTAAE(IAA)
            IF (ISATOK(IAT)) THEN
               ITOT=ITOT+1
               IF (NOBIAT(IAT)) THEN
                  ISET=ISET+1
               ELSE
                  INOT=INOT+1
               END IF
            END IF
 10      CONTINUE
         CALL DIF030 (6,IAA,NOBOND(IAA),ISET.EQ.ITOT)
 100  CONTINUE





      RETURN
      END   
      SUBROUTINE SETHIS (TEXT)

















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INTEGER       GVFLEN, I
      CHARACTER*(*) TEXT
      CHARACTER*80  LOCTXT   







      IF (GVFLEN(TEXT).LE.0) GOTO 998



      DO 10 I=1,19
         CALL GVSSTX (LOCTXT,HISTOR(I+1))
         CALL GVSSTX (HISTOR(I),LOCTXT)
   10 CONTINUE



      CALL GVSSTX (LOCTXT,TEXT)
      CALL GVSRDB (LOCTXT)
      CALL GVSSTX (HISTOR(20),LOCTXT)



  998 CONTINUE


      RETURN
      END
      SUBROUTINE TIMESTAMP

















      IMPLICIT      NONE
      CHARACTER*13  VERSION, GETVERSION
      INTEGER       OLDYEAR, NOWYEAR, OLDMONTH, NOWMONTH
      CHARACTER*10  DATESTR, DATELOC
      CHARACTER*12  FMT






      RETURN
      END   
