



      SUBROUTINE MOL300 (DONE)






















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INCLUDE       'OPTION.INC'
      LOGICAL       DONE







      IF (OPTIN.EQ.MEN6COD(29)) GOTO 998
      CALL MEN016 (OPTIN,DONE)





      IF (OPTIN.EQ.'DVADOM') THEN
         CALL GVSBTT (ISATOK,MAXAT)
         DONE=.TRUE.



      ELSE IF (OPTIN.EQ.'STATUS') THEN
         CALL WIFPUSHPPP (1012,1)
         CALL MOL010 ('Option STATUS:')
         CALL WIFPOPPPP (1012)
         DONE=.TRUE.



      ELSE IF (OPTIN.EQ.'CLNSOU') THEN
         CALL GVSTT6 ('?OPTNOY')
         DONE=.TRUE.



      ELSE IF (OPTIN.EQ.'MERGED') THEN
         CALL MOL334
         DONE=.TRUE.



      ELSE IF (OPTIN.EQ.'NOBOTO') THEN
         CALL GVSIT0 (BOUND_TO,8*MAXAT)
         DONE=.TRUE.



      ELSE IF (OPTIN.EQ.'SHOBTO') THEN
         CALL DEB013
         DONE=.TRUE.



      ELSE IF (OPTIN.EQ.'SHOTOP') THEN
         CALL MOL350 (1)
         DONE=.TRUE.



      ELSE IF (OPTIN.EQ.'LSTAFQ') THEN
         CALL MOL340
         DONE=.TRUE.



      ELSE IF (OPTIN.EQ.'HIDDEN') THEN
         CALL SHOWTEXT ('?MOLHIDEN')
         DONE=.TRUE.
      END IF



  998 CONTINUE


      RETURN
      END
      SUBROUTINE MOL302

















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INCLUDE       'JUNIOR.INC'
      INTEGER       ISOUP
      LOGICAL       AHEAD







      IF (NUMSOU.LT.1) THEN
         CALL GVSTTE ('?MOLC07')
         GOTO 998
      END IF



      IF (.NOT.AHEAD()) CALL SHOSOU



      CALL MOL310 (ISOUP,-1,'?MOLNDE')
      IF (ISOUP.EQ.0) GOTO 998



      CALL MOL101 (ISOUP)



      CALL MOL200
      CALL GVSIT0 (PREVSHOW,MAXAA)



  998 CONTINUE


      RETURN
      END
      SUBROUTINE MOL305

















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INCLUDE       'IRIGRA.INC'
      INTEGER       IAA, IRESTP







      IF (NUMAAF.LE.0) THEN
         CALL GVSTTE ('?SOUEMT')
         GOTO 998
      END IF



      CALL GVSSTX (TPTXLN,'?MOLRDE')
      CALL WIFGRS (IAA,TPTXLN)
      IF (IAA.EQ.0) GOTO 998



      IRESTP=CHAINN(1,IAA)
      CALL MOL105 (IAA)



      IF (IRESTP.EQ.2) CALL SHOWTEXTIF ('?MOLC09')



      CALL MOL200



  998 CONTINUE


      RETURN
      END
      SUBROUTINE MOL305A (IAAIN)

















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INCLUDE       'IRIGRA.INC'
      INTEGER       IAA, IAAIN, IAT, JAT, IBND, JBND







      IF (NUMAAF.LE.0) THEN
         CALL GVSTTE ('?SOUEMT')
         GOTO 998
      END IF



      IF (IAAIN.NE.0) THEN
         IAA=IAAIN
      ELSE
         CALL GVSSTX (TPTXLN,'?MOLRDE')
         CALL WIFGRS (IAA,TPTXLN)
         IF (IAA.EQ.0) GOTO 998
      END IF



      DO 20 IAT=PNTAAS(IAA),PNTAAE(IAA)
         DO 10 IBND=1,8
            JAT=BOUND_TO(1,IBND)
            IF (JAT.NE.0) THEN
               BOUND_TO(1,IAT)=0
               DO 5 JBND=1,8
                  IF (BOUND_TO(JBND,JAT).EQ.IAT) BOUND_TO(JBND,JAT)=0
 5             CONTINUE
            END IF
 10      CONTINUE
 20   CONTINUE



      CALL WIFPUSHPPP (1195,1)
      CALL MOL105 (IAA)
      CALL WIFPOPPPP (1195)



      CALL MOL200



  998 CONTINUE


      RETURN
      END
      SUBROUTINE MOL306


















      IMPLICIT      NONE
      INTEGER       IAA, IERR
      LOGICAL       WIFIRR







   10 CONTINUE
      CALL WIFGRS (IAA,'?MOLRBG')
      IF (IAA.EQ.0) GOTO 998



      IF (.NOT.WIFIRR(IAA)) THEN
         CALL GVSTTE ('?MOLC10')
         GOTO 10
      END IF



      CALL MOL306A (IAA,IERR)



  998 CONTINUE


      RETURN
      END
      SUBROUTINE MOL306A (IAA,IERR)

















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







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



      IERR=0



      PSTFLG(IAA)=.FALSE.
      CUTFLG(IAA)=.TRUE.
      CALL MOL200



      CALL MOL306B (IAA,.TRUE.,IERR)



  998 CONTINUE


      RETURN
      END
      SUBROUTINE MOL306B (IAA,ASKUSR,IERR)

















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INTEGER       IERR, IAA
      REAL          WIFDST
      LOGICAL       WIFIR3, WIFIRR, GVFYON, ASKUSR, WIFIRA, FIRST







      IF (WIFPAR(1071).NE.0) THEN
         IERR=0
         GOTO 998
      END IF
      IF (.NOT.WIFIRR(IAA)) THEN
         IERR=1
         GOTO 998
      END IF
      IF (.NOT.WIFIRA(IAA)) THEN
         IERR=0
         GOTO 998
      END IF
      IF (BOUND_TO(1,PNTAAS(IAA)+2).NE.0) THEN
         IERR=0
         GOTO 998
      END IF



      IF (IAA.LT.NUMAAF) THEN
         IF (WIFIRA(IAA).AND.WIFIRA(IAA+1)) THEN
            IF (WIFDST(PNTAAS(IAA)+2,PNTAAS(IAA+1)).LT.2.0) GOTO 998
         END IF
      END IF



      IERR=0
      CALL MOL200
      FIRST=.TRUE.



      IF (.NOT.WIFIR3(IAA)) THEN
         IERR=1
         GOTO 998
      END IF



      IF (WIFPAR(194).NE.0) CALL SHOWTEXTIF ('?M0988')
      IF (ASKUSR) THEN
         IF (GVFYON('?M0989',' ')) THEN
            CALL MOL333 (IAA)
         END IF
      ELSE
         CALL MOL333 (IAA)
      END IF



      IF (WIFPAR(450).NE.0.AND.WIFPAR(451).NE.0) THEN
         IF (FIRST) THEN
            FIRST=.FALSE.
            CALL GVSTT6 ('?M4857')
            CALL GVSTT6 ('?M4858')
            CALL GVSTTU (WIFPAR(451),'?M4857')
            CALL GVSTTU (WIFPAR(451),'?M4858')
         END IF
         CALL GVSFMT ('?FMT1412')
         CALL GVSCTB (LINE,80)
         WRITE (LINE,FMT,ERR=999) IAA,ONESA3(IAA),NUMNAM(IAA),
     +    CHANAM(IAA)
         CALL GVSTT6 (LINE)
         CALL GVSTTU (WIFPAR(451),LINE)
      END IF
      GOTO 998



 999  CONTINUE
      CALL GVSEIW ('MOL306B')



  998 CONTINUE


      RETURN
      END   
      SUBROUTINE MOL307

















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INTEGER       IERR, IAA
      LOGICAL       GVFYON, WIFIRR, WIFIR3







   5  CONTINUE
      CALL WIFGRS (IAA,'?MOLRBG')
      IF (IAA.EQ.0) GOTO 998



      IF (.NOT.WIFIRR(IAA)) THEN
         CALL GVSTTE ('?MOLC10')
         CALL SHOIAA (IAA)
         GOTO 5
      END IF
      IF (.NOT.WIFIR3(IAA)) THEN
         CALL GVSTT6 ('?AANCT')
         IF (.NOT.GVFYON('?MOLPAW',' ')) GOTO 998
      END IF



      IF (CHANAM(IAA).NE.CHANAM(IAA+1)) THEN
         CALL SHOWTEXT ('?M2402')
         CALL MOL354 (SOUADM(1,CHAINN(2,IAA+1)),
     +    SOUADM(2,CHAINN(2,IAA+1)),CHANAM(IAA))
      END IF



      CALL MOL307A (IAA,IERR)
      IF (IERR.NE.0) GOTO 998



      CALL MOL307C (IAA,IERR)



  998 CONTINUE


      RETURN
      END
      SUBROUTINE MOL307A (IAA,IERR)

















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







      IF (.NOT.WIFIRR(IAA)) THEN
         IERR=1
         GOTO 998
      END IF
      IF (IAA.GE.NUMAAF) THEN
         IERR=1
         GOTO 998
      END IF



      IERR=0



      PSTFLG(IAA)=.TRUE.
      CUTFLG(IAA)=.FALSE.
      CALL MOL200



  998 CONTINUE


      RETURN
      END
      SUBROUTINE MOL307B

















      IMPLICIT      NONE
      INTEGER       IAA, IFT1, IFT2, IERR







      CALL WIFGRN (IFT1,IFT2,' ')
      IF (IFT1.EQ.0) GOTO 998



      DO 10 IAA=IFT1,IFT2-1
         CALL MOL307A (IAA,IERR)
         IF (IERR.NE.0) GOTO 998
   10 CONTINUE 



  998 CONTINUE


      RETURN
      END   
      SUBROUTINE MOL307C (IAA,IERR)

















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INTEGER       IERR, JATARR(10), NUM, JAT, JAA, IAA
      LOGICAL       WIFIRO, WIFIRA







      IF (WIFPAR(1071).NE.0) THEN
         IERR=0
         GOTO 998
      END IF
      IF (.NOT.WIFIRA(IAA)) THEN
         IERR=0
         GOTO 998
      END IF



      IERR=0
      JAT=BOUND_TO(1,PNTAAS(IAA)+2)



      IF (JAT.EQ.0) GOTO 998
      JAA=ATIAA(JAT)



      CALL FBOND (PNTAAS(IAA)+2,JATARR,10,NUM)



      IF (NUM.GE.3.AND.WIFIRO(JAA).AND.WIFPAR(194).GE.1) THEN
         CALL SHOWTEXT ('?M2401')
         CALL SHOIAA (IAA)
      END IF



  998 CONTINUE


      RETURN
      END   
      SUBROUTINE MOL307D

















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







      IF (NUMAAF.LE.1) THEN
         CALL GVSTT6 ('?SOULOW')
         GOTO 998
      END IF



      DO 100 IAA=1,NUMAAF-1
         IF (CHANAM(IAA).EQ.CHANAM(IAA+1).AND.
     +       CHAINN(2,IAA).NE.CHAINN(2,IAA+1)) THEN
            CALL MOL307A (IAA,IERR)
            CALL MOL307C (IAA,IERR)
         END IF
  100 CONTINUE



  998 CONTINUE


      RETURN
      END   
      SUBROUTINE MOL308

















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







      FOUND=.FALSE.



      CALL SHOWTEXT ('?MOLCP1')



      DO 10 IAA=1,NUMAAF-1
         IF (PSTFLG(IAA)) THEN
            CALL DIF010A (IAA,IAA+1,'paste')
            FOUND=.TRUE.
         END IF
         IF (CUTFLG(IAA)) THEN
            CALL DIF010A (IAA,IAA+1,'cut')
            FOUND=.TRUE.
         END IF
   10 CONTINUE



      IF (.NOT.FOUND) CALL SHOWTEXT ('?M0974')





      RETURN
      END
      SUBROUTINE MOL311

















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INCLUDE       'DATBAS.INC'
      INTEGER       ISOUP, IPASTE, IERR, IAA
      LOGICAL       WIFISA, WIFISN







      IF (NUMAAF.LT.1) THEN
         CALL GVSTTE ('?SOUEMP')
         GOTO 998
      END IF
      IF (NUMSOU.EQ.1) GOTO 998
      IF (SOUADM(5,2).NE.1.AND.SOUADM(5,2).NE.3) GOTO 998



      IPASTE=0



      DO 10 ISOUP=NUMSOU-1,1,-1
         IF ((WIFISA(ISOUP).AND.WIFISA(ISOUP+1)).OR.
     +       (WIFISN(ISOUP).AND.WIFISN(ISOUP+1))) THEN
            IAA=SOUADM(2,ISOUP)
            PSTFLG(IAA)=.TRUE.
            CALL MOL307C (IAA,IERR)
            IPASTE=IPASTE+1
         END IF
   10 CONTINUE



      IF (.NOT.FOR3DM.AND..NOT.DEFALL.AND.WIFPAR(279).EQ.0) 
     + CALL GVSTTI ('?MOLC73',IPASTE)



  998 CONTINUE


      RETURN
      END
      SUBROUTINE MOL311A


















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INCLUDE       'DATBAS.INC'
      INTEGER       ISOUP, IPASTE, IERR, IAA
      LOGICAL       WIFISA, WIFISN







      IF (NUMAAF.LT.1) THEN
         CALL GVSTTE ('?SOUEMP')
         GOTO 998
      END IF
      IF (NUMSOU.EQ.1) GOTO 998
      IF (SOUADM(5,2).NE.1.AND.SOUADM(5,2).NE.3) GOTO 998



      IPASTE=0



      DO 10 ISOUP=NUMSOU-1,1,-1
         IF ((WIFISA(ISOUP).AND.WIFISA(ISOUP+1)).OR.
     +       (WIFISN(ISOUP).AND.WIFISN(ISOUP+1))) THEN



            IAA=SOUADM(2,ISOUP)
            IF (MODNMB(IAA).NE.MODNMB(IAA+1)) GOTO 10
            IF (SOUPNT(IAA).NE.SOUPNT(IAA+1)) GOTO 10
            IF (CHANAM(IAA).NE.CHANAM(IAA+1)) GOTO 10



            PSTFLG(IAA)=.TRUE.
            CALL MOL307C (IAA,IERR)
            IPASTE=IPASTE+1
         END IF
   10 CONTINUE



      CALL MOL200



      IF (.NOT.FOR3DM.AND..NOT.DEFALL.AND.WIFPAR(279).EQ.0) 
     + CALL GVSTTI ('?MOLC73',IPASTE)



  998 CONTINUE


      RETURN
      END
      SUBROUTINE MOL311B


















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INCLUDE       'DATBAS.INC'
      INTEGER       ISOUP, IPASTE, IERR, IAA
      REAL          WIFDST
      LOGICAL       WIFISA, WIFISN, WIFIRA







      IF (NUMAAF.LT.1) THEN
         CALL GVSTTE ('?SOUEMP')
         GOTO 998
      END IF
      IF (NUMSOU.EQ.1) GOTO 998
      IF (SOUADM(5,2).NE.1.AND.SOUADM(5,2).NE.3) GOTO 998



      IPASTE=0



      DO 10 ISOUP=NUMSOU-1,1,-1
         IF ((WIFISA(ISOUP).AND.WIFISA(ISOUP+1)).OR.
     +       (WIFISN(ISOUP).AND.WIFISN(ISOUP+1))) THEN
            IAA=SOUADM(2,ISOUP)
            IF (WIFIRA(IAA)) THEN
               IF (WIFDST(PNTAAC(IAA),PNTAAC(IAA+1)).LT.5.0) THEN
                  PSTFLG(IAA)=.TRUE.
                  CALL MOL307C (IAA,IERR)
                  IPASTE=IPASTE+1
               END IF
            END IF
         END IF
   10 CONTINUE



      CALL MOL200



      IF (.NOT.FOR3DM.AND.WIFPAR(279).EQ.0) CALL GVSTTI 
     + ('?MOLC73',IPASTE)



  998 CONTINUE


      RETURN
      END
      SUBROUTINE MOL311C


















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INCLUDE       'DATBAS.INC'
      INTEGER       IPASTE, IERR, IAA







      IF (NUMAAF.LT.1) THEN
         CALL GVSTTE ('?SOUEMP')
         GOTO 998
      END IF
      IF (NUMSOU.EQ.1) GOTO 998
      IF (SOUADM(5,2).NE.1.AND.SOUADM(5,2).NE.3) GOTO 998



      IPASTE=0



      DO 10 IAA=1,NUMAAT-1
         IF (MODNMB(IAA).EQ.MODNMB(IAA+1).AND.
     +       CHAINN(2,IAA).NE.CHAINN(2,IAA+1)) THEN
            IF (.NOT.PSTFLG(IAA)) THEN
               PSTFLG(IAA)=.TRUE.
               CALL MOL307C (IAA,IERR)
               IPASTE=IPASTE+1
            END IF
         END IF
   10 CONTINUE



      CALL MOL200



      IF (.NOT.FOR3DM.AND.WIFPAR(279).EQ.0) CALL GVSTTI 
     + ('?MOLC73',IPASTE)



  998 CONTINUE


      RETURN
      END
      SUBROUTINE MOL312

















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INTEGER       IAA







      DO 10 IAA=1,NUMAAF
         IF (CUTFLG(IAA)) CUTFLG(IAA)=.FALSE.
         IF (PSTFLG(IAA)) PSTFLG(IAA)=.FALSE.
   10 CONTINUE
      CALL MOL200





      RETURN
      END
      SUBROUTINE MOL313

















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INCLUDE       'IRIGRA.INC'
      INTEGER       IAA
      CHARACTER*80  TEXT
      LOGICAL       WIFIRR







      IF (NUMAAF.LE.0) THEN
         CALL GVSTTE ('?SOUEMP')
         GOTO 998
      END IF



   10 CONTINUE
      CALL GVSSTX (TPTXLN,'?MOLC74')
      CALL WIFGRS (IAA,TPTXLN)
      IF (IAA.EQ.0) GOTO 998
      IF (.NOT.WIFIRR(IAA)) THEN
         CALL GVSTTE ('?RNGNPN')
         GOTO 10
      END IF



      CALL MOL313A (IAA,ONESA3(IAA))



      TEXT=LINE
      CALL MOL314 (IAA,TEXT)
      CALL GVSCTB (TPTXLN,LENTPT)



  998 CONTINUE


      RETURN
      END
      SUBROUTINE MOL313A (IAA,AACID)


















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INTEGER       IAA
      CHARACTER*4   AACID







      CALL GVSFMT ('?FMT166')
      CALL GVSCTB (LINE,80)
      WRITE (LINE,FMT,ERR=999) AACID,IAA
      CALL GVSTCP (LINE)
      CALL GVSCUC (LINE)
      GOTO 998



  999 CONTINUE
      CALL GVSEIW ('MOL313A')



  998 CONTINUE


      RETURN
      END
      SUBROUTINE MOL314 (IAA,TEXT)

















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INTEGER       GVFLEN, IAA, IAT, IUNIT, IERR
      LOGICAL       GVFFOP, WIFIRI
      CHARACTER*(*) TEXT







      IF (GVFLEN(TEXT).LE.0) THEN
         CALL GVSTTE ('?MOLC75')
         GOTO 998
      END IF
      IF (.NOT.WIFIRI(IAA)) THEN
         CALL GVSTTE ('?MOLC76')
         GOTO 998
      END IF



      CALL GVSROF (IUNIT,IERR)
      IF (IUNIT.LE.0.OR.IERR.NE.0) GOTO 998
      CALL GVSCLF (IUNIT)
      CALL GVSDEL (TEXT)
      CALL GVSOUF (TEXT,IUNIT,'NEW')
      IF (.NOT.GVFFOP(IUNIT)) THEN
         CALL GVST6C ('?SYM012',TEXT,.TRUE.)
         GOTO 998
      END IF



      WRITE (IUNIT,ERR=999) IAA,ONESA3(IAA),NUMNAM(IAA),CHANAM(IAA)



      DO 10 IAT=PNTAAS(IAA),PNTAAE(IAA)
         WRITE (IUNIT,ERR=999) XCOORD(IAT),YCOORD(IAT),ZCOORD(IAT),
     +    XBFACT(IAT),WEIGHT(IAT),VDWRAD(IAT),ATCOLR(IAT),
     +    ISATOK(IAT),ONESAT(IAT)
 10   CONTINUE
      CALL GVSCLF (IUNIT)
      GOTO 998



 999  CALL GVSEIW ('MOL314')



  998 CONTINUE


      RETURN
      END
      SUBROUTINE MOL315

















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INCLUDE       'IRIGRA.INC'
      INCLUDE       'JUNIOR.INC'
      INTEGER       IERR, IAA
      CHARACTER*80  TEXT
      CHARACTER*4   AACID, THISNM
      LOGICAL       WIFIRR







      IF (NUMAAF.LE.0) THEN
         CALL GVSTTE ('?MOLC77')
         GOTO 998
      END IF
      CALL SHOWTEXT ('?M0004')



   10 CONTINUE
      CALL GVSSTX (TPTXLN,'MOLC78')
      CALL WIFGRS (IAA,' ')
      IF (IAA.EQ.0) GOTO 998
      IF (.NOT.WIFIRR(IAA)) THEN
         CALL GVSTTE ('?MOLC79')
         GOTO 10
      END IF



      CALL WIFPUSHPPP (141,FAMTYP(RESTYP(IAA)))
      CALL WIFGAA (AACID,'?MOLC80')
      CALL WIFPOPPPP (141)
      IF (AACID.EQ.'0   ') GOTO 998



      CALL MOL313A (IAA+1,AACID)
      CALL GVSSTX (TEXT,LINE)



      CALL GVSCTB (THISNM,4)
      CALL MOL104 (AACID,THISNM,AACID,IAA,' ',IERR)
      CALL MOL200
      IF (IERR.NE.0) GOTO 998



      CALL MOL316 (IAA,TEXT,IERR)
      IF (IERR.NE.0) THEN
         CALL MOL105 (IAA+1)
      ELSE
         CALL SHOIAA (IAA+1)
      END IF



      CALL MOL200
      PREVSHOW(IAA-1)=0
      PREVSHOW(IAA)=0
      PREVSHOW(IAA+1)=0



  998 CONTINUE


      RETURN
      END
      SUBROUTINE MOL316 (IAA,TEXT,IERR)

















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INTEGER       IERR, IAA, IAAINS, IAT, IUNIT
      LOGICAL       GVFFOP, GVFISF
      CHARACTER*(*) TEXT
      CHARACTER*4   THISAA, THISNM
      CHARACTER*1   DUMMY







      IF (.NOT.GVFISF(TEXT)) THEN
         CALL GVST6C ('?MOLC81',TEXT,.TRUE.)
         IERR=1
         GOTO 997
      END IF



      CALL GVSROF (IUNIT,IERR)
      IF (IUNIT.LE.IUNIT.OR.IERR.NE.0) GOTO 997
      CALL GVSCLF (IUNIT)
      CALL GVSOUF (TEXT,IUNIT,'OLD')
      IF (.NOT.GVFFOP(IUNIT)) THEN
         CALL GVST6C ('?SYM012',TEXT,.TRUE.)
         IERR=1
         GOTO 997
      END IF



      READ (IUNIT,ERR=999,END=998) IAAINS,THISAA,THISNM,DUMMY
      CALL GVSSTX (LINE,'?MOLC82')
      CALL GVSFMT ('?FMT167')
      WRITE (LINE(50:80),FMT,ERR=998) IAAINS,THISAA,THISNM
      CALL GVSRDB (LINE)
      CALL GVSTT6 (LINE)



      DO 10 IAT=PNTAAS(IAA),PNTAAE(IAA)
         READ (IUNIT,END=999,ERR=999) XCOORD(IAT),YCOORD(IAT),
     +    ZCOORD(IAT),XBFACT(IAT),WEIGHT(IAT),VDWRAD(IAT),ATCOLR(IAT),
     +    ISATOK(IAT),ONESAT(IAT)
 10   CONTINUE
      CALL MOL200



      CALL GVSCLF (IUNIT)
      IERR=0
      GOTO 997



  999 CONTINUE
      CALL GVSTTE ('?MOLC83')
  998 CONTINUE
      CALL GVSCLF (IUNIT)
      CALL MOL200
      IERR=1



  997 CONTINUE


      RETURN
      END
      SUBROUTINE MOL316A (IAA,TEXT,IERR)

















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INTEGER       IERR, IAA, DUMMY, IAT, INDAA3
      LOGICAL       GVFFOP, GVFISF
      CHARACTER*80  TEXT
      CHARACTER*4   THISAA, THISNM
      CHARACTER*1   LOCCHA








      IF (.NOT.GVFISF(TEXT)) THEN
         CALL GVST6C ('?MOLC81',TEXT,.TRUE.)
         IERR=1
         GOTO 997
      END IF



      CALL GVSCLF (11)
      CALL GVSOUF (TEXT,11,'OLD')
      IF (.NOT.GVFFOP(11)) THEN
         CALL GVST6C ('?SYM012',TEXT,.TRUE.)
         IERR=1
         GOTO 997
      END IF



      READ (11,ERR=999,END=998) DUMMY,THISAA,THISNM,LOCCHA



      CALL WIF330 (IAA,INDAA3(THISAA))
      NUMNAM(IAA)=THISNM
      CHANAM(IAA)=LOCCHA



      DO 10 IAT=PNTAAS(IAA),PNTAAE(IAA)
         READ (11,END=999,ERR=999) XCOORD(IAT),YCOORD(IAT),ZCOORD(IAT),
     +    XBFACT(IAT),WEIGHT(IAT),VDWRAD(IAT),ATCOLR(IAT),
     +    ISATOK(IAT),ONESAT(IAT)
 10   CONTINUE
      CALL MOL200



      CALL GVSCLF (11)
      IERR=0
      GOTO 997



  999 CONTINUE
      CALL GVSTTE ('?MOLC83')
  998 CONTINUE
      CALL GVSCLF (11)
      CALL MOL200
      IERR=1



  997 CONTINUE



      RETURN
      END
      SUBROUTINE MOL317

















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INCLUDE       'ENVIRO.INC'
      INTEGER       IERR, ISOUP







      IF (NUMSOU.LT.1) THEN
         CALL GVSTTE ('?NEWE435')
         GOTO 998
      END IF



      CALL GVSIT0 (USERSOU,MAXMOL)



      CALL GETUSESOU ('?NEWP137',' ',IERR)
      IF (IERR.NE.0) GOTO 998
      CALL GVSCPI (USERSOU,USESOU,NUMSOU)



      DO 20 ISOUP=NUMSOU,1,-1
         IF (USERSOU(ISOUP).NE.0) THEN
            CALL GVSTTI ('?M0220',ISOUP)
            CALL MOL101A (ISOUP)
            CALL MOL200
         END IF
   20 CONTINUE



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



      CALL MOL200



      CALL JUN006



  998 CONTINUE


      RETURN
      END
      SUBROUTINE MOL319 (JFT1,JFT2)

















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INTEGER       IFT1, IFT2, IERR, JFT1, JFT2
      CHARACTER*80  LOCLIN







      IF (NUMAAF.LE.0) THEN
         CALL GVSTTE ('?SOULOW')
         GOTO 998
      END IF
      IF (NUMSOU.GE.MAXMOL-2) THEN
         CALL TOOMANY ('?MOLC26')
         CALL GVSTTI2 ('4) NUMSOU,MAXMOL=',NUMSOU,MAXMOL-2)
         CALL SHOSOU
         GOTO 998
      END IF



      IF (JFT1.EQ.0) THEN
         CALL WIFGRN (IFT1,IFT2,' ')
         IF (IFT1.EQ.0) GOTO 998
      ELSE
         IFT1=JFT1
         IFT2=JFT2
      END IF
      CALL GVSBTF (WRK1TF,MAXAA)
      CALL GVSBTT (WRK1TF(IFT1),IFT2-IFT1+1)
      CALL WRK1TFCOMPLETE



      CALL WIFPUSHPPP (1820,1)
      CALL GVSDEL ('SOUCOP')
      CALL GVSCCC (LOCLIN,WHERIS,'DUMMY.HED')
      CALL WIF508 (LOCLIN,'SOUCOP',0,0)
      CALL GVSCLF (3)
      CALL GVSCLF (4)
      CALL GVSCLF (11)
      CALL GVSCLF (13)
      CALL WIFPOPPPP (1820)



      IF (WIFPAR(1264).EQ.2) THEN
         CALL GVSSTX (FILNMS(91),'SOUCOP')
         CALL MOL018
         CALL GVSFMT ('?FMT024')
         WRITE (FILNMS(91)(11:14),FMT,ERR=999) WIFPAR(491)
         CALL GVSTCP (FILNMS(91))
         CALL GVSSTX (SOUNAM(WIFPAR(491)),FILNMS(91))
      END IF



      CALL MOL700 ('SOUCOP',IERR)
      IF (IERR.NE.0) GOTO 998



      CALL MOL007



      CALL MOL002
      CALL MOL200
      CALL KLONKCLEAN





      GOTO 998



 999  CONTINUE
      CALL GVSEIW ('MOL319')



  998 CONTINUE


      RETURN
      END
      SUBROUTINE MOL319A

















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INTEGER       IFT1, IFT2, IAA, LOCAAF, IERR







      IF (NUMAAF.LE.0) THEN
         CALL GVSTTE ('?SOULOW')
         GOTO 998
      END IF



   10 CONTINUE
      CALL WIFGRN (IFT1,IFT2,' ')
      IF (IFT1.EQ.0) GOTO 998
      IF (IFT2.GT.NUMAAF) THEN
         CALL GVSTTE ('?RNGNAA')
         GOTO 10
      END IF



      DO 20 IAA=IFT2,IFT1,-1
         LOCAAF=NUMAAF
         CALL MOL104 (ONESA3(IAA),NUMNAM(IAA),ONEORG(IAA),
     +    LOCAAF,' ',IERR)
         IF (IERR.NE.0) GOTO 998
         CALL WIF088 (IAA,NUMAAF)
   20 CONTINUE



      DO 30 IAA=IFT2,IFT1,-1
         CALL MOL105 (IAA)
         CALL MOL200
   30 CONTINUE



  998 CONTINUE


      RETURN
      END
      SUBROUTINE MOL332 (ICYS2,ICYS1)

















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INTEGER       ICYS1, ICYS2, ICYS







      ICYS2=0



      IF (ONESA3(ICYS1)(1:2).NE.'CY') THEN
         CALL GVSTTB ('?NEWB148')
         GOTO 998
      END IF
      IF (NUMCYS.LE.0) GOTO 998



      DO 10 ICYS=1,NUMCYS
         IF (CYSCYS(1,ICYS).EQ.ICYS1) THEN
            ICYS2=CYSCYS(2,ICYS)
            IF (ONESA3(ICYS2)(1:2).NE.'CY') THEN
               CALL GVSTTB ('?NEWB149')
               CALL GVSTT6 ('?NEWT509')
               ICYS2=0
            END IF
            GOTO 998
         END IF
   10 CONTINUE



  998 CONTINUE


      RETURN
      END
      SUBROUTINE MOL333 (JAA)

















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INTEGER       IERR, IAA, JAA, NATOLD, NAAOLD, NSOOLD
      LOGICAL       GVFYON, WIFIR3, WIFIRA, ADD1P, WIFIRX









      IF (WIFPAR(1510).EQ.1) THEN
         CALL SHOWTEXT ('?R00301')
         GOTO 998
      END IF
      IF (WIFPAR(1071).NE.0.OR.WIFPAR(1217).NE.0) GOTO 998



      IF (JAA.EQ.0) THEN



            CALL GVSTTB ('?M1304')

      ELSE
         IAA=JAA
      END IF
      IF (IAA.LE.0) GOTO 998



      IF (.NOT.WIFIRA(IAA)) THEN
         CALL GVSTTE ('?NEWE445')
         GOTO 998
      END IF
      IF (.NOT.ISATOK(PNTAAS(IAA)+1)) THEN
         CALL GVSTT6 ('?M2408')
         GOTO 998
      END IF
      IF (.NOT.ISATOK(PNTAAS(IAA)+2)) THEN
         CALL GVSTT6 ('?M2408')
         GOTO 998
      END IF



      IF (.NOT.WIFIR3(IAA)) THEN
         IF (JAA.EQ.0) THEN
            CALL GVSTTE ('?AANCT')
            IF (.NOT.GVFYON('?NEWY46',' ')) GOTO 998
         ELSE
            GOTO 998
         END IF
      END IF



      IF (.NOT.WIFIRX(IAA)) THEN
         IF (JAA.EQ.0) THEN
            CALL GVSTTE ('?AANCTR')
            IF (.NOT.GVFYON('?NEWY46',' ')) GOTO 998
         ELSE
            GOTO 998
         END IF
      END IF         



      IF (BOUND_TO(1,PNTAAC(IAA)+1).NE.0) THEN
         IF (JAA.EQ.0) THEN
            CALL GVSTTE ('?AANCTB')
            IF (.NOT.GVFYON('?NEWY46',' ')) GOTO 998
         ELSE
            GOTO 998
         END IF
      END IF



      ADD1P=.FALSE.



      IF (.NOT.ISATOK(PNTAAS(IAA)+3)) THEN
         CALL WRE031 (IAA,CV)
         XCOORD(PNTAAS(IAA)+3)=CV(1)
         YCOORD(PNTAAS(IAA)+3)=CV(2)
         ZCOORD(PNTAAS(IAA)+3)=CV(3)
         ISATOK(PNTAAS(IAA)+3)=.TRUE.
         CALL GVSTT6 ('?M2410')
         ADD1P=.TRUE.
      END IF
      CALL WRE031 (IAA,CV)



      NATOLD=NUMATF
      NAAOLD=NUMAAT
      NSOOLD=NUMSOU
      CALL MOL123 (ONESA3(IAA),NUMNAM(IAA),CHANAM(IAA),
     + SOUNAM(SOUPNT(IAA)),4,1,' ',IERR)



      IF (IERR.NE.0) THEN
         CALL GVSTTB ('?NEWB150')
         NUMATF=NATOLD
         NUMAAT=NAAOLD
         NUMSOU=NSOOLD



      ELSE
         BOUND_TO(1,PNTAAS(IAA)+2)=NUMATF
         BOUND_TO(1,NUMATF)=PNTAAS(IAA)+2
         XCOORD(NUMATF)=CV(1)
         YCOORD(NUMATF)=CV(2)
         ZCOORD(NUMATF)=CV(3)
         XBFACT(NUMATF)=XBFACT(PNTAAS(IAA)+2)
         WEIGHT(NUMATF)=0.99
         VDWRAD(NUMATF)=1.4
         ISATOK(NUMATF)=.TRUE.
         PROTON(NUMATF)=.FALSE.
         ATIAA(NUMATF)=NUMAAT
         CALL GVSSTX (ONESAT(NUMATF),' O  ')
         CALL GVSSTX (ORGNAM(NUMATF),' O  ')
         ONESAT(NUMATF)(3:3)=''''
         ORGNAM(NUMATF)(3:3)=''''
         ONESAT(NUMATF)(4:4)=''''
         ORGNAM(NUMATF)(4:4)=''''
         CALL GVSTT6 ('?M2409')
      END IF



      CALL MOL200
      CALL COL002 (IAA,IAA)
      CALL COL105 (IAA,NUMATF)
      WIFPAR(1179)=1



  998 CONTINUE


      RETURN
      END
      SUBROUTINE MOL333A (JAA)

















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INTEGER       IERR, IAA, JAA, KAA, KAT, NATOLD, NAAOLD, NSOOLD
      REAL          GVFDTR
      LOGICAL       WIFIRA, WIFIRO







      IF (WIFPAR(1510).EQ.1) THEN
         CALL SHOWTEXT ('?R00301')
         GOTO 998
      END IF



      IF (JAA.EQ.0) THEN
         CALL WIFGRS (IAA,' ')
      ELSE
         IAA=JAA
      END IF
      IF (IAA.LE.0) GOTO 998



      IF (.NOT.WIFIRA(IAA)) THEN
         CALL GVSTTE ('?NEWE445')
         GOTO 998
      END IF
      KAT=BOUND_TO(1,PNTAAS(IAA)+2)
      IF (KAT.LE.0) GOTO 998
      KAA=ATIAA(KAT)
      IF (.NOT.WIFIRO(KAA)) GOTO 998



      SCRRW1(1)=XCOORD(PNTAAC(IAA))-XCOORD(PNTAAS(IAA)+2)
      SCRRW1(2)=YCOORD(PNTAAC(IAA))-YCOORD(PNTAAS(IAA)+2)
      SCRRW1(3)=ZCOORD(PNTAAC(IAA))-ZCOORD(PNTAAS(IAA)+2)
      SCRRW1(1)=XCOORD(PNTAAS(KAA))-XCOORD(PNTAAS(IAA)+2)
      SCRRW1(2)=YCOORD(PNTAAS(KAA))-YCOORD(PNTAAS(IAA)+2)
      SCRRW1(3)=ZCOORD(PNTAAS(KAA))-ZCOORD(PNTAAS(IAA)+2)
      CALL GVSCP3 (SCRRW3,SCRRW2,SCRRW1)



      CV(1)=XCOORD(PNTAAS(KAA))-XCOORD(PNTAAS(IAA)+2)
      CV(2)=YCOORD(PNTAAS(KAA))-YCOORD(PNTAAS(IAA)+2)
      CV(3)=ZCOORD(PNTAAS(KAA))-ZCOORD(PNTAAS(IAA)+2)
      CALL GVSNM3 (CV)



      CALL GVSMGM (MAT_1,SCRRW3,GVFDTR(60.0))



      CALL GVSMVV (CV,MAT_1)



      NATOLD=NUMATF
      NAAOLD=NUMAAT
      NSOOLD=NUMSOU
      CALL WIFPUSHPPP (1180,1)
      CALL MOL123 (ONESA3(KAA),NUMNAM(KAA),CHANAM(KAA),
     + SOUNAM(SOUPNT(KAA)),4,1,' ',IERR)
      CALL WIFPOPPPP (1180)



      IF (IERR.NE.0) THEN
         CALL GVSTTB ('?NEWB150')
         NUMATF=NATOLD
         NUMAAT=NAAOLD
         NUMSOU=NSOOLD



      ELSE
         BOUND_TO(1,PNTAAS(KAA))=NUMATF
         BOUND_TO(1,NUMATF)=PNTAAS(KAA)
         XCOORD(NUMATF)=CV(1)+XCOORD(PNTAAS(KAA))
         YCOORD(NUMATF)=CV(2)+YCOORD(PNTAAS(KAA))
         ZCOORD(NUMATF)=CV(3)+ZCOORD(PNTAAS(KAA))
         XBFACT(NUMATF)=XBFACT(PNTAAS(KAA))
         WEIGHT(NUMATF)=0.99
         ISATOK(NUMATF)=.TRUE.
         PROTON(NUMATF)=.TRUE.
         ATIAA(NUMATF)=IAA
         CALL GVSSTX (ONESAT(NUMATF)(1:3),' HO')
         ONESAT(NUMATF)(4:4)=''''
         CALL GVSSTX (ORGNAM(NUMATF)(1:3),' HO')
         ORGNAM(NUMATF)(4:4)=''''
      END IF



      CALL MOL200

         CALL HBO010

      CALL COL105 (IAA,NUMATF)



  998 CONTINUE


      RETURN
      END
      SUBROUTINE MOL333B (JAA)

















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INTEGER       IERR, IAA, JAA, NATOLD, NAAOLD, NSOOLD
      REAL          GVFDTR
      LOGICAL       GVFYON, WIFIR3, WIFIRA







      IF (WIFPAR(1510).EQ.1) THEN
         CALL SHOWTEXT ('?R00301A')
         GOTO 998
      END IF
      IF (WIFPAR(448).GE.1) GOTO 998



      IF (JAA.EQ.0) THEN
         CALL WIFGRS (IAA,' ')
      ELSE
         IAA=JAA
      END IF



      IF (IAA.LE.0) GOTO 998
      IF (.NOT.WIFIRA(IAA)) THEN
         CALL GVSTTE ('?NEWE445')
         GOTO 998
      END IF
      IF (.NOT.WIFIR3(IAA)) THEN
         CALL GVSTTE ('?AANCT')
         IF (.NOT.GVFYON('?NEWY46',' ')) GOTO 998
      END IF
      IF (BOUND_TO(1,PNTAAC(IAA)+1).NE.0) GOTO 998



      SCRRW1(1)=XCOORD(PNTAAC(IAA))-XCOORD(PNTAAS(IAA)+2)
      SCRRW1(2)=YCOORD(PNTAAC(IAA))-YCOORD(PNTAAS(IAA)+2)
      SCRRW1(3)=ZCOORD(PNTAAC(IAA))-ZCOORD(PNTAAS(IAA)+2)
      SCRRW1(1)=XCOORD(PNTAAS(IAA)+3)-XCOORD(PNTAAS(IAA)+2)
      SCRRW1(2)=YCOORD(PNTAAS(IAA)+3)-YCOORD(PNTAAS(IAA)+2)
      SCRRW1(3)=ZCOORD(PNTAAS(IAA)+3)-ZCOORD(PNTAAS(IAA)+2)
      CALL GVSCP3 (SCRRW3,SCRRW2,SCRRW1)



      CV(1)=XCOORD(PNTAAS(IAA)+3)-XCOORD(PNTAAS(IAA)+2)
      CV(2)=YCOORD(PNTAAS(IAA)+3)-YCOORD(PNTAAS(IAA)+2)
      CV(3)=ZCOORD(PNTAAS(IAA)+3)-ZCOORD(PNTAAS(IAA)+2)
      CALL GVSNM3 (CV)



      CALL GVSMGM (MAT_1,SCRRW3,GVFDTR(60.0))



      CALL GVSMVV (CV,MAT_1)



      NATOLD=NUMATF
      NAAOLD=NUMAAT
      NSOOLD=NUMSOU
      CALL WIFPUSHPPP (1180,1)
      CALL MOL123 (ONESA3(IAA),NUMNAM(IAA),CHANAM(IAA),
     + SOUNAM(SOUPNT(IAA)),4,1,' ',IERR)
      CALL WIFPOPPPP (1180)



      IF (IERR.NE.0) THEN
         CALL GVSTTB ('?NEWB150')
         NUMATF=NATOLD
         NUMAAT=NAAOLD
         NUMSOU=NSOOLD



      ELSE
         BOUND_TO(1,PNTAAS(IAA)+3)=NUMATF
         BOUND_TO(1,NUMATF)=PNTAAS(IAA)+3
         XCOORD(NUMATF)=CV(1)+XCOORD(PNTAAS(IAA)+3)
         YCOORD(NUMATF)=CV(2)+YCOORD(PNTAAS(IAA)+3)
         ZCOORD(NUMATF)=CV(3)+ZCOORD(PNTAAS(IAA)+3)
         XBFACT(NUMATF)=XBFACT(PNTAAS(IAA)+3)
         WEIGHT(NUMATF)=1.0
         ISATOK(NUMATF)=.TRUE.
         PROTON(NUMATF)=.TRUE.
         ATIAA(NUMATF)=IAA
         CALL GVSSTX (ONESAT(NUMATF)(1:3),' HO')
         ONESAT(NUMATF)(4:4)=''''
         CALL GVSSTX (ORGNAM(NUMATF)(1:3),' HO')
         ORGNAM(NUMATF)(4:4)=''''
      END IF



      CALL MOL200

         CALL HBO010

      CALL COL105 (IAA,NUMATF)



  998 CONTINUE


      RETURN
      END
      SUBROUTINE MOL334

















      IMPLICIT      NONE
      INTEGER       ISOU1, ISOU2







      CALL MOL310 (ISOU1,-1,' ')
      IF (ISOU1.EQ.0) GOTO 998
      CALL MOL310 (ISOU2,-1,' ')
      IF (ISOU2.EQ.0) GOTO 998
      CALL GVSTT6 ('?OPTNOY')



  998 CONTINUE


      RETURN
      END
      SUBROUTINE MOL335




















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INCLUDE       'ESPACE.INC'
      INCLUDE       'SUPPOS.INC'
      INTEGER       BASE1, BASE2, IFT1, IFT2, JFT1, JFT2, IUSED,
     +              LOCIAT, IAT, JAT
      LOGICAL       WIFIRN
      REAL          OLD(3,22), NEW(3,22), RMSE, EMAX
      EQUIVALENCE   (OLD(1,1), ESPACE(5001))
      EQUIVALENCE   (NEW(1,1), ESPACE(6001))







      CALL ESPSET (5001,6000+3*22,27)



      CALL GVSRT0 (OLD,3*22)
      CALL GVSRT0 (NEW,3*22)



      CALL SHOWTEXT ('?MOLDDN')
   10 CONTINUE
      CALL WIFGRS (BASE1,'?DNARNA1')
      IF (BASE1.EQ.0) GOTO 998
      IF (.NOT.WIFIRN(BASE1)) THEN
         CALL GVSTTE ('?MOLB44')
         GOTO 10
      END IF
   20 CONTINUE
      CALL WIFGRS (BASE2,'?DNARNA2')
      IF (BASE2.EQ.0) GOTO 998
      IF (.NOT.WIFIRN(BASE2)) THEN
         CALL GVSTTE ('?MOLB44')
         GOTO 20
      END IF
      IF (CHAINN(2,BASE1).EQ.CHAINN(2,BASE2)) THEN
         CALL GVSTTE ('?MOLB45')
         GOTO 998
      END IF








      IF (BASE1.EQ.SOUADM(1,CHAINN(2,BASE1))) THEN
         CALL GVSTT6 ('?M2001')
         GOTO 998
      END IF
      IF (BASE2.EQ.SOUADM(2,CHAINN(2,BASE2))) THEN
         CALL GVSTT6 ('?M2002')
         GOTO 998
      END IF
      IFT1=SOUADM(1,CHAINN(2,BASE1))
      IFT2=BASE1-1
      JFT2=SOUADM(2,CHAINN(2,BASE2))
      JFT1=BASE2+1
      IF (IFT1.GT.IFT2.OR.JFT1.GT.JFT2) THEN
         CALL GVSTTB ('?MOLB46')
         GOTO 998
      END IF



      IUSED=0
      DO 30 IAT=PNTAAS(BASE1),PNTAAS(BASE1)+10
         LOCIAT=IAT-PNTAAS(BASE1)+1
         JAT=PNTAAS(BASE1-1)+LOCIAT-1
         IF (ISATOK(IAT).AND.ISATOK(JAT)) THEN
            IUSED=IUSED+1
            OLD(1,IUSED)=XCOORD(IAT)
            OLD(2,IUSED)=YCOORD(IAT)
            OLD(3,IUSED)=ZCOORD(IAT)
            NEW(1,IUSED)=XCOORD(JAT)
            NEW(2,IUSED)=YCOORD(JAT)
            NEW(3,IUSED)=ZCOORD(JAT)
         END IF
   30 CONTINUE
      DO 40 IAT=PNTAAS(BASE2),PNTAAS(BASE2)+10
         LOCIAT=IAT-PNTAAS(BASE2)+1
         JAT=PNTAAS(BASE2+1)+LOCIAT-1
         IF (ISATOK(IAT).AND.ISATOK(JAT)) THEN
            IUSED=IUSED+1
            OLD(1,IUSED)=XCOORD(IAT)
            OLD(2,IUSED)=YCOORD(IAT)
            OLD(3,IUSED)=ZCOORD(IAT)
            NEW(1,IUSED)=XCOORD(JAT)
            NEW(2,IUSED)=YCOORD(JAT)
            NEW(3,IUSED)=ZCOORD(JAT)
         END IF
   40 CONTINUE



      CALL GVSSPN (IUSED, OLD, NEW, SUPMAT, SUPVEC, RMSE, EMAX)
      CALL WIF092 (IFT1,IFT2,SUPMAT,SUPVEC)
      CALL WIF092 (JFT1,JFT2,SUPMAT,SUPVEC)



      CALL MOL105 (BASE1)
      CALL MOL105 (BASE2)
      CALL MOL200



  998 CONTINUE


      RETURN
      END   
      SUBROUTINE MOL336

















      IMPLICIT      NONE


      RETURN
      END
      SUBROUTINE MOL337

















      IMPLICIT      NONE

      RETURN
      END   
      SUBROUTINE MOL338 (IAA,OLDROW)

















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INTEGER       IAA, IAT
      REAL          OLDROW(3,MAXTAT)



      DO 10 IAT=PNTAAS(IAA),PNTAAE(IAA)
         OLDROW(1,PINIAA(IAT))=XCOORD(IAT)
         OLDROW(2,PINIAA(IAT))=YCOORD(IAT)
         OLDROW(3,PINIAA(IAT))=ZCOORD(IAT)
   10 CONTINUE

      RETURN
      END
      SUBROUTINE MOL339 (IAA,OLDROW)

















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INTEGER       IAA, IAT
      REAL          OLDROW(3,MAXTAT)



      DO 10 IAT=PNTAAS(IAA),PNTAAE(IAA)
         XCOORD(IAT)=OLDROW(1,PINIAA(IAT))
         YCOORD(IAT)=OLDROW(2,PINIAA(IAT))
         ZCOORD(IAT)=OLDROW(3,PINIAA(IAT))
   10 CONTINUE

      RETURN
      END
      LOGICAL FUNCTION ISPAIR (IAA,JAA)


















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INCLUDE       'HBONDS.INC'
      LOGICAL       WIFIRN
      INTEGER       IAA, IAT, JAA, JAT
      REAL          HBOVAL, HBOQVAL







      HBOVAL=0.0
      ISPAIR=.FALSE.



      IF ((.NOT.WIFIRN(IAA)).OR.(.NOT.WIFIRN(JAA))) THEN
         CALL GVSTTI2 ('?M0704',IAA,JAA)
         GOTO 998
      END IF



      DO 100 IAT=PNTAAS(IAA)+10,PNTAAE(IAA)
         IF (.NOT.USABLE(IAT)) GOTO 100



         DO 80 JAT=PNTAAS(JAA),PNTAAE(JAA)



            IF (.NOT.USABLE(JAT)) GOTO 80
            IF (IAT.EQ.JAT) GOTO 80
            IF (DONACC(IAT)*DONACC(JAT).EQ.1) GOTO 80




               HBOVAL=HBOVAL+MAX(HBOQVAL(IAT,JAT,1),
     +          HBOQVAL(JAT,IAT,1))




            IF (HBOVAL.GT.0.5) THEN
               ISPAIR=.TRUE.
               GOTO 998
            END IF
   80    CONTINUE
  100 CONTINUE



  998 CONTINUE


      RETURN
      END
      SUBROUTINE MOL340

















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







      DO 10 IAA=1,NUMAAT
         IF (.NOT.GVFIBN(RESTYP(IAA),1,20).AND.WIFIRA(IAA)) THEN
            CALL SHOIAA (IAA)
         END IF
 10   CONTINUE





      RETURN
      END   
      SUBROUTINE WRE031 (IAA,WXYZ)

















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INTEGER       IAA
      REAL          WXYZ(3)







      IF (BOUND_TO(1,PNTAAS(IAA)+2).NE.0) THEN
         WXYZ(1)=XCOORD(BOUND_TO(1,PNTAAS(IAA)+2))
         WXYZ(2)=YCOORD(BOUND_TO(1,PNTAAS(IAA)+2))
         WXYZ(3)=ZCOORD(BOUND_TO(1,PNTAAS(IAA)+2))
      ELSE
         IF (ISATOK(PNTAAS(IAA)+2).AND.ISATOK(PNTAAS(IAA)+3).AND.
     +       ISATOK(PNTAAS(IAA)+1)) THEN




            WXYZ(1)=3*XCOORD(PNTAAS(IAA)+2)-XCOORD(PNTAAS(IAA)+3)-
     +       XCOORD(PNTAAS(IAA)+1)
            WXYZ(2)=3*YCOORD(PNTAAS(IAA)+2)-YCOORD(PNTAAS(IAA)+3)-
     +       YCOORD(PNTAAS(IAA)+1)
            WXYZ(3)=3*ZCOORD(PNTAAS(IAA)+2)-ZCOORD(PNTAAS(IAA)+3)-
     +       ZCOORD(PNTAAS(IAA)+1)



            WXYZ(1)=WXYZ(1)-XCOORD(PNTAAS(IAA)+2)
            WXYZ(2)=WXYZ(2)-YCOORD(PNTAAS(IAA)+2)
            WXYZ(3)=WXYZ(3)-ZCOORD(PNTAAS(IAA)+2)
            CALL GVSNM3 (WXYZ)
            CALL GVSVXC (WXYZ,1.231,3)
            WXYZ(1)=WXYZ(1)+XCOORD(PNTAAS(IAA)+2)
            WXYZ(2)=WXYZ(2)+YCOORD(PNTAAS(IAA)+2)
            WXYZ(3)=WXYZ(3)+ZCOORD(PNTAAS(IAA)+2)
         ELSE IF (ISATOK(PNTAAS(IAA)).AND.ISATOK(PNTAAS(IAA)+1).AND.
     +       ISATOK(PNTAAS(IAA)+2)) THEN




            WXYZ(1)=XCOORD(PNTAAS(IAA)+1)-XCOORD(PNTAAS(IAA))
            WXYZ(2)=YCOORD(PNTAAS(IAA)+1)-YCOORD(PNTAAS(IAA))
            WXYZ(3)=ZCOORD(PNTAAS(IAA)+1)-ZCOORD(PNTAAS(IAA))
            CALL GVSNM3 (WXYZ)
            CALL GVSVXC (WXYZ,1.231,3)
            WXYZ(1)=WXYZ(1)+XCOORD(PNTAAS(IAA)+2)
            WXYZ(2)=WXYZ(2)+YCOORD(PNTAAS(IAA)+2)
            WXYZ(3)=WXYZ(3)+ZCOORD(PNTAAS(IAA)+2)        
         END IF
      END IF





      RETURN
      END
