



C


C



























C



C













C











C










C













C










C
      LOGICAL FUNCTION WIFIR1(IAA)

















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







      WIFIR1=.FALSE.
      IF (.NOT.WIFIRI(IAA)) THEN
         CALL GVSTTB ('?ROORR1')
         CALL GVSKIL
         GOTO 998
      END IF
      IF (CHAINN(2,IAA).LE.0.OR.CHAINN(2,IAA).GT.NUMSOU) THEN
         CALL GVSTTI ('?ROOCN21',IAA)
         CALL GVSKIL
         GOTO 998
      END IF



      WIFIR1=IAA.EQ.SOUADM(1,CHAINN(2,IAA))



      IF (.NOT.WIFIR1) THEN
         IF (IAA.EQ.1) THEN
            CALL GVSTTB ('?NEWB227')
            WIFIR1=.TRUE.
            CALL GVSKIL
         ELSE IF (CHAINN(2,IAA).NE.CHAINN(2,IAA-1)) THEN
            CALL GVSTTB ('?NEWB228')
            WIFIR1=.TRUE.
            CALL GVSKIL
         END IF
      END IF



  998 CONTINUE


      RETURN
      END
      LOGICAL FUNCTION WIFIR3(IAA)

















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INTEGER       IAA
      REAL          WIFDST
      LOGICAL       WIFIRI, WIFIRA







      WIFIR3=.FALSE.
      IF (.NOT.WIFIRI(IAA)) THEN
         CALL GVSTTB ('?ROORR3')
         CALL GVSKIL
         GOTO 998
      END IF
      IF (CHAINN(2,IAA).LE.0.OR.CHAINN(2,IAA).GT.NUMSOU) THEN
         CALL GVSTTI ('?ROOCN23',IAA)
         CALL GVSKIL
         GOTO 998
      END IF



      IF (RESTYP(IAA).LE.0) THEN
         WIFIR3=.TRUE.
         GOTO 998
      END IF



      WIFIR3=IAA.EQ.SOUADM(2,CHAINN(2,IAA))



      IF (IAA.LT.NUMAAF) THEN
         IF (WIFIRA(IAA+1).AND.MODNMB(IAA).EQ.MODNMB(IAA+1)) THEN
            IF (ISATOK(PNTAAS(IAA+1))) THEN
               IF (WIFDST(PNTAAS(IAA)+2,PNTAAS(IAA+1)).LT.2.0) THEN
                  WIFIR3=.FALSE.
                  GOTO 998
               END IF
            END IF
         END IF
      END IF



      IF (.NOT.WIFIR3) THEN
         IF (IAA.EQ.NUMAAF.AND.FAMTYP(RESTYP(IAA)).NE.7) THEN
            IF (WIFPAR(1012).NE.0) THEN
               CALL GVSTTB ('?NEWB229')
               CALL SHOIAA (IAA)
               PRINT*,IAA,' ',ONESA3(IAA),' (',NUMNAM(IAA),')',
     +          CHAINN(1,IAA),CHAINN(2,IAA),SOUADM(1,CHAINN(2,IAA)),
     +          SOUADM(2,CHAINN(2,IAA))
               CALL SHOSOU
              CALL MOL010 ('?M3868')
              CALL GVSKIL
            WIFIR3=.TRUE.
            END IF
         ELSE IF (IAA.LT.NUMAAT.AND.CHAINN(2,IAA).NE.CHAINN(2,IAA+1)) 
     +       THEN
            IF (WIFPAR(1012).NE.0) THEN
               CALL GVSTTB ('?NEWB230')
               CALL GVSTTI2 ('?M3866',CHAINN(2,IAA),CHAINN(2,IAA+1))
               CALL GVSTTI2 ('?M3867',IAA,IAA+1)
               CALL SHOSOU
            END IF
            WIFIR3=.TRUE.
         END IF
      END IF



      IF (IAA.EQ.NUMAAF) WIFIR3=.TRUE.



  998 CONTINUE


      RETURN
      END
      LOGICAL FUNCTION WIFIRX(IAA)

















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







      WIFIRX=.FALSE.
      IF (.NOT.WIFIRI(IAA)) THEN
         CALL GVSTTB ('?ROORR3')
         CALL GVSKIL
         GOTO 998
      END IF
      IF (CHAINN(2,IAA).LE.0.OR.CHAINN(2,IAA).GT.NUMSOU) THEN
         CALL GVSTTI ('?ROOCN23',IAA)
         CALL GVSKIL
         GOTO 998
      END IF
      IF (IAA.GT.NUMAAF) THEN
         CALL GVSKIL
         GOTO 998
      END IF
      IF (SOUADM(11,CHAINN(2,IAA)).NE.0) GOTO 998
      IF (.NOT.WIFIRA(IAA)) GOTO 998



      IF (IAA.EQ.NUMAAF) THEN
         WIFIRX=.TRUE.
      ELSE IF (.NOT.WIFIR3(IAA)) THEN
         GOTO 998
      ELSE
         WIFIRX=(IAA.EQ.SOUADM(2,CHAINN(2,IAA))).AND.
     +    (CHANAM(IAA).NE.CHANAM(IAA+1).OR.
     +     MODNMB(IAA).NE.MODNMB(IAA+1)).OR.
     +    (.NOT.WIFIRA(IAA+1))
      END IF



  998 CONTINUE


      RETURN
      END
      LOGICAL FUNCTION WIFIR4(IAA)

















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







      WIFIR4=.FALSE.
      IF (.NOT.WIFIRI(IAA)) THEN
         CALL GVSTTB ('?ROORR4')
         CALL GVSKIL
         GOTO 998
      END IF
      IF (RESTYP(IAA).LT.0.OR.RESTYP(IAA).GT.NUMUA) THEN
         CALL GVSTTB ('?ROORT4')
         CALL GVSKIL
         GOTO 998
      END IF



      IF (WIFIRM(IAA)) GOTO 998



      WIFIR4=FAMTYP(RESTYP(IAA)).EQ.4



  998 CONTINUE


      RETURN
      END
      LOGICAL FUNCTION WIFIR6(IAA)

















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







      WIFIR6=.FALSE.
      IF (.NOT.WIFIRI(IAA)) THEN
         CALL GVSTTB ('?ROORR6')
         CALL GVSKIL
         GOTO 998
      END IF
      IF (RESTYP(IAA).LT.0.OR.RESTYP(IAA).GT.NUMUA) THEN
         CALL GVSTTB ('?ROORT1')
         CALL GVSKIL
         GOTO 998
      END IF



      WIFIR6=FAMTYP(RESTYP(IAA)).EQ.6



  998 CONTINUE


      RETURN
      END
      LOGICAL FUNCTION WIFIRA(IAA)

















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







      WIFIRA=.FALSE.
      IF (.NOT.WIFIRI(IAA)) THEN
         CALL GVSTTI3 ('?ROORRA',IAA,NUMAAF,NUMAAT)
         GOTO 998
      END IF
      IF (CHAINN(2,IAA).LE.0.OR.CHAINN(2,IAA).GT.NUMSOU) THEN
         CALL GVSTTI2 ('?ROOCN2A',IAA,CHAINN(2,IAA))
         GOTO 998
      END IF



      WIFIRA=SOUADM(5,CHAINN(2,IAA)).EQ.1



  998 CONTINUE


      RETURN
      END
      LOGICAL FUNCTION WIFIRB(IAA)

















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







      WIFIRB=.FALSE.



      IF (.NOT.WIFIRI(IAA)) THEN
         CALL GVSTTI ('?ROORRB',IAA)
         CALL GVSKIL
         GOTO 998
      END IF



      IF (WIFIRA(IAA)) THEN
         IAT=PNTAAC(IAA)
         JAT=PNTAAS(IAA)+4
         IF (JAT.GT.PNTAAE(IAA)) JAT=IAT
         IF (XYZNUL(IAT).OR.XYZNUL(JAT)) GOTO 998
         DO 10 IAT=PNTAAS(IAA),PNTAAE(IAA)
            IF (IAT.NE.PNTAAC(IAA).AND.IAT.NE.JAT) THEN
               IF (.NOT.XYZNUL(IAT)) GOTO 998
            END IF
   10    CONTINUE
         WIFIRB=.TRUE.
      END IF



  998 CONTINUE


      RETURN
      END
      LOGICAL FUNCTION WIFIRC(IAA)

















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







      WIFIRC=.FALSE.



      IF (.NOT.WIFIRI(IAA)) THEN
         CALL GVSTTI ('?ROORRC',IAA)
         CALL GVSKIL
         GOTO 998
      END IF



      IF (WIFIRA(IAA)) THEN
         IF (XYZNUL(PNTAAC(IAA))) GOTO 998
         DO 10 IAT=PNTAAS(IAA),PNTAAE(IAA)
            IF (IAT.NE.PNTAAC(IAA)) THEN
               IF (.NOT.XYZNUL(IAT)) GOTO 998
            END IF
   10    CONTINUE
         WIFIRC=.TRUE.
      END IF



  998 CONTINUE


      RETURN
      END
      LOGICAL FUNCTION WIFIRD(IAA)

















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







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



      IF (CHAINN(2,IAA).LE.0.OR.CHAINN(2,IAA).GT.NUMSOU) THEN
         CALL GVSTTI ('?ROOCN2D',IAA)
         CALL GVSKIL
         GOTO 998
      END IF



      IF (WIFIRO(IAA).OR.WIFIRH(IAA)) GOTO 998



      IF (SOUADM(5,CHAINN(2,IAA)).EQ.2.OR.
     +    SOUADM(5,CHAINN(2,IAA)).EQ.4.OR.
     +    SOUADM(5,CHAINN(2,IAA)).EQ.6) THEN



         IF (SOUADM(5,CHAINN(2,IAA)).EQ.4) THEN
            IF (BOUND_TO(1,PNTAAS(IAA)).NE.0.OR.
     +          BOUND_TO(2,PNTAAS(IAA)).NE.0.OR.
     +          BOUND_TO(3,PNTAAS(IAA)).NE.0.OR.
     +          BOUND_TO(4,PNTAAS(IAA)).NE.0.OR.
     +          BOUND_TO(5,PNTAAS(IAA)).NE.0.OR.
     +          BOUND_TO(6,PNTAAS(IAA)).NE.0.OR.
     +          BOUND_TO(7,PNTAAS(IAA)).NE.0.OR.
     +          BOUND_TO(8,PNTAAS(IAA)).NE.0) GOTO 998
         END IF
         WIFIRD=.TRUE.
      END IF



  998 CONTINUE


      RETURN
      END
      LOGICAL FUNCTION WIFIRE(IAA)

















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INTEGER       IAA, IAT, JAT, INDAA3
      REAL          WIFDST
      LOGICAL       WIFIRI, WIFIRR, T54EQUAL







      WIFIRE=.FALSE.
      IF (.NOT.WIFIRI(IAA)) THEN
         WIFIRE=.FALSE.
         CALL GVSTTB ('?ROORROX')
         CALL GVSKIL
         GOTO 998
      END IF



      IAT=PNTAAS(IAA)



      IF (PNTAAS(IAA)+1.EQ.PNTAAE(IAA)) THEN
         IF (INDAA3(ONESA3(IAA)).NE.0) THEN
            IF ((T54EQUAL(ONESAT(PNTAAS(IAA)),' O2 ').OR.
     +          T54EQUAL(ONESAT(PNTAAS(IAA)),' O  ')).AND.
     +          PROTON(PNTAAS(IAA)+1)) THEN
               WIFIRE=.TRUE.
               GOTO 998
            END IF
         END IF
      END IF



      JAT=BOUND_TO(1,IAT)
      IF (JAT.EQ.0) GOTO 998
      IF (PNTAAS(IAA)+1.NE.PNTAAE(IAA)) GOTO 998
      IF (WIFDST(JAT,PNTAAS(IAA)+1).GT.1.25) GOTO 998
      IF (BOUND_TO(1,JAT).NE.IAT.AND.BOUND_TO(2,JAT).NE.IAT.AND.
     +    BOUND_TO(3,JAT).NE.IAT.AND.BOUND_TO(4,JAT).NE.IAT.AND.
     +    BOUND_TO(5,JAT).NE.IAT.AND.BOUND_TO(6,JAT).NE.IAT.AND.
     +    BOUND_TO(7,JAT).NE.IAT.AND.BOUND_TO(8,JAT).NE.IAT) GOTO 998
      IF (PINIAA(JAT).NE.3) GOTO 998
      IF (.NOT.WIFIRR(ATIAA(JAT))) GOTO 998



      WIFIRE=.TRUE.



  998 CONTINUE


      RETURN
      END
      LOGICAL FUNCTION WIFIRF(IAA)

















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







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



      IF (CHAINN(2,IAA).LE.0.OR.CHAINN(2,IAA).GT.NUMSOU) THEN
         CALL GVSTTI ('?ROOCN2D',IAA)
         CALL GVSKIL
         GOTO 998
      END IF



      IF (WIFIRO(IAA).OR.WIFIRH(IAA)) GOTO 998



      WIFIRF=(SOUADM(5,CHAINN(2,IAA)).EQ.2.OR.
     + SOUADM(5,CHAINN(2,IAA)).EQ.6) 



  998 CONTINUE


      RETURN
      END
      LOGICAL FUNCTION WIFIRK(IAA)

















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







      WIFIRK=.FALSE.
      IF (CHAINN(2,IAA).LE.0.OR.CHAINN(2,IAA).GT.NUMSOU) THEN
         CALL GVSTTI2 ('?ROOCN2K',IAA,CHAINN(2,IAA))
         CALL GVSKIL
         GOTO 998
      END IF



      IAT=PNTAAS(IAA)
      IF (WIFIRA(IAA).AND.IAT+3.LE.PNTAAE(IAA).AND.
     +    .NOT.XYZNUL(IAT).AND..NOT.XYZNUL(IAT+1).AND.
     +    .NOT.XYZNUL(IAT+2).AND..NOT.XYZNUL(IAT+3)) WIFIRK=.TRUE.
      WIFIRK=WIFIRK.AND.ISATOK(IAT).AND.ISATOK(IAT+1).AND.
     + ISATOK(IAT+2).AND.ISATOK(IAT+3)



  998 CONTINUE


      RETURN
      END
      LOGICAL FUNCTION WIFIRNO(IAA)

















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







      WIFIRNO=.FALSE.
      IF (CHAINN(2,IAA).LE.0.OR.CHAINN(2,IAA).GT.NUMSOU) THEN
         CALL GVSTTI2 ('?ROOCN2NO',IAA,CHAINN(2,IAA))
         CALL GVSKIL
         GOTO 998
      END IF



      IF (.NOT.ISATOK(PNTAAS(IAA))) GOTO 998
      DO 10 IAT=PNTAAS(IAA)+1,PNTAAE(IAA)
         IF (ISATOK(IAT)) GOTO 998
 10   CONTINUE



      WIFIRNO=.TRUE.



  998 CONTINUE


      RETURN
      END
      LOGICAL FUNCTION WIFIRM(IAA)

















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INTEGER       IAA, EN, ELMZ
      LOGICAL       WIFIRI, WIFIRO, WIFIRH, WIFIRW







      WIFIRM=.FALSE.



      IF (.NOT.WIFIRI(IAA)) THEN
         CALL GVSTTI ('?ROORRD',IAA)
         CALL GVSKIL
         GOTO 998
      END IF



      IF (WIFIRO(IAA)) GOTO 998
      IF (WIFIRH(IAA)) GOTO 998
      IF (WIFIRW(IAA)) GOTO 998



      EN=ELMZ(PNTAAS(IAA))
      IF (EN.EQ.1.OR.EN.EQ.2.OR.EN.EQ.5.OR.EN.EQ.6.OR.EN.EQ.7.OR.
     + EN.EQ.10.OR.EN.EQ.13.OR.EN.EQ.14.OR.EN.EQ.15.OR.EN.EQ.16)GOTO 998



      IF (CHAINN(2,IAA).LE.0.OR.CHAINN(2,IAA).GT.NUMSOU) THEN
         CALL GVSTTI ('?ROOCN2D',IAA)
         CALL GVSKIL
         GOTO 998
      END IF



      IF (SOUADM(5,CHAINN(2,IAA)).EQ.4) WIFIRM=.TRUE.



  998 CONTINUE


      RETURN
      END
      LOGICAL FUNCTION WIFIRMM(IAA)

















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INTEGER       IAA, EN, ELMZ
      LOGICAL       WIFIRI, WIFIRO, WIFIRH, WIFIRW, ISMETAL







      WIFIRMM=.FALSE.



      IF (.NOT.WIFIRI(IAA)) THEN
         CALL GVSTTI ('?ROORRD',IAA)
         CALL GVSKIL
         GOTO 998
      END IF



      IF (WIFIRO(IAA)) GOTO 998
      IF (WIFIRH(IAA)) GOTO 998
      IF (WIFIRW(IAA)) GOTO 998



      EN=ELMZ(PNTAAS(IAA))
      IF (EN.EQ.1.OR.EN.EQ.2.OR.EN.EQ.5.OR.EN.EQ.6.OR.EN.EQ.7.OR.
     + EN.EQ.10.OR.EN.EQ.13.OR.EN.EQ.14.OR.EN.EQ.15.OR.EN.EQ.16)GOTO 998



      IF (CHAINN(2,IAA).LE.0.OR.CHAINN(2,IAA).GT.NUMSOU) THEN
         CALL GVSTTI ('?ROOCN2D',IAA)
         CALL GVSKIL
         GOTO 998
      END IF
      IF (.NOT.ISMETAL(PNTAAS(IAA))) GOTO 998



      IF (SOUADM(5,CHAINN(2,IAA)).EQ.4) WIFIRMM=.TRUE.



  998 CONTINUE


      RETURN
      END
      LOGICAL FUNCTION WIFIRL(IAA)

















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







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



      IF (IAA.EQ.NUMAAT) THEN
         WIFIRL=.TRUE.
         GOTO 998
      END IF



      IF (MODNMB(IAA).EQ.0) GOTO 998
      IF (MODNMB(IAA).EQ.MODNMB(IAA+1)) GOTO 998



      WIFIRL=.TRUE.



  998 CONTINUE


      RETURN
      END
      LOGICAL FUNCTION WIFIRZ(IAA)

















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







      WIFIRZ=.FALSE.



      IF (.NOT.WIFIRI(IAA)) THEN
         CALL GVSTTB ('?ROORRZ')
         CALL GVSKIL
         GOTO 998
      END IF
      IF (CHAINN(2,IAA).LE.0.OR.CHAINN(2,IAA).GT.NUMSOU) THEN
         CALL GVSTTI ('?ROOCN2Z',IAA)
         CALL GVSKIL
         GOTO 998
      END IF



      WIFIRZ=SOUADM(5,CHAINN(2,IAA)).EQ.7



  998 CONTINUE


      RETURN
      END
      LOGICAL FUNCTION WIFIRI(IAA)

















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INTEGER       IAA







      WIFIRI=IAA.GE.1.AND.IAA.LE.NUMAAT





      RETURN
      END
      LOGICAL FUNCTION WIFIRN(IAA)

















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







      WIFIRN=.FALSE.



      IF (.NOT.WIFIRI(IAA)) THEN
         CALL GVSTTB ('?ROORRN')

         GOTO 998
      END IF
      IF (CHAINN(2,IAA).LE.0.OR.CHAINN(2,IAA).GT.NUMSOU) THEN
         CALL GVSTTI ('?ROOCN2N',IAA)

         GOTO 998
      END IF



      WIFIRN=SOUADM(5,CHAINN(2,IAA)).EQ.3



  998 CONTINUE


      RETURN
      END
      LOGICAL FUNCTION WIFIRND(IAA)

















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







      WIFIRND=.FALSE.



      IF (.NOT.WIFIRI(IAA)) THEN
         CALL GVSTTB ('?ROORRND')
         CALL GVSKIL
         GOTO 998
      END IF
      IF (CHAINN(2,IAA).LE.0.OR.CHAINN(2,IAA).GT.NUMSOU) THEN
         CALL GVSTTI ('?ROOCN2N',IAA)
         CALL GVSKIL
         GOTO 998
      END IF



      WIFIRND=ONESA3(IAA)(1:1).EQ.'D'.AND.
     +        SOUADM(5,CHAINN(2,IAA)).EQ.3



  998 CONTINUE


      RETURN
      END
      LOGICAL FUNCTION WIFIRNR(IAA)

















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







      WIFIRNR=.FALSE.



      IF (.NOT.WIFIRI(IAA)) THEN
         CALL GVSTTB ('?ROORRNR')
         CALL GVSKIL
         GOTO 998
      END IF
      IF (CHAINN(2,IAA).LE.0.OR.CHAINN(2,IAA).GT.NUMSOU) THEN
         CALL GVSTTI ('?ROOCN2N',IAA)
         CALL GVSKIL
         GOTO 998
      END IF



      WIFIRNR=ONESA3(IAA)(1:1).EQ.'O'.AND.
     +        SOUADM(5,CHAINN(2,IAA)).EQ.3



  998 CONTINUE


      RETURN
      END
      LOGICAL FUNCTION WIFIRO(IAA)

















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INTEGER       IAA, IAT, JAT, JAA, INDAA3, ELMZ
      LOGICAL       WIFIRI, WIFIRR, WIFIRA, WIFIRN







      WIFIRO=.FALSE.
      IF (.NOT.WIFIRI(IAA)) THEN
         WIFIRO=.FALSE.
         CALL GVSTTB ('?ROORROX')
         CALL GVSKIL
         GOTO 998
      END IF



      IAT=PNTAAS(IAA)
      JAT=BOUND_TO(1,IAT)
      IF (JAT.NE.0) THEN
         JAA=ATIAA(JAT)
         IF (.NOT.WIFIRA(JAA).AND.(.NOT.WIFIRN(JAA))) GOTO 998
      END IF



      IF (PNTAAS(IAA).EQ.PNTAAE(IAA)) THEN
         IF (INDAA3(ONESA3(IAA)).NE.0) THEN
            IF (ONESAT(PNTAAS(IAA)).EQ.' O2  ')THEN
               WIFIRO=.TRUE.
               GOTO 998
            END IF
            IF (ONESAT(PNTAAS(IAA)).EQ.' OXT ')THEN
               WIFIRO=.TRUE.
               GOTO 998
            END IF
            IF (ONESAT(PNTAAS(IAA))(1:2).EQ.' O'.AND.
     +          ONESAT(PNTAAS(IAA))(3:3).EQ.''''.AND.
     +          ONESAT(PNTAAS(IAA))(4:4).EQ.'''') THEN
               WIFIRO=.TRUE.
               GOTO 998
            END IF
         END IF
      END IF



      IF (PNTAAS(IAA).NE.PNTAAE(IAA)) GOTO 998
      IF (PROTON(PNTAAS(IAA))) GOTO 998
      IF (JAT.EQ.0) GOTO 998
      IF (BOUND_TO(1,JAT).NE.IAT.AND.BOUND_TO(2,JAT).NE.IAT.AND.
     +    BOUND_TO(3,JAT).NE.IAT.AND.BOUND_TO(4,JAT).NE.IAT.AND.
     +    BOUND_TO(5,JAT).NE.IAT.AND.BOUND_TO(6,JAT).NE.IAT.AND.
     +    BOUND_TO(7,JAT).NE.IAT.AND.BOUND_TO(8,JAT).NE.IAT) GOTO 998
      IF (PINIAA(JAT).NE.3) GOTO 998
      IF (.NOT.WIFIRR(ATIAA(JAT))) GOTO 998
      IF (ELMZ(IAT).NE.8.OR.ELMZ(JAT).NE.6) GOTO 998



      WIFIRO=.TRUE.



  998 CONTINUE


      RETURN
      END
      LOGICAL FUNCTION WIFOXS(IAA)

















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INTEGER       IAA, IAT, JAT, JAA, ELMZ
      LOGICAL       WIFIRI, GVFISN, WIFIRZ







      WIFOXS=.FALSE.
      IF (.NOT.WIFIRI(IAA)) THEN
         WIFOXS=.FALSE.
         CALL GVSTTB ('?ROORROX')
         CALL GVSKIL
         GOTO 998
      END IF



      IAT=PNTAAS(IAA)
      JAT=BOUND_TO(1,IAT)
      IF (JAT.NE.0) THEN
         JAA=ATIAA(JAT)
         IF (.NOT.WIFIRZ(JAA)) GOTO 998
      END IF



      IF (PNTAAS(IAA).EQ.PNTAAE(IAA)) THEN
         IF (WIFIRZ(IAA)) THEN
            IF (ONESAT(PNTAAS(IAA))(1:2).EQ.' O'.AND.
     +          GVFISN(ONESAT(PNTAAS(IAA))(3:3))) THEN
               WIFOXS=.TRUE.
               GOTO 998
            END IF
         END IF
      END IF



      IF (PNTAAS(IAA).NE.PNTAAE(IAA)) GOTO 998
      IF (PROTON(PNTAAS(IAA))) GOTO 998
      IF (JAT.EQ.0) GOTO 998
      IF (BOUND_TO(1,JAT).NE.IAT.AND.BOUND_TO(2,JAT).NE.IAT.AND.
     +    BOUND_TO(3,JAT).NE.IAT.AND.BOUND_TO(4,JAT).NE.IAT.AND.
     +    BOUND_TO(5,JAT).NE.IAT.AND.BOUND_TO(6,JAT).NE.IAT.AND.
     +    BOUND_TO(7,JAT).NE.IAT.AND.BOUND_TO(8,JAT).NE.IAT) GOTO 998
      IF (.NOT.WIFIRZ(ATIAA(JAT))) GOTO 998
      IF (ELMZ(IAT).NE.8.OR.ELMZ(JAT).NE.6) GOTO 998



      WIFOXS=.TRUE.



  998 CONTINUE


      RETURN
      END
      LOGICAL FUNCTION WIFIRR(IAA)

















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







      WIFIRR=.FALSE.



      IF (.NOT.WIFIRI(IAA)) THEN
         CALL GVSTTI2 ('?ROORRR',IAA,NUMAAT)
         CALL GVSKIL
         GOTO 998
      END IF
      IF (CHAINN(2,IAA).LE.0.OR.CHAINN(2,IAA).GT.NUMSOU) THEN
         CALL GVSTTI ('?ROOCN2R',IAA)
         CALL GVSKIL
         GOTO 998
      END IF



      IF (PNTAAE(IAA).EQ.PNTAAS(IAA)) THEN
         IAT=PNTAAS(IAA)
         IF (WIFIC1(ONESAT(IAT)).OR.WIFIC2(ONESAT(IAT))) GOTO 998
      END IF



      WIFIRR=FAMTYP(RESTYP(IAA)).EQ.1.OR.
     +       FAMTYP(RESTYP(IAA)).EQ.3.OR.
     +       FAMTYP(RESTYP(IAA)).EQ.7



  998 CONTINUE


      RETURN
      END
      LOGICAL FUNCTION WIFIRS(IAA)

















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







      WIFIRS=.FALSE.



      IF (.NOT.WIFIRI(IAA)) THEN
         CALL GVSTTB ('?ROORRS')
         CALL GVSKIL
         GOTO 998
      END IF
      IF (NUMCYS.LE.0.OR.RESTYP(IAA).NE.2) GOTO 998



      DO 10 ICYS=1,NUMCYS
         IF (IAA.EQ.CYSCYS(1,ICYS).OR.IAA.EQ.CYSCYS(2,ICYS)) THEN
            WIFIRS=.TRUE.
            GOTO 998
         END IF
   10 CONTINUE



  998 CONTINUE


      RETURN
      END
      LOGICAL FUNCTION WIFIRW(IAA)

















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







      WIFIRW=.FALSE.
      IF (.NOT.WIFIRI(IAA)) THEN
         CALL GVSTTI2 ('?ROORRW',NUMAAT,IAA)
         CALL GVSKIL
         GOTO 998
      END IF



      IF (CHAINN(2,IAA).LE.0.OR.CHAINN(2,IAA).GT.NUMSOU) THEN
         CALL GVSTTI ('?ROOCN2W',IAA)
         CALL GVSKIL
         GOTO 998
      END IF



      WIFIRW=SOUADM(5,CHAINN(2,IAA)).EQ.5



  998 CONTINUE


      RETURN
      END
      LOGICAL FUNCTION WIFIRH(IAA)

















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







      WIFIRH=.FALSE.
      IF (IAA.LT.1.OR.IAA.GT.NUMAAT) THEN
         CALL GVSTTB ('?ROORIRH')
         CALL GVSKIL
         GOTO 998
      END IF



      DO 10 IAT=PNTAAS(IAA),PNTAAE(IAA)
         IF (.NOT.PROTON(IAT)) GOTO 998
   10 CONTINUE



      WIFIRH=.TRUE.



  998 CONTINUE


      RETURN
      END
      LOGICAL FUNCTION WIFIRP(IAA)

















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INTEGER       IAT, JAT, JAA, IAA, IBND
      LOGICAL       WIFIRR







      WIFIRP=.FALSE.
      IF (IAA.LT.1.OR.IAA.GT.NUMAAT) THEN
         CALL GVSTTB ('?ROORIRP')
         CALL GVSKIL
         GOTO 998
      END IF



      DO 20 IAT=PNTAAS(IAA),PNTAAE(IAA)
         IF (.NOT.PROTON(IAT)) GOTO 998
         DO 10 IBND=1,8
            JAT=BOUND_TO(IBND,IAT)
            IF (JAT.EQ.0) GOTO 10
            JAA=ATIAA(JAT)
            IF (WIFIRR(JAA)) GOTO 20
   10    CONTINUE
         GOTO 998
   20 CONTINUE



      WIFIRP=.TRUE.



  998 CONTINUE


      RETURN
      END
      LOGICAL FUNCTION WIFISA(ISOUP)

















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INTEGER       ISOUP







      WIFISA=.FALSE.
      IF (ISOUP.LT.1.OR.ISOUP.GT.NUMSOU) THEN
         CALL GVSTTB ('?ROORSA')
         CALL GVSKIL
         GOTO 998
      END IF



      WIFISA=SOUADM(5,ISOUP).EQ.1



  998 CONTINUE


      RETURN
      END
      LOGICAL FUNCTION WIFISB(ISOUP)

















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INTEGER       ISOUP, IAT, IAA, JAA, JAT
      LOGICAL       WIFIRR







      IF (SOUADM(5,ISOUP).NE.2.AND.SOUADM(5,ISOUP).NE.4.AND.
     +    SOUADM(5,ISOUP).NE.6) THEN
         WIFISB=.FALSE.
         GOTO 998
      END IF



      IAA=SOUADM(1,ISOUP)
      WIFISB=.FALSE.



      DO 10 IAT=PNTAAS(IAA),PNTAAE(IAA)
         JAT=BOUND_TO(1,IAT)
         IF (JAT.NE.0) THEN
            JAA=ATIAA(JAT)
            IF (WIFIRR(JAA)) THEN
               WIFISB=.TRUE.
               GOTO 998
            END IF
         END IF
 10   CONTINUE



  998 CONTINUE


      RETURN
      END   
      LOGICAL FUNCTION WIFISC(ISOUP)

















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INTEGER       IAA, ISOUP
      LOGICAL       WIFIRC







      WIFISC=.FALSE.



      IF (ISOUP.LT.1.OR.ISOUP.GT.NUMSOU) THEN
         CALL GVSTTB ('?ROORSC')
         CALL GVSKIL
         GOTO 998
      END IF



      DO 10 IAA=SOUADM(1,ISOUP),SOUADM(2,ISOUP)
         IF (.NOT.WIFIRC(IAA)) GOTO 998
   10 CONTINUE
      WIFISC=.TRUE.



  998 CONTINUE


      RETURN
      END
      LOGICAL FUNCTION WIFISD(ISOUP)

















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INTEGER       ISOUP







      WIFISD=.FALSE.
      IF (ISOUP.LT.1.OR.ISOUP.GT.NUMSOU) THEN
         CALL GVSTTB ('?ROORSD')
         CALL GVSTTI2 ('?M3865',NUMSOU,ISOUP)
         CALL GVSKIL
         GOTO 998
      END IF



      WIFISD=SOUADM(5,ISOUP).EQ.2.OR.
     +       SOUADM(5,ISOUP).EQ.4.OR.
     +       SOUADM(5,ISOUP).EQ.6



  998 CONTINUE


      RETURN
      END
      LOGICAL FUNCTION WIFISI(ISOUP)

















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INTEGER       ISOUP







      WIFISI=.FALSE.
      IF (ISOUP.LT.1.OR.ISOUP.GT.NUMSOU) THEN
         CALL GVSTTB ('?ROORSD')
         CALL GVSKIL
         GOTO 998
      END IF



      WIFISI=SOUADM(5,ISOUP).EQ.4



  998 CONTINUE


      RETURN
      END
      LOGICAL FUNCTION WIFISZ(ISOUP)

















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INTEGER       ISOUP







      WIFISZ=.FALSE.
      IF (ISOUP.LT.1.OR.ISOUP.GT.NUMSOU) THEN
         CALL GVSTTB ('?ROORSZ')
         CALL GVSKIL
         GOTO 998
      END IF



      WIFISZ=SOUADM(5,ISOUP).EQ.7



  998 CONTINUE


      RETURN
      END
      LOGICAL FUNCTION WIFISN(ISOUP)

















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INTEGER       ISOUP







      WIFISN=.FALSE.
      IF (ISOUP.LT.1.OR.ISOUP.GT.NUMSOU) THEN
         CALL GVSTTB ('?ROORSN')
         CALL GVSKIL
         GOTO 998
      END IF



      WIFISN=SOUADM(5,ISOUP).EQ.3



  998 CONTINUE


      RETURN
      END
      LOGICAL FUNCTION WIFISO(ISOUP)

















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INTEGER       ISOUP
      LOGICAL       WIFIRO







      WIFISO=.FALSE.
      IF (ISOUP.LT.1.OR.ISOUP.GT.NUMSOU) THEN
         CALL GVSTTI2 ('?ROORSO',ISOUP,NUMSOU)
         CALL GVSKIL
         GOTO 998
      END IF



      WIFISO=WIFIRO(SOUADM(1,ISOUP))



  998 CONTINUE


      RETURN
      END
      LOGICAL FUNCTION WIFISH(ISOUP)

















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INTEGER       IAT, ISOUP







      WIFISH=.FALSE.
      IF (ISOUP.LT.1.OR.ISOUP.GT.NUMSOU) THEN
         CALL GVSTTI2 ('?ROORISH',ISOUP,NUMSOU)
         CALL SHOSOU
         CALL GVSKIL
         GOTO 998
      END IF



      DO 10 IAT=PNTAAS(SOUADM(1,ISOUP)),PNTAAE(SOUADM(2,ISOUP))
         IF (.NOT.PROTON(IAT)) GOTO 998
   10 CONTINUE



      WIFISH=.TRUE.



  998 CONTINUE


      RETURN
      END
      LOGICAL FUNCTION WIFISR(ISOUP)

















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INTEGER       ISOUP
      LOGICAL       WIFIRO







      WIFISR=.FALSE.
      IF (ISOUP.LT.1.OR.ISOUP.GT.NUMSOU) THEN
         CALL GVSTTB ('?ROORSR')
         CALL GVSKIL
         GOTO 998
      END IF
      IF (WIFIRO(SOUADM(1,ISOUP))) GOTO 998



      WIFISR=(SOUADM(5,ISOUP).EQ.1.OR.SOUADM(5,ISOUP).EQ.3.OR.
     + SOUADM(5,ISOUP).EQ.7)



  998 CONTINUE


      RETURN
      END
      LOGICAL FUNCTION WIFISW(ISOUP)

















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INTEGER       ISOUP







      WIFISW=.FALSE.
      IF (ISOUP.LT.1.OR.ISOUP.GT.NUMSOU) THEN
         CALL GVSTTB ('?ROORSW')
         CALL GVSKIL
         GOTO 998
      END IF



      WIFISW=(SOUADM(5,ISOUP).EQ.5)



  998 CONTINUE


      RETURN
      END
      LOGICAL FUNCTION WIFITI(IAT)

















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INTEGER       IAT







      WIFITI=IAT.GE.1.AND.IAT.LE.NUMATF





      RETURN
      END
      LOGICAL FUNCTION WIFITC(IAT)

















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







      WIFITC=.FALSE.



      IF (.NOT.WIFITI(IAT)) THEN
         CALL GVSTTB ('?ROORROY')
         CALL GVSKIL
         GOTO 998
      END IF



      IAA=ATIAA(IAT)
      IF (FAMTYP(RESTYP(IAA)).NE.1) GOTO 998
      IF (PINIAA(IAT).NE.3) GOTO 998



      WIFITC=.TRUE.



  998 CONTINUE


      RETURN
      END
      LOGICAL FUNCTION WIFITD(IAT)

















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







      WIFITD=.FALSE.



      IF (.NOT.WIFITI(IAT)) THEN


         GOTO 998
      END IF



      IAA=ATIAA(IAT)
      IF (FAMTYP(RESTYP(IAA)).EQ.2.OR.
     +    FAMTYP(RESTYP(IAA)).EQ.4.OR.
     +    FAMTYP(RESTYP(IAA)).EQ.6) THEN
         WIFITD=.TRUE.
      END IF



  998 CONTINUE


      RETURN
      END
      LOGICAL FUNCTION WIFITO(IAT)

















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







      WIFITO=.FALSE.



      IAA=ATIAA(IAT)
      IF (.NOT.GVFIBN(IAA,1,NUMAAT)) THEN
         CALL GVSTTB ('IAA OOR IN ITO')
         GOTO 999
      END IF
      IF (WIFIRO(IAA)) THEN
         WIFITO=.TRUE.
         GOTO 998
      END IF

      GOTO 998



  999 CONTINUE
      CALL GVSEIW ('WIFITO')



  998 CONTINUE


      RETURN
      END   
      LOGICAL FUNCTION WIFIOH(IAT)

















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INTEGER       IAT, JAA, JAT
      LOGICAL       WIFITI, WIFIR1, HASBOUND, WIFIRA







      WIFIOH=.FALSE.



      IF (.NOT.WIFITI(IAT)) THEN
         CALL GVSTTB ('?ROORROH')
         CALL GVSKIL
         GOTO 998
      END IF
      IF (.NOT.PROTON(IAT)) GOTO 998
      IF (.NOT.HASBOUND(IAT,JAT)) GOTO 998
      JAA=ATIAA(JAT)
      IF (WIFIR1(JAA).AND.WIFIRA(JAA).AND.JAT.EQ.PNTAAS(JAA)) GOTO 998



      WIFIOH=.TRUE.



  998 CONTINUE


      RETURN
      END
      LOGICAL FUNCTION WIFIC1(CHAR)

















      IMPLICIT      NONE
      CHARACTER*(*) CHAR







      IF (LEN(CHAR).LT.4) THEN
         CALL GVST6C ('?M2982',CHAR,.FALSE.)
         WIFIC1=.FALSE.
         RETURN
      END IF



      CALL GVSCUC (CHAR)



      WIFIC1=(CHAR(1:4).EQ.'O1  '.OR.CHAR(1:4).EQ.' O1 '.OR.
     +        CHAR(1:4).EQ.' OT1'.OR.CHAR(1:4).EQ.'OT1 '.OR.
     +        CHAR(1:4).EQ.' O  '.OR.CHAR(1:4).EQ.'  O '.OR.
     +       (CHAR(1:2).EQ.' O' .AND.CHAR(3:3).EQ.''''   .AND.
     +        CHAR(4:4).EQ.' '))





      RETURN
      END
      LOGICAL FUNCTION WIFIC2(CHARIN)

















      IMPLICIT      NONE
      CHARACTER*10  CHAR
      CHARACTER*(*) CHARIN







      CALL GVSSTX (CHAR,CHARIN)
      CALL GVSCUC (CHAR)



      WIFIC2=(CHAR(1:4).EQ.'OXT '.OR.CHAR(1:4).EQ.'O2  '.OR.
     +        CHAR(1:4).EQ.' O2 '.OR.CHAR(1:4).EQ.' OXT'.OR.
     +        CHAR(1:4).EQ.'  O2'.OR.CHAR(1:4).EQ.'  OT'.OR.
     +        CHAR(1:4).EQ.' OT '.OR.CHAR(1:4).EQ.' OT2'.OR.
     +        CHAR(1:4).EQ.'OT  '.OR.CHAR(1:4).EQ.'OT2 '.OR.
     +        (CHAR(1:2).EQ.' O'.AND.CHAR(3:3).EQ.''''.AND.
     +        CHAR(4:4).EQ.''''))





      RETURN
      END
      LOGICAL FUNCTION WIFITW(IAT)



















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







      WIFITW=.FALSE.
      IF (.NOT.WIFITI(IAT)) THEN
         CALL GVSTTI2 ('?R00004',IAT,NUMATF)
         CALL GVSKIL
         GOTO 998
      END IF
      IAA=ATIAA(IAT)
      IF (.NOT.WIFIRI(IAA)) THEN
         CALL GVSTTB ('?ROORRO4')
         CALL GVSKIL
         GOTO 998
      END IF
      IF (CHAINN(2,IAA).LE.0.OR.CHAINN(2,IAA).GT.NUMSOU) THEN
         CALL GVSTTI ('?ROOCN2TW',IAA)
         CALL GVSKIL
         GOTO 998
      END IF
      WIFITW=(SOUADM(5,CHAINN(2,IAA)).EQ.5)



  998 CONTINUE


      RETURN 
      END
      LOGICAL FUNCTION WIFITS(IAT)

















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







      WIFITS=.FALSE.



      IF (.NOT.WIFITI(IAT)) THEN
         CALL GVSTTI2 ('?R00004',IAT,NUMATF)
         CALL SHOIAA (ATIAA(IAT))
         CALL GVSKIL
         GOTO 998
      END IF
      IAA=ATIAA(IAT)
      IF (.NOT.WIFIRI(IAA)) THEN
         CALL GVSTTB ('?ROORRO5')
         CALL GVSKIL
         GOTO 998
      END IF
      IF (CHAINN(2,IAA).LE.0.OR.CHAINN(2,IAA).GT.NUMSOU) THEN
         CALL GVSTTI ('?ROOCN2TW',IAA)
         CALL GVSKIL
         GOTO 998
      END IF
      IF (PROTON(IAT)) GOTO 998



      WIFITS=(SOUADM(5,CHAINN(2,IAA)).EQ.4)



  998 CONTINUE


      RETURN 
      END
      LOGICAL FUNCTION WIFOXO(IAA)

















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INTEGER       IAA, JAA, JAT 
      LOGICAL       WIFIR3, WIFIRA, WIFITI, HASBOUND, WIFIRO







      WIFOXO=.FALSE.
      IF (WIFIRO(IAA)) GOTO 998
      IF (.NOT.WIFIRA(IAA)) GOTO 998
      IF (.NOT.WIFIR3(IAA)) GOTO 998



      IF (.NOT.HASBOUND(PNTAAS(IAA)+2,JAT)) GOTO 998
      IF (.NOT.WIFITI(JAT)) GOTO 999



      JAA=ATIAA(JAT)
      WIFOXO=WIFIRO(JAA)
      GOTO 998



  999 CONTINUE
      CALL GVSEIW ('WIFOXO')



  998 CONTINUE


      RETURN
      END   
      LOGICAL FUNCTION WIFOXE(IAA)

















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INTEGER       IAA, JAA, JAT 
      LOGICAL       WIFIR3, WIFIRA, WIFITI, HASBOUND, WIFIRO, WIFIRNO







      WIFOXE=.FALSE.
      IF (WIFIRO(IAA)) GOTO 998
      IF (.NOT.WIFIRA(IAA)) GOTO 998
      IF (.NOT.WIFIR3(IAA)) GOTO 998



      IF (.NOT.HASBOUND(PNTAAS(IAA)+2,JAT)) GOTO 998
      IF (.NOT.WIFITI(JAT)) GOTO 999



      JAA=ATIAA(JAT)
      IF (WIFIRO(JAA)) GOTO 998
      IF (WIFIRNO(JAA)) GOTO 998



      WIFOXE=.TRUE.
      GOTO 998



  999 CONTINUE
      CALL GVSEIW ('WIFOXE')



  998 CONTINUE


      RETURN
      END   
      LOGICAL FUNCTION WIFOXN(IAA)

















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INTEGER       IAA
      LOGICAL       WIFIRA, WIFIRO, WIFIRNO, WIFIRI







      WIFOXN=.FALSE.
      IF (WIFIRO(IAA)) GOTO 998
      IF (.NOT.WIFIRA(IAA)) GOTO 998
      IF (.NOT.WIFIRI(IAA+1)) GOTO 998



      WIFOXN=WIFIRNO(IAA+1).OR.SOUADM(11,CHAINN(2,IAA)).NE.0



  998 CONTINUE


      RETURN
      END   
      LOGICAL FUNCTION WIFOXC(IAA)

















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INTEGER       IAA, JAT
      LOGICAL       WIFIR3, WIFIRA, HASBOUND, WIFIRO







      WIFOXC=.FALSE.
      IF (WIFIRO(IAA)) GOTO 998
      IF (.NOT.WIFIRA(IAA)) GOTO 998
      IF (.NOT.WIFIR3(IAA)) GOTO 998



      WIFOXC=.NOT.HASBOUND(PNTAAS(IAA)+2,JAT)



  998 CONTINUE


      RETURN
      END   
      LOGICAL FUNCTION ISSOUPCA()

















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INTEGER       IAA, ISOUP, IISCA, INOTCA
      LOGICAL       WIFISA, WIFIRC







      ISSOUPCA=.FALSE.
      IISCA=0
      INOTCA=0



      DO 20 ISOUP=1,NUMSOU
         IF (.NOT.WIFISA(ISOUP)) GOTO 20
         DO 10 IAA=SOUADM(1,ISOUP),SOUADM(2,ISOUP)
            IF (WIFIRC(IAA)) THEN
               IISCA=IISCA+1
            ELSE
               INOTCA=INOTCA+1
            END IF
   10    CONTINUE
   20 CONTINUE
      IF (IISCA.LE.0) GOTO 998
      IF (FLOAT(IISCA+INOTCA)/FLOAT(IISCA).LT.20.0) THEN
         ISSOUPCA=.TRUE.
      END IF



  998 CONTINUE


      RETURN
      END
      LOGICAL FUNCTION ISSOUPNCC()

















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INTEGER       IAA, ISOUP, ISNCC, NOTNCC, IAT
      LOGICAL       WIFISA







      ISSOUPNCC=.FALSE.
      ISNCC=0
      NOTNCC=0



      DO 30 ISOUP=1,NUMSOU
         IF (.NOT.WIFISA(ISOUP)) GOTO 30
         DO 20 IAA=SOUADM(1,ISOUP),SOUADM(2,ISOUP)
            IF ((.NOT.ISATOK(PNTAAS(IAA))).OR.
     +          (.NOT.ISATOK(PNTAAS(IAA)+1)).OR.
     +          (.NOT.ISATOK(PNTAAS(IAA)+2))) THEN
               NOTNCC=NOTNCC+1
               GOTO 20
            END IF
            DO 10 IAT=PNTAAS(IAA)+3,PNTAAE(IAA)
               IF (ISATOK(IAT)) THEN
                  NOTNCC=NOTNCC+1
                  GOTO 20
               END IF
 10         CONTINUE
            ISNCC=ISNCC+1
 20      CONTINUE
 30   CONTINUE



      IF (ISNCC.LE.0) GOTO 998
      IF (FLOAT(ISNCC+NOTNCC)/FLOAT(ISNCC).LT.20.0) THEN
         ISSOUPNCC=.TRUE.
      END IF



  998 CONTINUE


      RETURN
      END
      LOGICAL FUNCTION ISSOUPUNK()



















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INTEGER       IAA, NUNK
      LOGICAL       CH4EQCH4







      NUNK=0
      DO 100 IAA=1,NUMAAF
         IF (CH4EQCH4(ONESA3(IAA),'UNK ')) NUNK=NUNK+1
  100 CONTINUE
      IF (NUNK.GT.NUMAAF/2.AND.NUNK.GT.8) THEN
         ISSOUPUNK=.TRUE.
      ELSE
         ISSOUPUNK=.FALSE.
      END IF





      RETURN
      END
      LOGICAL FUNCTION HASPROTON()



















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INTEGER       IAT







      HASPROTON=.FALSE.



      IF (WIFPAR(84).LE.0) GOTO 999



      DO 100 IAT=1,NUMATF
         IF (PROTON(IAT).AND.ISATOK(IAT)) THEN
            HASPROTON=.TRUE.
            GOTO 999
         END IF
  100 CONTINUE



  999 CONTINUE


      RETURN
      END
      LOGICAL FUNCTION AAHASPROTON(IAA)

















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







      AAHASPROTON=.FALSE.



      IF (WIFPAR(84).LE.0) GOTO 999



      DO 100 IAT=PNTAAS(IAA),PNTAAE(IAA)
         IF (PROTON(IAT).AND.ISATOK(IAT)) THEN
            AAHASPROTON=.TRUE.
            GOTO 999
         END IF
  100 CONTINUE



  999 CONTINUE


      RETURN
      END
      LOGICAL FUNCTION HASPROTONGB(IAA)

















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







      HASPROTONGB=.FALSE.



      IF (WIFPAR(84).LE.0) GOTO 999



      DO 100 IAT=PNTAAS(IAA),PNTAAE(IAA)
         IF (PROTON(IAT)) THEN
            HASPROTONGB=.TRUE.
            GOTO 999
         END IF
  100 CONTINUE



  999 CONTINUE


      RETURN
      END
      LOGICAL FUNCTION HASPROTEIN()



















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INTEGER       ISOUP







      DO 100 ISOUP=1,NUMSOU
         IF (SOUADM(5,ISOUP).EQ.1) THEN
            HASPROTEIN=.TRUE.
            GOTO 998
         END IF
  100 CONTINUE
      HASPROTEIN=.FALSE.



  998 CONTINUE


      RETURN
      END
      LOGICAL FUNCTION HASSUGAR()

















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INTEGER       ISOUP







      DO 100 ISOUP=1,NUMSOU
         IF (SOUADM(5,ISOUP).EQ.7) THEN
            HASSUGAR=.TRUE.
            GOTO 998
         END IF
  100 CONTINUE
      HASSUGAR=.FALSE.



  998 CONTINUE


      RETURN
      END
      LOGICAL FUNCTION HASWATER()



















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INTEGER       ISOUP







      DO 100 ISOUP=1,NUMSOU
         IF (SOUADM(5,ISOUP).EQ.5) THEN
            HASWATER=.TRUE.
            GOTO 998
         END IF
  100 CONTINUE
      HASWATER=.FALSE.



  998 CONTINUE


      RETURN
      END
      LOGICAL FUNCTION HASDNA()



















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INTEGER       ISOUP
      LOGICAL       WIFISN







      DO 100 ISOUP=1,NUMSOU
         IF (WIFISN(ISOUP)) THEN
            HASDNA=.TRUE.
            GOTO 998
         END IF
  100 CONTINUE
      HASDNA=.FALSE.



  998 CONTINUE


      RETURN
      END
      LOGICAL FUNCTION HASBOUND(IAT,JATOUT) 



















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INTEGER       IAT, IAA, JAT, JAA, JATOUT
      LOGICAL       WIFITI, WIFIRW, AREBOUND







      HASBOUND=.FALSE.
      JATOUT=0
      IF (.NOT.WIFITI(IAT)) GOTO 999



      IAA=ATIAA(IAT)



      DO 20 JAA=1,NUMAAT
         IF (WIFIRW(JAA)) GOTO 20
         IF (IAA.EQ.JAA) GOTO 20
         DO 10 JAT=PNTAAS(JAA),PNTAAE(JAA)
            IF (AREBOUND(IAT,JAT)) THEN
               JATOUT=JAT
               HASBOUND=.TRUE.
               GOTO 998
            END IF
 10      CONTINUE
 20   CONTINUE
      GOTO 998



  999 CONTINUE
      CALL GVSEIW ('HASBOUND')



  998 CONTINUE


      RETURN
      END   
      SUBROUTINE WIFWA3 (IAT,IO,IH1,IH2,IERR)

















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INTEGER       IAT, IO, IH1, IH2, IERR, IAA, ELMZ
      REAL          WIFDST
      LOGICAL       WIFIRW







      IF (WIFPAR(84).LE.0) THEN
         IERR=1
         GOTO 998
      END IF
      IF (.NOT.ISATOK(IAT)) THEN
         IERR=1
         GOTO 998
      END IF
      IAA=ATIAA(IAT)
      IF (.NOT.WIFIRW(IAA)) THEN
         IERR=1
         GOTO 998
      END IF



      IERR=0
      IO=0
      IH1=0
      IH2=0



      IF (ELMZ(IAT).EQ.8) THEN
         IO=IAT



         IF (IAT.LT.NUMATF) THEN
            IF (PROTON(IAT+1).AND.ISATOK(IAT+1).AND.
     +          ORGNAM(IAT).EQ.ORGNAM(IAT+1)) THEN
               IF (WIFDST(IAT,IAT+1).LT.1.8) THEN
                  IH1=IAT+1
               END IF
            END IF
         END IF
         IF (IAT.LT.NUMATF-1) THEN
            IF (PROTON(IAT+2).AND.ISATOK(IAT+2).AND.
     +          ORGNAM(IAT).EQ.ORGNAM(IAT+2)) THEN
               IF (WIFDST(IAT,IAT+2).LT.1.8) THEN
                  IH2=IAT+2
               END IF
            END IF
         END IF



      ELSE IF (ELMZ(IAT).EQ.1) THEN



         IF (IAT.LE.1) THEN
            IERR=1
            GOTO 998
         END IF



         IF (IAT.GE.NUMATF) THEN
            GOTO 10
         END IF













         IF (ELMZ(IAT-1).EQ.8.AND.ORGNAM(IAT).EQ.ORGNAM(IAT-1).AND.
     +       ISATOK(IAT-1)) THEN
            IF (WIFDST(IAT,IAT-1).LT.1.8) THEN
               IO=IAT-1
               IH1=IAT
            END IF
            IF (ELMZ(IAT+1).EQ.1.AND.ORGNAM(IAT).EQ.ORGNAM(IAT+1).AND.
     +          ISATOK(IAT+1).AND.WIFDST(IAT+1,IAT-1).LT.1.8) THEN
               IO=IAT-1
               IH2=IAT+1
            END IF
         END IF




 10      CONTINUE
         IF (IAT.LE.2) THEN
            IERR=1
            GOTO 998
         END IF
         IF (ELMZ(IAT-1).EQ.1.AND.ELMZ(IAT-2).EQ.8.AND.
     +       ORGNAM(IAT).EQ.ORGNAM(IAT-1).AND.ISATOK(IAT-1).AND.
     +       ORGNAM(IAT).EQ.ORGNAM(IAT-2).AND.ISATOK(IAT-2)) THEN
            IF (WIFDST(IAT,IAT-2).LT.1.8) THEN
               IO=IAT-2
               IH2=IAT
            END IF
            IF (WIFDST(IAT-1,IAT-2).LT.1.8) THEN
               IO=IAT-2
               IH1=IAT-1
            END IF
         END IF
      END IF



  998 CONTINUE



      IF (IO.EQ.0) IERR=1


      RETURN
      END
      LOGICAL FUNCTION WIFBOK(IAA)


















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







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



      WIFBOK=.TRUE.
      DO 10 IAT=PNTAAS(IAA),PNTAAS(IAA)+3
         IF (PROTON(IAT)) GOTO 10
         WIFBOK=WIFBOK.AND.ISATOK(IAT)
   10 CONTINUE



  998 CONTINUE


      RETURN
      END
      LOGICAL FUNCTION WIFROK(IAA)

















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







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



      WIFROK=.TRUE.



      DO 10 IAT=PNTAAS(IAA),PNTAAE(IAA)
         IF (PROTON(IAT)) GOTO 10
         WIFROK=WIFROK.AND.ISATOK(IAT)
   10 CONTINUE



  998 CONTINUE


      RETURN
      END
      LOGICAL FUNCTION WIFNOK(IAA)

















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







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



      WIFNOK=.FALSE.



      DO 10 IAT=PNTAAS(IAA),PNTAAE(IAA)
         IF (ISATOK(IAT)) GOTO 998
   10 CONTINUE
      WIFNOK=.TRUE.



  998 CONTINUE


      RETURN
      END
      INTEGER FUNCTION IATINIAA(IAA,ATYPE)




















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INTEGER       IAA, IAT
      CHARACTER*4   ATYPE, LOCTYP, LOCRES
      LOGICAL       T54EQUAL







      IATINIAA=0
      CALL GVSSTX (LOCRES,ONESA3(IAA))
      CALL GVSSTX (LOCTYP,ATYPE)



      DO 10 IAT=PNTAAS(IAA),PNTAAE(IAA)
         IF (T54EQUAL(ONESAT(IAT),LOCTYP)) THEN
            IATINIAA=PINIAA(IAT)
            GOTO 998
         END IF
   10 CONTINUE



      CALL GVST6C ('?M0483',LOCTYP,.FALSE.)
      CALL GVSKIL



  998 CONTINUE


      RETURN
      END
      INTEGER FUNCTION IATOFTYP(IAA,ATYPE)



















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INTEGER       IAA, IAT
      CHARACTER*4   ATYPE, LOCTYP, LOCRES
      LOGICAL       T54EQUAL







      IATOFTYP=0
      CALL GVSSTX (LOCRES,ONESA3(IAA))
      CALL GVSSTX (LOCTYP,ATYPE)



      DO 10 IAT=PNTAAS(IAA),PNTAAE(IAA)
         IF (T54EQUAL(ONESAT(IAT),LOCTYP)) THEN
            IATOFTYP=IAT
            GOTO 998
         END IF
   10 CONTINUE



  998 CONTINUE


      RETURN
      END
      INTEGER FUNCTION WIF058(NAMRES,ISOUP)






















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INTEGER       IAA, ISOUP
      LOGICAL       GVFIBN, CH4EQCH4
      CHARACTER*4   NAMRES







      WIF058=0



      IF (.NOT.GVFIBN(ISOUP,0,NUMSOU)) THEN
         CALL GVSKIL
         GOTO 998
      END IF



      IF (ISOUP.EQ.0) THEN
         DO 10 IAA=1,NUMAAT
            IF (CH4EQCH4(NAMRES,NUMNAM(IAA))) THEN
               WIF058=IAA
               GOTO 998
            END IF
   10    CONTINUE
      ELSE
         DO 20 IAA=SOUADM(1,ISOUP),SOUADM(2,ISOUP)
            IF (CH4EQCH4(NAMRES,NUMNAM(IAA))) THEN
               WIF058=IAA
               GOTO 998
            END IF
   20    CONTINUE
      END IF



  998 CONTINUE


      RETURN
      END
      INTEGER FUNCTION WIF058A(IAANNM,ISOUP)

















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INTEGER       IAA, ISOUP, IAANNM
      LOGICAL       GVFIBN, CH4EQCH4
      CHARACTER*4   NAMRES







      WIF058A=0
      IF (.NOT.GVFIBN(IAANNM,-999,9999)) GOTO 998
      IF (.NOT.GVFIBN(ISOUP,0,NUMSOU)) THEN
         CALL GVSKIL
         GOTO 998
      END IF



      WRITE (NAMRES,'(I4)',ERR=999) IAANNM



      IF (ISOUP.EQ.0) THEN
         DO 10 IAA=1,NUMAAT
            IF (CH4EQCH4(NAMRES,NUMNAM(IAA))) THEN
               WIF058A=IAA
               GOTO 998
            END IF
   10    CONTINUE
      ELSE
         DO 20 IAA=SOUADM(1,ISOUP),SOUADM(2,ISOUP)
            IF (CH4EQCH4(NAMRES,NUMNAM(IAA))) THEN
               WIF058A=IAA
               GOTO 998
            END IF
   20    CONTINUE
      END IF
      GOTO 998



 999  CONTINUE
      CALL GVSEIW ('WIF058A')



  998 CONTINUE


      RETURN
      END
      LOGICAL FUNCTION WIF084(IAA1,IAA2)





















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INTEGER       IAA1, IAA2
      LOGICAL       WIFIRI







      IF ((.NOT.WIFIRI(IAA1)).OR.(.NOT.WIFIRI(IAA2))) THEN
         CALL GVSTTB ('?AOOR84')
         WIF084=.FALSE.
         GOTO 998
      END IF





















      IF (CHAINN(2,IAA1).EQ.CHAINN(2,IAA2)) THEN
         WIF084=.TRUE.
      ELSE
         WIF084=.FALSE.
      END IF



  998 CONTINUE


      RETURN
      END
      INTEGER FUNCTION HASMODEL(ISOUP)


















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INTEGER       ISOUP, IAA







      HASMODEL=0



      IF (ISOUP.LE.0.OR.ISOUP.GT.NUMSOU) GOTO 998



      DO 10 IAA=SOUADM(1,ISOUP),SOUADM(2,ISOUP)
         IF (WRK1TF(IAA)) THEN
            HASMODEL=MODNMB(IAA)
            IF (HASMODEL.NE.0) GOTO 998
         END IF
   10 CONTINUE



  998 CONTINUE


      RETURN
      END   
      LOGICAL FUNCTION NEGION(IAT)

















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







      IAA=ATIAA(IAT)
      NEGION=.TRUE.



      IF (CH4EQCH4(ONESA3(IAA),'SO4 ')) GOTO 998
      IF (CH4EQCH4(ONESA3(IAA),'PO4 ')) GOTO 998
      IF (CH4EQCH4(ONESA3(IAA),'CL  ')) GOTO 998
      IF (CH4EQCH4(ONESA3(IAA),'BR  ')) GOTO 998
      IF (CH4EQCH4(ONESA3(IAA),'FMT ')) GOTO 998
      IF (CH4EQCH4(ONESA3(IAA),'NO3 ')) GOTO 998
      IF (CH4EQCH4(ONESA3(IAA),'BCT ')) GOTO 998
      IF (CH4EQCH4(ONESA3(IAA),'ACY ')) GOTO 998
      NEGION=.FALSE.



  998 CONTINUE


      RETURN
      END   
      LOGICAL FUNCTION WIFIDS(IAA)

















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INTEGER       IAA
      LOGICAL       CH4EQCH4







      WIFIDS=.TRUE.



      IF (CH4EQCH4(ONESA3(IAA),'EDO ')) GOTO 998
      IF (CH4EQCH4(ONESA3(IAA),'ACT ')) GOTO 998
      IF (CH4EQCH4(ONESA3(IAA),'MPD ')) GOTO 998
      IF (CH4EQCH4(ONESA3(IAA),'CIT ')) GOTO 998
      IF (CH4EQCH4(ONESA3(IAA),'TAM ')) GOTO 998
      IF (CH4EQCH4(ONESA3(IAA),'GOL ')) GOTO 998
      IF (CH4EQCH4(ONESA3(IAA),'SO4 ')) GOTO 998
      IF (CH4EQCH4(ONESA3(IAA),'SO3 ')) GOTO 998
      IF (CH4EQCH4(ONESA3(IAA),'EPE ')) GOTO 998
      IF (PNTAAE(IAA)-PNTAAS(IAA).LE.4) GOTO 998
      WIFIDS=.FALSE.



  998 CONTINUE


      RETURN
      END   
      INTEGER FUNCTION DISEND(IAA)

















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INTEGER       IAA, ISOUP
      LOGICAL       GVFIBN







      DISEND=0
      ISOUP=CHAINN(2,IAA)
      IF (.NOT.GVFIBN(ISOUP,1,NUMSOU)) GOTO 998
      DISEND=MIN(ABS(IAA-SOUADM(1,ISOUP)),ABS(SOUADM(2,ISOUP)-IAA))



  998 CONTINUE


      RETURN
      END   
