




      SUBROUTINE XBF020

















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INCLUDE       'PDBINC.INC'
      INTEGER       IAA, IAT, NUMBUR
      REAL          SUM, G6
      LOGICAL       WIFIRA







      CALL ENVNOWAT
      NUMBUR=0
      SUM=0.0
      G6=0.0



      DO 20 IAA=1,NUMAAF
         IF (WIFIRA(IAA)) THEN
            CALL WIF041 (IAA)
            DO 10 IAT=PNTAAS(IAA),PNTAAE(IAA)
               IF (.NOT.ISATOK(IAT).OR.WEIGHT(IAT).EQ.0.0.OR.
     +          XBFACT(IAT).GT.99.5) GOTO 10
               IF (ACCESS(IAT).LE.0.000001) THEN
                  NUMBUR=NUMBUR+1
                  SUM=SUM+XBFACT(IAT)
               END IF
 10         CONTINUE
         END IF
 20   CONTINUE



      G6=SUM/FLOAT(NUMBUR)



      IF (G6.LT.0.99.AND.G6.GT.0.02) THEN



         IF (WIFPAR(279).NE.0) CALL PDBMES ('UNOTB')
         FIXLST(8)=1.0



         CALL GVSVXC (XBFACT,8.0*(3.1415926**2),NUMATF)
      END IF





      RETURN
      END   
      SUBROUTINE XBF102

















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







      IF (WIFPAR(84).EQ.0.OR.WIFPAR(1305).EQ.0) GOTO 998



      DO 40 IAA=1,NUMAAT



         DO 30 IAT=PNTAAS(IAA),PNTAAE(IAA)



            DO 5 IBND=1,8
               JAT=BOUND_TO(IBND,IAT)
               IF (JAT.NE.0) THEN
                  IF (PROTON(JAT)) THEN
                     XBFACT(JAT)=XBFACT(IAT)/10.0
                  END IF
               END IF
 5          CONTINUE



            IF (PROTON(IAT)) THEN



               IF (WIFIRR(IAA)) THEN
                  DO 10 IPNT=1,MAXTAT
                     IF (MUTCON(2,IPNT,RESTYP(IAA)).EQ.PINIAA(IAT)) THEN
                     XBFACT(IAT)=XBFACT(MUTCON(1,IPNT,RESTYP(IAA)))/10.0
                        GOTO 30
                     END IF
   10             CONTINUE



               ELSE IF (PNTAAE(IAA).GT.PNTAAS(IAA)) THEN
                  IF (WIFIRW(IAA)) THEN

                     IF (.NOT.PROTON(IAT-1)) THEN
                        XBFACT(JAT)=XBFACT(IAT-1)/10.0
                     ELSE IF (.NOT.PROTON(IAT-2)) THEN
                        XBFACT(JAT)=XBFACT(IAT-2)/10.0
                     END IF
                  ELSE
                     DO 20 IBND=1,8
                        JAT=BOUND_TO(IBND,IAT)
                        IF (JAT.GT.0) THEN
                           XBFACT(IAT)=XBFACT(JAT)/10.0
                        END IF
   20                CONTINUE
                  END IF



               ELSE
                  IF (BOUND_TO(1,IAT).NE.0) THEN
                     XBFACT(IAT)=XBFACT(BOUND_TO(1,IAT))/10.0
                  END IF
               END IF
            END IF
   30    CONTINUE
   40 CONTINUE



  998 CONTINUE


      RETURN
      END   
