



      SUBROUTINE WIF220 (DONE)





















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INCLUDE       'OPTION.INC'
      LOGICAL       DONE
      INTEGER       IERR, IDUMMY







      IF (OPTIN.EQ.MEN6COD(56)) GOTO 998
      CALL MEN035 (OPTIN,DONE)




  998 CONTINUE


      END

      SUBROUTINE WIF225 (ISOUPIN,ENVDONE)



















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INCLUDE       'SYMINC.INC'
      INCLUDE       'CNTINC.INC'
      INTEGER       IAT, IDONE, ISOUP, IERR, ISYM, JBEST, ICON, SYMNEG,
     +              ISOUPIN
      REAL          DSTMINALL, CUTOFF
      LOGICAL       ENVDONE











      IF (ISOUPIN.EQ.0) THEN
         CALL MOL310 (ISOUP,5,'?RANGEW')
         IF (ISOUP.EQ.0) GOTO 998
      ELSE
         ISOUP=ISOUPIN
      END IF



      IF (.NOT.ENVDONE) THEN
         CALL SHOWTEXT ('?M0049')
         CALL DO_ENV (0,IERR)
         IF (IERR.NE.0) GOTO 998
      END IF



      WIFPAR(379)=0
      IDONE=0
      CALL WIFPUSHPPP (590,1)
      CUTOFF=30.0
      IF (WIFPAR(472).NE.0) CUTOFF=FLOAT(WIFPAR(472))



      DO 100 IAT=PNTAAS(SOUADM(1,ISOUP)),PNTAAE(SOUADM(2,ISOUP))
         CALL FCONAT (IAT,CUTOFF)
         DSTMINALL=998.0
         JBEST=0
         DO 90 ICON=1,NUMCONIAT
            IF (CONDSTAT(ICON).LT.DSTMINALL) THEN
               JBEST=CONSYMAT(ICON)
               DSTMINALL=CONDSTAT(ICON)
            END IF
   90    CONTINUE



         IF (JBEST.GT.1) THEN
            ISYM=SYMNEG(JBEST)



            CV(1)=XCOORD(IAT)
            CV(2)=YCOORD(IAT)
            CV(3)=ZCOORD(IAT)



            CALL GVSMPV (CV,SYMMAT(1,1,ISYM),SYMVEC(1,ISYM))
            IDONE=IDONE+1
            CALL DIF015 (6,'?M2460',IAT)
            XCOORD(IAT)=CV(1)
            YCOORD(IAT)=CV(2)
            ZCOORD(IAT)=CV(3)
            WIFPAR(379)=WIFPAR(379)+1
         END IF
 100  CONTINUE



      CALL WIFPOPPPP (590)
      CALL MOL200



      CALL GVSTTI ('?WATTRC',IDONE)



  998 CONTINUE


      RETURN
      END

      SUBROUTINE WIF225B



















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INCLUDE       'DATBAS.INC'
      INCLUDE       'ANATRA.INC'
      INCLUDE       'SYMINC.INC'
      INCLUDE       'CNTINC.INC'
      INTEGER       IAA, IAT, IDONE, ISOUP, ISYM, JBEST, ICON, SYMNEG
      REAL          DSTMINALL, CUTOFF
      LOGICAL       WIFISW, GROOUT, FIRST







      CALL ENVNOWAT



      GROOUT=.FALSE.
      IDONE=0
      CALL WIFPUSHPPP (590,1)
      WIFPAR(379)=0
      FIRST=.TRUE.
      CUTOFF=30.0
      IF (WIFPAR(472).NE.0) CUTOFF=FLOAT(WIFPAR(472))



      DO 110 ISOUP=1,NUMSOU
         IF (.NOT.WIFISW(ISOUP)) GOTO 110
         IAA=SOUADM(1,ISOUP)



         DO 100 IAT=PNTAAS(SOUADM(1,ISOUP)),PNTAAE(SOUADM(2,ISOUP))
            CALL FCONAT (IAT,CUTOFF)
            DSTMINALL=998.0
            JBEST=0
            DO 90 ICON=1,NUMCONIAT
               IF (CONDSTAT(ICON).LT.DSTMINALL) THEN
                  JBEST=CONSYMAT(ICON)
                  DSTMINALL=CONDSTAT(ICON)
               END IF
   90       CONTINUE



            IF (JBEST.GT.1) THEN
               ISYM=SYMNEG(JBEST)



               CV(1)=XCOORD(IAT)
               CV(2)=YCOORD(IAT)
               CV(3)=ZCOORD(IAT)



               CALL GVSMPV (CV,SYMMAT(1,1,ISYM),SYMVEC(1,ISYM))
               IDONE=IDONE+1



               CALL DIF015 (6,'?M2460',IAT)
               IF (DATLOG.NE.0) THEN
                  IF (.NOT.GROOUT) THEN
                     GROOUT=.TRUE.
                     CALL GVSTTU (DATLOG,'?GMO070')
                  END IF
                  CALL GVSTTR3U (DATLOG,'?M3396A',XCOORD(IAT),
     +             YCOORD(IAT),ZCOORD(IAT))
                  CALL GVSTTR3U (DATLOG,'?M3397A',CV(1),CV(2),CV(3))
               END IF
               CALL GVSTTR3 ('?M3396A',XCOORD(IAT),YCOORD(IAT),
     +          ZCOORD(IAT))



               XCOORD(IAT)=CV(1)
               YCOORD(IAT)=CV(2)
               ZCOORD(IAT)=CV(3)
               CALL GVSTTR3 ('?M3397A',XCOORD(IAT),YCOORD(IAT),
     +          ZCOORD(IAT))
               WIFPAR(379)=WIFPAR(379)+1



               IF (WIFPAR(450).NE.0.AND.WIFPAR(451).NE.0) THEN
                  IF (FIRST) THEN
                     FIRST=.FALSE.
                     CALL GVSTT6 ('?M4863')
                     CALL GVSTT6 ('?M4864')
                     CALL GVSTTU (WIFPAR(451),'?M4863')
                     CALL GVSTTU (WIFPAR(451),'?M4864')
                  END IF
                  CALL GVSFMT ('?FMT1415')
                  CALL GVSCTB (LINE,80)
                  WRITE (LINE,FMT,ERR=999) IAA,ORGNAM(IAT),NUMNAM(IAA),
     +             CHANAM(IAA)
                  CALL GVSTT6 (LINE)
                  CALL GVSTTU (WIFPAR(451),LINE)
               END IF
            END IF
 100     CONTINUE
 110  CONTINUE



      CALL WIFPOPPPP (590)
      CALL MOL200



      CALL GVSTTI ('?WATTRC',IDONE)
      GOTO 998



 999  CONTINUE
      CALL GVSEIW ('WIF225B')



 998  CONTINUE


      RETURN
      END

      SUBROUTINE WIF236 (IAAIN)

















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INCLUDE       'ANISOU.INC'
      INTEGER       IAT, IAA, IAAIN, IERR, I
      CHARACTER*1   ATFLAG, USEFLG
      CHARACTER*4   T4, CHAR4







      IF (IAAIN.EQ.0) THEN
         IAA=SOUADM(1,WIFPAR(290))
      ELSE
         IAA=IAAIN
      END IF




      CALL GVSTTI ('?M3404',PNTAAE(IAA)-PNTAAS(IAA)+1)
      CALL DIF028 (6,IAA)
      CALL GVSTT6 ('?WATHED')






      DO 10 IAT=PNTAAS(IAA),PNTAAE(IAA)
         PRINT*,IAT,ONESAT(IAT)
         ATFLAG='-'
         IF (ISATOK(IAT)) ATFLAG='+'
         USEFLG='-'
         IF (USEAT(IAT)) USEFLG='+'
         CHAR4=T4(ONESAT(IAT))
         CALL GVSFMT ('?FMT617')

         CALL GVSCTB (BIGLIN,132)
         WRITE (BIGLIN,FMT,ERR=10) CHAR4,ALTATM(IAT),XCOORD(IAT),
     +    YCOORD(IAT),ZCOORD(IAT),ACCESS(IAT),XBFACT(IAT),
     +    WEIGHT(IAT),VDWRAD(IAT),ATCOLR(IAT),ATFLAG,USEFLG,
     +    ORGNAM(IAT),ATTVAL(IAT)
         CALL GVSTT6 (BIGLIN)
         IF (USEANI) THEN
            CALL GVSFMT ('?FMTANI')
            CALL GVSCTB (LINE,80)
            WRITE (LINE,FMT,ERR=999) (ANISOU(I,IAT),I=1,6)
            CALL GVSTT6 (LINE)
         END IF
         IF (USEALT.AND.ALALAT(IAT).NE.' ') THEN
            CALL ALT007 (IAT,IERR)
            CALL GVSCTB (BIGLIN,132)
            CALL GVSCTB (CHAR4,4)
            WRITE (BIGLIN,FMT,ERR=10) CHAR4,ALTATM(IAT),XCOORD(IAT),
     +       YCOORD(IAT),ZCOORD(IAT),ACCESS(IAT),XBFACT(IAT),
     +       WEIGHT(IAT),VDWRAD(IAT),ATCOLR(IAT),ATFLAG,USEFLG,
     +       ORGNAM(IAT),ATTVAL(IAT)
            CALL GVSTT6 (BIGLIN)
            CALL ALT007 (IAT,IERR)
         END IF
   10 CONTINUE
      CALL GVSNL6 (1)
      GOTO 998



 999  CONTINUE
      CALL GVSEIW ('WIF236')



  998 CONTINUE


      RETURN
      END
      SUBROUTINE WIF236A (IAA)

















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INTEGER       IAT, IAA, IERR
      CHARACTER*1   ATFLAG, USEFLG
      CHARACTER*4   T4, CHAR4







      IF (WIFPAR(28).EQ.0) THEN
         CALL GVSTT6 ('?WATHED')
         CALL GVSTTI ('?M3404',PNTAAE(IAA)-PNTAAS(IAA)+1)
      END IF



      DO 10 IAT=PNTAAS(IAA),PNTAAE(IAA)
         IF (.NOT.USEAT(IAT)) GOTO 10
         ATFLAG='-'
         IF (ISATOK(IAT)) ATFLAG='+'
         USEFLG=' '
         CHAR4=T4(ONESAT(IAT))
         CALL GVSFMT ('?FMT617')
         CALL GVSCTB (BIGLIN,132)
         WRITE (BIGLIN,FMT,ERR=10) CHAR4,ALTATM(IAT),XCOORD(IAT),
     +    YCOORD(IAT),ZCOORD(IAT),ACCESS(IAT),XBFACT(IAT),
     +    WEIGHT(IAT),VDWRAD(IAT),ATCOLR(IAT),ATFLAG,USEFLG,
     +    ORGNAM(IAT),ATTVAL(IAT)
         CALL GVSTT6 (BIGLIN)
         IF (USEALT.AND.ALALAT(IAT).NE.' ') THEN
            CALL ALT007 (IAT,IERR)
            CALL GVSCTB (BIGLIN,132)
            CALL GVSCTB (CHAR4,4)
            WRITE (BIGLIN,FMT,ERR=10) CHAR4,ALTATM(IAT),XCOORD(IAT),
     +       YCOORD(IAT),ZCOORD(IAT),ACCESS(IAT),XBFACT(IAT),
     +       WEIGHT(IAT),VDWRAD(IAT),ATCOLR(IAT),ATFLAG,USEFLG,
     +       ORGNAM(IAT),ATTVAL(IAT)
            CALL GVSTT6 (BIGLIN)
            CALL ALT007 (IAT,IERR)
         END IF
   10 CONTINUE
      CALL GVSNL6 (1)





      RETURN
      END

      SUBROUTINE SPLITWAT



















      IMPLICIT      NONE 
      INCLUDE       'BIGINC.INC'
      INTEGER       MAXATO
      PARAMETER     (MAXATO=4000)
      INTEGER       IAA, IAT, HISTOG(8), NR, NRTAB(MAXATO),
     +              NUL, IERR, ISOUP
      LOGICAL       WIFIRW, WIFISR







      IF (NUMAAT.LE.NUMAAF) GOTO 998



      NUL=0
      IERR=0



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



      DO 100 IAA=NUMAAF+1,NUMAAT



         IF (WIFIRW(IAA)) THEN



            IF (SPHRAD(4,IAA).GT.10.0.AND.
     +          PNTAAE(IAA)-PNTAAS(IAA)+1.LE.MAXATO) THEN
               CALL GVSIT0 (HISTOG,8)



               DO 90 IAT=PNTAAS(IAA),PNTAAE(IAA)
                  NR=1
                  IF (XCOORD(IAT).LT.SPHRAD(1,IAA)) NR=NR+1
                  IF (YCOORD(IAT).LT.SPHRAD(2,IAA)) NR=NR+2
                  IF (ZCOORD(IAT).LT.SPHRAD(3,IAA)) NR=NR+4
                  HISTOG(NR)=HISTOG(NR)+1
                  NRTAB(PINIAA(IAT))=NR
 90            CONTINUE



               DO 80 NR=1,8
                  CALL KLONKSET (SOUPNT(IAA),NUL,IERR)
                  DO 10 IAT=PNTAAS(IAA),PNTAAE(IAA)
                     IF (NRTAB(PINIAA(IAT)).EQ.NR) THEN
                        CALL KLONKTO (IAT,IERR)
                     END IF
 10               CONTINUE
                  CALL KLONKTER (IERR)
 80            CONTINUE



            ELSE
               CALL KLONKSET (SOUPNT(IAA),NUL,IERR)
               DO 20 IAT=PNTAAS(IAA),PNTAAE(IAA)
                  CALL KLONKTO (IAT,IERR)
 20            CONTINUE
               CALL KLONKTER (IERR)
            END IF
         ELSE
            DO 25 IAT=PNTAAS(IAA),PNTAAE(IAA)
               CALL KLONKTO (IAT,IERR)
 25         CONTINUE
            CALL KLONKTER (IERR)
         END IF
 100  CONTINUE



      DO 200 ISOUP=NUMSOU,1,-1
         IF (.NOT.WIFISR(ISOUP)) THEN
            CALL MOL101A (ISOUP)
            CALL MOL200
         END IF
  200 CONTINUE



      CALL MOL111A (NUMAAT+1,MAXAA)
      CALL MOL111B (NUMATF+1,MAXAT)



      CALL MOL200



      CALL KLONKDOWN
      CALL KLONKEND
      CALL MOL200



  998 CONTINUE


      RETURN
      END
      SUBROUTINE UNSPLITWAT

















      IMPLICIT      NONE 
      INCLUDE       'BIGINC.INC'
      INTEGER       IAA, IAT, NUMWGR, NUL, IERR, ISOUP
      LOGICAL       WIFIRW, WIFISW, FIRST







      IF (NUMAAT.LE.NUMAAF) GOTO 998



      NUL=0
      IERR=0
      NUMWGR=0
      FIRST=.TRUE.



      DO 10 ISOUP=1,NUMSOU
         IF (WIFISW(ISOUP)) NUMWGR=NUMWGR+1
 10   CONTINUE
      IF (NUMWGR.LE.1) GOTO 998



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



      DO 30 IAA=NUMAAF+1,NUMAAT
         IF (FIRST) THEN
            FIRST=.FALSE.
            CALL KLONKSET (SOUPNT(IAA),NUL,IERR)
         END IF



         IF (WIFIRW(IAA)) THEN
            DO 20 IAT=PNTAAS(IAA),PNTAAE(IAA)
               CALL KLONKTO (IAT,IERR)
 20         CONTINUE
         END IF
 30   CONTINUE
      CALL KLONKTER (IERR)



      DO 40 ISOUP=NUMSOU,1,-1
         IF (WIFISW(ISOUP)) THEN
            CALL MOL101A (ISOUP)
            CALL MOL200
         END IF
 40   CONTINUE



      CALL MOL111A (NUMAAT+1,MAXAA)
      CALL MOL111B (NUMATF+1,MAXAT)



      CALL MOL200



      CALL KLONKDOWN
      CALL KLONKEND
      CALL MOL200



  998 CONTINUE


      RETURN
      END

      SUBROUTINE WIF244 (IPAIR,PRINTFLG)

















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INCLUDE       'DATBAS.INC'
      INCLUDE       'ANATRA.INC'
      INTEGER       IWAT1, IWAT2, ISOUP, JSOUP, IAT, JAT, IPAIR, KILL
      REAL          WIFDST, D12, CO
      LOGICAL       WIFISW, PRINTFLG, GROOUT, ISMETAL







      KILL=0
      IPAIR=0
      GROOUT=.FALSE.



      IF (NUMSOU.LE.1) GOTO 998




      DO 40 ISOUP=1,NUMSOU
         IF (WIFISW(ISOUP)) GOTO 40
         DO 30 IAT=PNTAAS(SOUADM(1,ISOUP)),PNTAAE(SOUADM(2,ISOUP))
            IF (PROTON(IAT)) GOTO 40



            DO 20 JSOUP=1,NUMSOU
               IF (.NOT.WIFISW(JSOUP)) GOTO 20
               DO 10 JAT=PNTAAS(SOUADM(1,JSOUP)),PNTAAE(SOUADM(2,JSOUP))
                  IF (PROTON(JAT)) GOTO 10



                  IF (ISMETAL(IAT)) THEN
                     CO=1.6
                  ELSE
                     CO=1.0
                  END IF
                  IF (WIFDST(IAT,JAT).LT.VDWRAD(IAT)+VDWRAD(JAT)-CO) 
     +                THEN
                     ISATOK(JAT)=.FALSE.
                     XBFACT(JAT)=100.3
                     WEIGHT(JAT)=0.0
                     KILL=KILL+1
                     IF (PROTON(JAT+1)) THEN
                        WEIGHT(JAT+1)=0.0
                        ISATOK(JAT+1)=.FALSE.
                        XBFACT(JAT+1)=100.3
                        IF (PROTON(JAT+2)) THEN
                           WEIGHT(JAT+2)=0.0
                           ISATOK(JAT+2)=.FALSE.
                           XBFACT(JAT+2)=100.3
                        END IF
                     END IF
                  END IF
 10            CONTINUE
 20         CONTINUE
 30      CONTINUE
 40   CONTINUE



      DO 100 ISOUP=1,NUMSOU
         IF (.NOT.WIFISW(ISOUP)) GOTO 100



         DO 90 IWAT1=PNTAAS(SOUADM(1,ISOUP)),PNTAAE(SOUADM(2,ISOUP))-1
            IF (PROTON(IWAT1)) GOTO 90
            IF (.NOT.ISATOK(IWAT1)) GOTO 90



            DO 80 IWAT2=IWAT1+1,PNTAAE(SOUADM(2,ISOUP))
               IF (PROTON(IWAT2)) GOTO 80
               IF (.NOT.ISATOK(IWAT2)) GOTO 80



               D12=WIFDST(IWAT1,IWAT2)
               IF (D12.LT.2.0) THEN
                  IPAIR=IPAIR+1
                  IF (PRINTFLG) THEN
                     CALL DIF012 (6,IWAT1,IWAT2,D12)
                     CALL GVSTTR5 ('?M3396',XCOORD(IWAT1),YCOORD(IWAT1),
     +                ZCOORD(IWAT1),WEIGHT(IWAT1),XBFACT(IWAT1))
                     CALL GVSTTR5 ('?M3397',XCOORD(IWAT2),YCOORD(IWAT2),
     +                ZCOORD(IWAT2),WEIGHT(IWAT2),XBFACT(IWAT2))
                  END IF




                  IF (WIFPAR(1265).NE.0) THEN
                     IF (.NOT.GROOUT) THEN
                        GROOUT=.TRUE.
                        CALL GVSTTU (DATLOG,'?M3509')
                     END IF
                     IF (PRINTFLG) CALL DIF016 (6,IWAT1,IWAT2)
                     CALL WIF244A (IWAT1,IWAT2)
                     KILL=KILL+1
                  END IF
               END IF
 80         CONTINUE
 90      CONTINUE
 100  CONTINUE
      IF (KILL.GE.1.AND.WIFPAR(1265).NE.0) CALL WIF244B (.TRUE.)



  998 CONTINUE


      RETURN
      END
      SUBROUTINE WIF244A (IWAT1,IWAT2)

















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INCLUDE       'DATBAS.INC'
      INCLUDE       'ANATRA.INC'
      INTEGER       IWAT1, IWAT2, IAA, IAT
      REAL          WIFDST, D1, D2
      LOGICAL       WIFIRA







      D1=999.8
      D2=999.9



      DO 100 IAA=1,NUMAAT
         IF (.NOT.WIFIRA(IAA)) GOTO 100
         DO 90 IAT=PNTAAS(IAA),PNTAAE(IAA)
            D1=MIN(D1,WIFDST(IWAT1,IAT))
            D2=MIN(D2,WIFDST(IWAT2,IAT))
 90      CONTINUE
 100  CONTINUE
      IF (D2.GE.D1) THEN
         CALL DIF015 (6,'?M3510',IWAT2)
         IF (DATLOG.GT.0) CALL DIF015  (DATLOG,'?M3510',IWAT2)
         WEIGHT(IWAT2)=0.0
         ISATOK(IWAT2)=.FALSE.
         XBFACT(IWAT2)=100.1
         IF (PROTON(IWAT2+1)) THEN
            WEIGHT(IWAT2+1)=0.0
            ISATOK(IWAT2+1)=.FALSE.
            XBFACT(IWAT2+1)=100.1
            IF (PROTON(IWAT2+2)) THEN
               WEIGHT(IWAT2+2)=0.0
               ISATOK(IWAT2+2)=.FALSE.
               XBFACT(IWAT2+2)=100.1
            END IF
         END IF
      ELSE
         CALL DIF015  (6,'?M3510',IWAT1)
         IF (DATLOG.GT.0) CALL DIF015  (DATLOG,'?M3510',IWAT1)
         WEIGHT(IWAT1)=0.0
         ISATOK(IWAT1)=.FALSE.
         XBFACT(IWAT1)=100.2
         IF (PROTON(IWAT1+1)) THEN
            WEIGHT(IWAT1+1)=0.0
            ISATOK(IWAT1+1)=.FALSE.
            XBFACT(IWAT1+1)=100.2
            IF (PROTON(IWAT1+2)) THEN
               WEIGHT(IWAT1+2)=0.0
               ISATOK(IWAT1+2)=.FALSE.
               XBFACT(IWAT1+2)=100.2
            END IF
         END IF
      END IF
      GOTO 998



      CALL GVSEIW ('WIF244A')



  998 CONTINUE


      RETURN
      END   
      SUBROUTINE WIF244B (PRINTIT)

















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INTEGER       IUNIT, IERR, IAA, IAT, ISOUP
      REAL          OLDPDR
      LOGICAL       WIFITW, WIFISW, PRINTIT







      OLDPDR=PDRESO
      CALL GVSROF (IUNIT,IERR)
      IF (IUNIT.EQ.0.OR.IERR.NE.0) GOTO 998
      CALL GETFILN (IUNIT,' ','SELF.PDB',IERR)
      IF (IERR.NE.0) GOTO 998



      DO 100 ISOUP=NUMSOU,1,-1
         IF (.NOT.WIFISW(ISOUP)) GOTO 100
         IAA=SOUADM(1,ISOUP)



         DO 90 IAT=PNTAAS(SOUADM(1,ISOUP)),PNTAAE(SOUADM(2,ISOUP))
            IF (.NOT.WIFITW(IAT)) GOTO 90
            IF (WEIGHT(IAT).LT.0.01) GOTO 90
            IF (.NOT.ISATOK(IAT)) GOTO 90
            IF (XBFACT(IAT).GE.100.0) GOTO 90




            CALL GVSFMT ('?FMT498E')
            WRITE (IUNIT,FMT,ERR=999) IAT,ONESAT(IAT),CHANAM(IAA),
     +       ORGNAM(IAT)(1:4),XCOORD(IAT),YCOORD(IAT),ZCOORD(IAT)
            IF (PRINTIT) WRITE (6,FMT,ERR=999) IAT,ONESAT(IAT),
     +       CHANAM(IAA),ORGNAM(IAT)(1:4),XCOORD(IAT),YCOORD(IAT),
     +       ZCOORD(IAT)
            WIFPAR(491)=SOUPNT(ATIAA(IAT))
 90      CONTINUE



         CALL MOL101 (ISOUP)
 100  CONTINUE



      CALL GVSCLF (11)
      CALL GVSCLF (IUNIT)
       
      GOTO 998



  999 CONTINUE
      CALL GVSEIW ('WIF244B')



  998 CONTINUE
      PDRESO=OLDPDR


      RETURN
      END   

      SUBROUTINE WAT_KILL_AT

















      IMPLICIT      NONE 
      INCLUDE       'BIGINC.INC'
      INTEGER       IAA, IAT, IERR, ISOUP
      LOGICAL       WIFIRW, DONE, WIFISW, FIRST







      IF (NUMAAT.LE.NUMAAF) GOTO 998



      IERR=0
      DONE=.FALSE.
      FIRST=.TRUE.



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



      DO 100 IAA=NUMAAF+1,NUMAAT



         IF (WIFIRW(IAA)) THEN



            DO 90 IAT=PNTAAS(IAA),PNTAAE(IAA)
               IF (ATTVAL(IAT).LE.0.001) THEN
                  IF (FIRST) THEN
                     FIRST=.FALSE.



                     CALL KLONKSET (SOUPNT(IAA),MODNMB(IAA),IERR)
                  END IF
                  DONE=.TRUE.
                  CALL KLONKTO (IAT,IERR)
               END IF
 90         CONTINUE
         END IF
 100  CONTINUE



      DO 200 ISOUP=NUMSOU,1,-1
         IF (WIFISW(ISOUP)) THEN
            CALL MOL101A (ISOUP)
            CALL MOL200
         END IF
  200 CONTINUE



      CALL MOL200



      IF (DONE) THEN
         CALL KLONKDOWN
         CALL KLONKEND
         CALL MOL200
      END IF



  998 CONTINUE


      RETURN
      END
