



      SUBROUTINE MOL330 (INNUMB)

















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INCLUDE       'ENVIRO.INC'
      INCLUDE       'HSPINC.INC'
      INCLUDE       'HSTINC.INC'
      INCLUDE       'SYMINC.INC'
      INCLUDE       'AUDOCK.INC'
      INCLUDE       'ESPACE.INC'
      INTEGER       I, J, INNUMB, IERR, IUNIT
      LOGICAL       GVFFOP







      IF (GVFFOP(INNUMB)) THEN
         CALL GVSTTI ('File is open at start of SAVSOU:',INNUMB)
         CALL GVSKIL
      END IF



      CALL MOL330B (IUNIT,INNUMB,'NEW',IERR)
      IF (IERR.NE.0) GOTO 998




      WRITE (IUNIT,ERR=999) NUMSOU,NUMRNG,NUMAAF,NUMAAT,NUMCYS,NUMCOF,
     + NUMATF,HSTDON,LOGGER,AUTOFL



      WRITE (IUNIT,ERR=999) ((SOUADM(I,J),I=1,20),J=1,NUMSOU)
      WRITE (IUNIT,ERR=999) (SOUNAM(I),I=1,MIN(MAXSET,NUMSOU))
      WRITE (IUNIT,ERR=999) (USESOU(I),I=1,MAXMOL)
      WRITE (IUNIT,ERR=999) (USERSOU(I),I=1,MAXMOL)
      WRITE (IUNIT,ERR=999) (CUTFLG(I),I=1,NUMAAT)
      WRITE (IUNIT,ERR=999) (PSTFLG(I),I=1,NUMAAT)
      WRITE (IUNIT,ERR=999) ((BOUND_TO(I,J),I=1,8),J=1,NUMATF)



      WRITE (IUNIT,ERR=999) ((CHAINN(I,J),I=1,2),J=1,NUMAAT)
      WRITE (IUNIT,ERR=999) ((SPHRAD(I,J),I=1,4),J=1,NUMAAT)
      WRITE (IUNIT,ERR=999) (PNTAAS(I),I=1,NUMAAT)
      WRITE (IUNIT,ERR=999) (PNTAAC(I),I=1,NUMAAT)
      WRITE (IUNIT,ERR=999) (PNTAAE(I),I=1,NUMAAT)
      WRITE (IUNIT,ERR=999) (SOUPNT(I),I=1,NUMAAT)
      WRITE (IUNIT,ERR=999) (ONESA3(I),I=1,NUMAAT)
      WRITE (IUNIT,ERR=999) (NUMNAM(I),I=1,NUMAAT)
      WRITE (IUNIT,ERR=999) (CHANAM(I),I=1,NUMAAT)
      WRITE (IUNIT,ERR=999) (RESTYP(I),I=1,NUMAAT)
      WRITE (IUNIT,ERR=999) (ISSHIT(I),I=1,NUMAAT)
      WRITE (IUNIT,ERR=999) (CHOSTF(I),I=1,NUMAAT)
      WRITE (IUNIT,ERR=999) (NOBOND(I),I=1,NUMAAT)
      WRITE (IUNIT,ERR=999) (MODNMB(I),I=1,NUMAAT)



      WRITE (IUNIT,ERR=999) (ACCDON(I),I=1,NUMAAT)
      WRITE (IUNIT,ERR=999) (SUMACC(I),I=1,NUMAAT)
      WRITE (IUNIT,ERR=999) (PRPVAL(I),I=1,NUMAAT)
      WRITE (IUNIT,ERR=999) (LOCHST(I),I=1,NUMAAF)



      WRITE (IUNIT,ERR=999) (XCOORD(I),I=1,NUMATF)
      WRITE (IUNIT,ERR=999) (YCOORD(I),I=1,NUMATF)
      WRITE (IUNIT,ERR=999) (ZCOORD(I),I=1,NUMATF)
      WRITE (IUNIT,ERR=999) (XBFACT(I),I=1,NUMATF)
      WRITE (IUNIT,ERR=999) (ACCESS(I),I=1,NUMATF)
      WRITE (IUNIT,ERR=999) (WEIGHT(I),I=1,NUMATF)
      WRITE (IUNIT,ERR=999) (VDWRAD(I),I=1,NUMATF)
      WRITE (IUNIT,ERR=999) (ATTVAL(I),I=1,NUMATF)
      WRITE (IUNIT,ERR=999) (ATTVL2(I),I=1,NUMATF)
      WRITE (IUNIT,ERR=999) (PROTON(I),I=1,NUMATF)
      WRITE (IUNIT,ERR=999) (USEAT(I), I=1,NUMATF)
      WRITE (IUNIT,ERR=999) (ISATOK(I),I=1,NUMATF)
      WRITE (IUNIT,ERR=999) (ATCOLR(I),I=1,NUMATF)
      WRITE (IUNIT,ERR=999) (ONESAT(I),I=1,NUMATF)
      WRITE (IUNIT,ERR=999) (ORGNAM(I),I=1,NUMATF)
      WRITE (IUNIT,ERR=999) (NOBIAT(I),I=1,NUMATF)
      WRITE (IUNIT,ERR=999) (ATIAA (I),I=1,NUMATF)
      WRITE (IUNIT,ERR=999) (PINIAA(I),I=1,NUMATF)
      WRITE (IUNIT,ERR=999) (MENDLV(I),I=1,NUMATF)
      WRITE (IUNIT,ERR=999) (PDBNUM(I),I=1,NUMATF)



      WRITE (IUNIT,ERR=999) ALTUNT,USEALT
      WRITE (IUNIT,ERR=999) (ALTATM(I),I=1,NUMATF)
      WRITE (IUNIT,ERR=999) (ALTX(I),I=1,NUMATF)
      WRITE (IUNIT,ERR=999) (ALTY(I),I=1,NUMATF)
      WRITE (IUNIT,ERR=999) (ALTZ(I),I=1,NUMATF)
      WRITE (IUNIT,ERR=999) (ALTXBF(I),I=1,NUMATF)
      WRITE (IUNIT,ERR=999) (ALTWGT(I),I=1,NUMATF)
      WRITE (IUNIT,ERR=999) (ALALAT(I),I=1,NUMATF)
      WRITE (IUNIT,ERR=999) (HASALT(I),I=1,NUMAAT)



      WRITE (IUNIT,ERR=999) WIFPAR
      WRITE (IUNIT,ERR=999) FILNMS
      WRITE (IUNIT,ERR=999) FILDIR
      WRITE (IUNIT,ERR=999) MENULV
      WRITE (IUNIT,ERR=999) HISTOR
      WRITE (IUNIT,ERR=999) HISROW
      WRITE (IUNIT,ERR=999) CYSCYS,FRCCYS
      WRITE (IUNIT,ERR=999) CELDIM,SYMSCL,SYMINV,SYMTRN,SYMICL,SYMCEL,
     + SPCNAM
      GOTO 998



  999 CONTINUE
      CALL GVSEIW ('MOL330')



  998 CONTINUE
      IF (IUNIT.NE.0) CALL GVSCLF (IUNIT)


      RETURN
      END
      SUBROUTINE MOL330A (INNUMB)

















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INCLUDE       'ENVIRO.INC'
      INCLUDE       'LABELS.INC'
      INCLUDE       'IRIGRA.INC'
      INCLUDE       'SOLIDS.INC'
      INCLUDE       'JUNIOR.INC'
      INCLUDE       'HSPINC.INC'
      INCLUDE       'HSTINC.INC'
      INCLUDE       'SYMINC.INC'
      INCLUDE       'MOLITM.INC'
      INCLUDE       'AUDOCK.INC'
      INCLUDE       'ESPACE.INC'
      INTEGER       I, J, INNUMB, IERR, IUNIT
      LOGICAL       GRAPON







      IF (.NOT.GRAPON()) GOTO 998
      IF (NUMAAT.LE.0) THEN
         CALL GVSTTE ('?NEWE439')
         GOTO 998
      END IF



      CALL MOL330B (IUNIT,INNUMB,'NEW',IERR)
      IF (IERR.NE.0) GOTO 998




      WRITE (IUNIT,ERR=999) NUMSOU,NUMRNG,NUMAAF,NUMAAT,NUMCYS,NUMCOF,
     + NUMATF,HSTDON,LOGGER,AUTOFL



      WRITE (IUNIT,ERR=999) ((SOUADM(I,J),I=1,20),J=1,NUMSOU)
      WRITE (IUNIT,ERR=999) (SOUNAM(I),I=1,MIN(MAXSET,NUMSOU))
      WRITE (IUNIT,ERR=999) (USESOU(I),I=1,MAXMOL)
      WRITE (IUNIT,ERR=999) (USERSOU(I),I=1,MAXMOL)
      WRITE (IUNIT,ERR=999) (CUTFLG(I),I=1,NUMAAT)
      WRITE (IUNIT,ERR=999) (PSTFLG(I),I=1,NUMAAT)
      WRITE (IUNIT,ERR=999) ((BOUND_TO(I,J),I=1,8),J=1,NUMATF)



      WRITE (IUNIT,ERR=999) ((CHAINN(I,J),I=1,2),J=1,NUMAAT)
      WRITE (IUNIT,ERR=999) ((SPHRAD(I,J),I=1,4),J=1,NUMAAT)
      WRITE (IUNIT,ERR=999) (PNTAAS(I),I=1,NUMAAT)
      WRITE (IUNIT,ERR=999) (PNTAAC(I),I=1,NUMAAT)
      WRITE (IUNIT,ERR=999) (PNTAAE(I),I=1,NUMAAT)
      WRITE (IUNIT,ERR=999) (SOUPNT(I),I=1,NUMAAT)
      WRITE (IUNIT,ERR=999) (ONESA3(I),I=1,NUMAAT)
      WRITE (IUNIT,ERR=999) (NUMNAM(I),I=1,NUMAAT)
      WRITE (IUNIT,ERR=999) (CHANAM(I),I=1,NUMAAT)
      WRITE (IUNIT,ERR=999) (RESTYP(I),I=1,NUMAAT)
      WRITE (IUNIT,ERR=999) (ISSHIT(I),I=1,NUMAAT)
      WRITE (IUNIT,ERR=999) (CHOSTF(I),I=1,NUMAAT)
      WRITE (IUNIT,ERR=999) (NOBOND(I),I=1,NUMAAT)
      WRITE (IUNIT,ERR=999) (MODNMB(I),I=1,NUMAAT)



      WRITE (IUNIT,ERR=999) (ACCDON(I),I=1,NUMAAT)
      WRITE (IUNIT,ERR=999) (SUMACC(I),I=1,NUMAAT)
      WRITE (IUNIT,ERR=999) (PRPVAL(I),I=1,NUMAAT)
      WRITE (IUNIT,ERR=999) (LOCHST(I),I=1,NUMAAF)



      WRITE (IUNIT,ERR=999) (XCOORD(I),I=1,NUMATF)
      WRITE (IUNIT,ERR=999) (YCOORD(I),I=1,NUMATF)
      WRITE (IUNIT,ERR=999) (ZCOORD(I),I=1,NUMATF)
      WRITE (IUNIT,ERR=999) (XBFACT(I),I=1,NUMATF)
      WRITE (IUNIT,ERR=999) (ACCESS(I),I=1,NUMATF)
      WRITE (IUNIT,ERR=999) (WEIGHT(I),I=1,NUMATF)
      WRITE (IUNIT,ERR=999) (VDWRAD(I),I=1,NUMATF)
      WRITE (IUNIT,ERR=999) (ATTVAL(I),I=1,NUMATF)
      WRITE (IUNIT,ERR=999) (ATTVL2(I),I=1,NUMATF)
      WRITE (IUNIT,ERR=999) (PROTON(I),I=1,NUMATF)
      WRITE (IUNIT,ERR=999) (USEAT(I), I=1,NUMATF)
      WRITE (IUNIT,ERR=999) (ISATOK(I),I=1,NUMATF)
      WRITE (IUNIT,ERR=999) (ATCOLR(I),I=1,NUMATF)
      WRITE (IUNIT,ERR=999) (ONESAT(I),I=1,NUMATF)
      WRITE (IUNIT,ERR=999) (ORGNAM(I),I=1,NUMATF)
      WRITE (IUNIT,ERR=999) (NOBIAT(I),I=1,NUMATF)
      WRITE (IUNIT,ERR=999) (ATIAA (I),I=1,NUMATF)
      WRITE (IUNIT,ERR=999) (PINIAA(I),I=1,NUMATF)
      WRITE (IUNIT,ERR=999) (MENDLV(I),I=1,NUMATF)
      WRITE (IUNIT,ERR=999) (PDBNUM(I),I=1,NUMATF)



      WRITE (IUNIT,ERR=999) ALTUNT,USEALT
      WRITE (IUNIT,ERR=999) (ALTATM(I),I=1,NUMATF)
      WRITE (IUNIT,ERR=999) (ALTX(I),I=1,NUMATF)
      WRITE (IUNIT,ERR=999) (ALTY(I),I=1,NUMATF)
      WRITE (IUNIT,ERR=999) (ALTZ(I),I=1,NUMATF)
      WRITE (IUNIT,ERR=999) (ALTXBF(I),I=1,NUMATF)
      WRITE (IUNIT,ERR=999) (ALTWGT(I),I=1,NUMATF)
      WRITE (IUNIT,ERR=999) (ALALAT(I),I=1,NUMATF)
      WRITE (IUNIT,ERR=999) (HASALT(I),I=1,NUMAAT)



      WRITE (IUNIT,ERR=999) WIFPAR
      WRITE (IUNIT,ERR=999) FILNMS
      WRITE (IUNIT,ERR=999) FILDIR
      WRITE (IUNIT,ERR=999) MENULV
      WRITE (IUNIT,ERR=999) HISTOR
      WRITE (IUNIT,ERR=999) HISROW
      WRITE (IUNIT,ERR=999) CYSCYS,FRCCYS
      WRITE (IUNIT,ERR=999) CELDIM,SYMSCL,SYMINV,SYMTRN,SYMICL,SYMCEL,
     + SPCNAM



      WRITE (IUNIT,ERR=999) LABTXT,LABTYT,LABTZT,LABTRT
      WRITE (IUNIT,ERR=999) LABTXC,LABTYC,LABTZM
      WRITE (IUNIT,ERR=999) GPCRLAB,GPCRCOL,GPCRXYZ,GPCRUSE
      WRITE (IUNIT,ERR=999) XIDA,YIDA,ZIDA,XIRA
      WRITE (IUNIT,ERR=999) CUPDLST, MENIRI, ISOLID
      WRITE (IUNIT,ERR=999) IRSTAT,IRROCK,IRSTER,BUTTONS
      WRITE (IUNIT,ERR=999) ROCKANGLE,ROCKSPEED
      WRITE (IUNIT,ERR=999) DX,DY,DZ, TX,TY,TZ, SLABIR,SCVAL
      WRITE (IUNIT,ERR=999) CENTRX, CENTRY, CENTRZ
      WRITE (IUNIT,ERR=999) PCMAT, TPTXLN, MITEXT, SAVM1234, M1DONE
      WRITE (IUNIT,ERR=999) JUNIOR,(JUNIAA(I),I=1,NUMAAT)
      WRITE (IUNIT,ERR=999) (PREVCOL(I),I=1,NUMATF)
      GOTO 998



  999 CONTINUE
      CALL GVSTTE ('?NEWE441')



  998 CONTINUE
      CALL GVSCLF (IUNIT)


      RETURN
      END
      SUBROUTINE MOL331 (INNUMB)

















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INCLUDE       'ENVIRO.INC'
      INCLUDE       'IRIGRA.INC'
      INCLUDE       'HSPINC.INC'
      INCLUDE       'HSTINC.INC'
      INCLUDE       'SYMINC.INC'
      INCLUDE       'AUDOCK.INC'
      INCLUDE       'ESPACE.INC'
      INTEGER       I, J, INNUMB, IERR, IUNIT







      CALL MOL330B (IUNIT,INNUMB,'OLD',IERR)
      IF (IERR.NE.0) GOTO 998




      READ (IUNIT,ERR=999) NUMSOU,NUMRNG,NUMAAF,NUMAAT,NUMCYS,NUMCOF,
     + NUMATF,HSTDON,LOGGER,AUTOFL



      READ (IUNIT,ERR=999) ((SOUADM(I,J),I=1,20),J=1,NUMSOU)
      READ (IUNIT,ERR=999) (SOUNAM(I),I=1,MIN(MAXSET,NUMSOU))
      READ (IUNIT,ERR=999) (USESOU(I),I=1,MAXMOL)
      READ (IUNIT,ERR=999) (USERSOU(I),I=1,MAXMOL)
      READ (IUNIT,ERR=999) (CUTFLG(I),I=1,NUMAAT)
      READ (IUNIT,ERR=999) (PSTFLG(I),I=1,NUMAAT)
      READ (IUNIT,ERR=999) ((BOUND_TO(I,J),I=1,8),J=1,NUMATF)



      READ (IUNIT,ERR=999) ((CHAINN(I,J),I=1,2),J=1,NUMAAT)
      READ (IUNIT,ERR=999) ((SPHRAD(I,J),I=1,4),J=1,NUMAAT)
      READ (IUNIT,ERR=999) (PNTAAS(I),I=1,NUMAAT)
      READ (IUNIT,ERR=999) (PNTAAC(I),I=1,NUMAAT)
      READ (IUNIT,ERR=999) (PNTAAE(I),I=1,NUMAAT)
      READ (IUNIT,ERR=999) (SOUPNT(I),I=1,NUMAAT)
      READ (IUNIT,ERR=999) (ONESA3(I),I=1,NUMAAT)
      READ (IUNIT,ERR=999) (NUMNAM(I),I=1,NUMAAT)
      READ (IUNIT,ERR=999) (CHANAM(I),I=1,NUMAAT)
      READ (IUNIT,ERR=999) (RESTYP(I),I=1,NUMAAT)
      READ (IUNIT,ERR=999) (ISSHIT(I),I=1,NUMAAT)
      READ (IUNIT,ERR=999) (CHOSTF(I),I=1,NUMAAT)
      READ (IUNIT,ERR=999) (NOBOND(I),I=1,NUMAAT)
      READ (IUNIT,ERR=999) (MODNMB(I),I=1,NUMAAT)



      READ (IUNIT,ERR=999) (ACCDON(I),I=1,NUMAAT)
      READ (IUNIT,ERR=999) (SUMACC(I),I=1,NUMAAT)
      READ (IUNIT,ERR=999) (PRPVAL(I),I=1,NUMAAT)
      READ (IUNIT,ERR=999) (LOCHST(I),I=1,NUMAAF)



      READ (IUNIT,ERR=999) (XCOORD(I),I=1,NUMATF)
      READ (IUNIT,ERR=999) (YCOORD(I),I=1,NUMATF)
      READ (IUNIT,ERR=999) (ZCOORD(I),I=1,NUMATF)
      READ (IUNIT,ERR=999) (XBFACT(I),I=1,NUMATF)
      READ (IUNIT,ERR=999) (ACCESS(I),I=1,NUMATF)
      READ (IUNIT,ERR=999) (WEIGHT(I),I=1,NUMATF)
      READ (IUNIT,ERR=999) (VDWRAD(I),I=1,NUMATF)
      READ (IUNIT,ERR=999) (ATTVAL(I),I=1,NUMATF)
      READ (IUNIT,ERR=999) (ATTVL2(I),I=1,NUMATF)
      READ (IUNIT,ERR=999) (PROTON(I),I=1,NUMATF)
      READ (IUNIT,ERR=999) (USEAT(I), I=1,NUMATF)
      READ (IUNIT,ERR=999) (ISATOK(I),I=1,NUMATF)
      READ (IUNIT,ERR=999) (ATCOLR(I),I=1,NUMATF)
      READ (IUNIT,ERR=999) (ONESAT(I),I=1,NUMATF)
      READ (IUNIT,ERR=999) (ORGNAM(I),I=1,NUMATF)
      READ (IUNIT,ERR=999) (NOBIAT(I),I=1,NUMATF)
      READ (IUNIT,ERR=999) (ATIAA (I),I=1,NUMATF)
      READ (IUNIT,ERR=999) (PINIAA(I),I=1,NUMATF)
      READ (IUNIT,ERR=999) (MENDLV(I),I=1,NUMATF)
      READ (IUNIT,ERR=999) (PDBNUM(I),I=1,NUMATF)



      READ (IUNIT,ERR=999) ALTUNT,USEALT
      READ (IUNIT,ERR=999) (ALTATM(I),I=1,NUMATF)
      READ (IUNIT,ERR=999) (ALTX(I),I=1,NUMATF)
      READ (IUNIT,ERR=999) (ALTY(I),I=1,NUMATF)
      READ (IUNIT,ERR=999) (ALTZ(I),I=1,NUMATF)
      READ (IUNIT,ERR=999) (ALTXBF(I),I=1,NUMATF)
      READ (IUNIT,ERR=999) (ALTWGT(I),I=1,NUMATF)
      READ (IUNIT,ERR=999) (ALALAT(I),I=1,NUMATF)
      READ (IUNIT,ERR=999) (HASALT(I),I=1,NUMAAT)



      READ (IUNIT,ERR=999) WIFPAR
      READ (IUNIT,ERR=999) FILNMS
      READ (IUNIT,ERR=999) FILDIR
      READ (IUNIT,ERR=999) MENULV
      READ (IUNIT,ERR=999) HISTOR
      READ (IUNIT,ERR=999) HISROW
      READ (IUNIT,ERR=999) CYSCYS,FRCCYS
      READ (IUNIT,ERR=999) CELDIM,SYMSCL,SYMINV,SYMTRN,SYMICL,SYMCEL,
     + SPCNAM



      CALL MOL200
      CALL MOL199 (1,NUMAAF)



      IF (INNUMB.LE.0) THEN
         CALL GVSSTX (TPTXLN,'?M0936')
         CALL MOL200
         CALL SHOSOU
         CALL GVSCTB (TPTXLN,LENTPT)
      END IF



      CALL GVSSTX (LINE,'?M0937')
      CALL GVSWIL (LINE(71:80),WIFPAR(525),IERR)
      IF (IERR.EQ.0) CALL SETHIS (LINE)
      GOTO 998



  999 CONTINUE
      CALL GVSTTE ('?M0971')



  998 CONTINUE
      CALL GVSCLF (IUNIT)


      RETURN
      END
      SUBROUTINE MOL331A (INNUMB)

















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INCLUDE       'ENVIRO.INC'
      INCLUDE       'LABELS.INC'
      INCLUDE       'IRIGRA.INC'
      INCLUDE       'SOLIDS.INC'
      INCLUDE       'JUNIOR.INC'
      INCLUDE       'HSPINC.INC'
      INCLUDE       'HSTINC.INC'
      INCLUDE       'SYMINC.INC'
      INCLUDE       'MOLITM.INC'
      INCLUDE       'AUDOCK.INC'
      INCLUDE       'ESPACE.INC'
      INTEGER       IERR, I, J, INNUMB, IUNIT,
     +              GVFLEN
      LOGICAL       GRAPON







      IF (.NOT.GRAPON()) GOTO 998



      CALL MOL330B (IUNIT,INNUMB,'OLD',IERR)
      IF (IERR.NE.0) GOTO 998




      READ (IUNIT,ERR=999) NUMSOU,NUMRNG,NUMAAF,NUMAAT,NUMCYS,NUMCOF,
     + NUMATF,HSTDON,LOGGER,AUTOFL



      READ (IUNIT,ERR=999) ((SOUADM(I,J),I=1,20),J=1,NUMSOU)
      READ (IUNIT,ERR=999) (SOUNAM(I),I=1,MIN(MAXSET,NUMSOU))
      READ (IUNIT,ERR=999) (USESOU(I),I=1,MAXMOL)
      READ (IUNIT,ERR=999) (USERSOU(I),I=1,MAXMOL)
      READ (IUNIT,ERR=999) (CUTFLG(I),I=1,NUMAAT)
      READ (IUNIT,ERR=999) (PSTFLG(I),I=1,NUMAAT)
      READ (IUNIT,ERR=999) ((BOUND_TO(I,J),I=1,8),J=1,NUMATF)



      READ (IUNIT,ERR=999) ((CHAINN(I,J),I=1,2),J=1,NUMAAT)
      READ (IUNIT,ERR=999) ((SPHRAD(I,J),I=1,4),J=1,NUMAAT)
      READ (IUNIT,ERR=999) (PNTAAS(I),I=1,NUMAAT)
      READ (IUNIT,ERR=999) (PNTAAC(I),I=1,NUMAAT)
      READ (IUNIT,ERR=999) (PNTAAE(I),I=1,NUMAAT)
      READ (IUNIT,ERR=999) (SOUPNT(I),I=1,NUMAAT)
      READ (IUNIT,ERR=999) (ONESA3(I),I=1,NUMAAT)
      READ (IUNIT,ERR=999) (NUMNAM(I),I=1,NUMAAT)
      READ (IUNIT,ERR=999) (CHANAM(I),I=1,NUMAAT)
      READ (IUNIT,ERR=999) (RESTYP(I),I=1,NUMAAT)
      READ (IUNIT,ERR=999) (ISSHIT(I),I=1,NUMAAT)
      READ (IUNIT,ERR=999) (CHOSTF(I),I=1,NUMAAT)
      READ (IUNIT,ERR=999) (NOBOND(I),I=1,NUMAAT)
      READ (IUNIT,ERR=999) (MODNMB(I),I=1,NUMAAT)



      READ (IUNIT,ERR=999) (ACCDON(I),I=1,NUMAAT)
      READ (IUNIT,ERR=999) (SUMACC(I),I=1,NUMAAT)
      READ (IUNIT,ERR=999) (PRPVAL(I),I=1,NUMAAT)
      READ (IUNIT,ERR=999) (LOCHST(I),I=1,NUMAAF)



      READ (IUNIT,ERR=999) (XCOORD(I),I=1,NUMATF)
      READ (IUNIT,ERR=999) (YCOORD(I),I=1,NUMATF)
      READ (IUNIT,ERR=999) (ZCOORD(I),I=1,NUMATF)
      READ (IUNIT,ERR=999) (XBFACT(I),I=1,NUMATF)
      READ (IUNIT,ERR=999) (ACCESS(I),I=1,NUMATF)
      READ (IUNIT,ERR=999) (WEIGHT(I),I=1,NUMATF)
      READ (IUNIT,ERR=999) (VDWRAD(I),I=1,NUMATF)
      READ (IUNIT,ERR=999) (ATTVAL(I),I=1,NUMATF)
      READ (IUNIT,ERR=999) (ATTVL2(I),I=1,NUMATF)
      READ (IUNIT,ERR=999) (PROTON(I),I=1,NUMATF)
      READ (IUNIT,ERR=999) (USEAT(I), I=1,NUMATF)
      READ (IUNIT,ERR=999) (ISATOK(I),I=1,NUMATF)
      READ (IUNIT,ERR=999) (ATCOLR(I),I=1,NUMATF)
      READ (IUNIT,ERR=999) (ONESAT(I),I=1,NUMATF)
      READ (IUNIT,ERR=999) (ORGNAM(I),I=1,NUMATF)
      READ (IUNIT,ERR=999) (NOBIAT(I),I=1,NUMATF)
      READ (IUNIT,ERR=999) (ATIAA (I),I=1,NUMATF)
      READ (IUNIT,ERR=999) (PINIAA(I),I=1,NUMATF)
      READ (IUNIT,ERR=999) (MENDLV(I),I=1,NUMATF)
      READ (IUNIT,ERR=999) (PDBNUM(I),I=1,NUMATF)



      READ (IUNIT,ERR=999) ALTUNT,USEALT
      READ (IUNIT,ERR=999) (ALTATM(I),I=1,NUMATF)
      READ (IUNIT,ERR=999) (ALTX(I),I=1,NUMATF)
      READ (IUNIT,ERR=999) (ALTY(I),I=1,NUMATF)
      READ (IUNIT,ERR=999) (ALTZ(I),I=1,NUMATF)
      READ (IUNIT,ERR=999) (ALTXBF(I),I=1,NUMATF)
      READ (IUNIT,ERR=999) (ALTWGT(I),I=1,NUMATF)
      READ (IUNIT,ERR=999) (ALALAT(I),I=1,NUMATF)
      READ (IUNIT,ERR=999) (HASALT(I),I=1,NUMAAT)



      READ (IUNIT,ERR=999) WIFPAR
      READ (IUNIT,ERR=999) FILNMS
      READ (IUNIT,ERR=999) FILDIR
      READ (IUNIT,ERR=999) MENULV
      READ (IUNIT,ERR=999) HISTOR
      READ (IUNIT,ERR=999) HISROW
      READ (IUNIT,ERR=999) CYSCYS,FRCCYS
      READ (IUNIT,ERR=999) CELDIM,SYMSCL,SYMINV,SYMTRN,SYMICL,SYMCEL,
     + SPCNAM



      READ (IUNIT,ERR=999) LABTXT,LABTYT,LABTZT,LABTRT
      READ (IUNIT,ERR=999) LABTXC,LABTYC,LABTZM
      READ (IUNIT,ERR=999) GPCRLAB,GPCRCOL,GPCRXYZ,GPCRUSE
      READ (IUNIT,ERR=999) XIDA,YIDA,ZIDA,XIRA
      READ (IUNIT,ERR=999) CUPDLST, MENIRI, ISOLID
      READ (IUNIT,ERR=999) IRSTAT,IRROCK,IRSTER,BUTTONS
      READ (IUNIT,ERR=999) ROCKANGLE,ROCKSPEED
      READ (IUNIT,ERR=999) DX,DY,DZ, TX,TY,TZ, SLABIR,SCVAL
      READ (IUNIT,ERR=999) CENTRX, CENTRY, CENTRZ
      READ (IUNIT,ERR=999) PCMAT, TPTXLN, MITEXT, SAVM1234, M1DONE
      READ (IUNIT,ERR=999) JUNIOR,(JUNIAA(I),I=1,NUMAAT)
      READ (IUNIT,ERR=999) (PREVCOL(I),I=1,NUMATF)







   40 CONTINUE
      IF (WIFPAR(1052).NE.0) THEN
         CALL MOL330D
         CALL USEDD1
      END IF
      CALL MOL200
      CALL MOL199 (1,NUMAAF)



      CALL GVSIT0 (PREVSHOW,MAXAA)
      CALL GVSSTX (TPTXLN,'?M0938')
      CALL SHOSOU
      CALL GVSCTB (TPTXLN,LENTPT)
      CALL JUN001
      CALL IRI000
      CALL IRI000



      CALL GVSFMT ('?FMT169')
      CALL GVSCTB (LINE,80)
      WRITE (LINE,FMT,ERR=998) WIFPAR(525)
      CALL SETHIS (LINE)
      GOTO 998



  999 CONTINUE
      CALL GVSTTE ('?NEWE444')



  998 CONTINUE
      CALL GVSCLF (IUNIT)


      RETURN
      END
      SUBROUTINE MOL330B (IUNIT,INNUMB,STATUS,IERR)

















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INTEGER       INNUMB, I, GVFFFI, IFIL, IERR, ITEMP, IUNIT
      LOGICAL       GVFISF, GVFYON, GVFFOP
      CHARACTER*3   STATUS
      CHARACTER*80  LOCLIN







      IERR=0
      IF (INNUMB.NE.0) THEN
         IFIL=INNUMB
      ELSE
         CALL MOL330C (IFIL)
         IF (STATUS.EQ.'NEW') IFIL=IFIL+1
      END IF



      IF (INNUMB.EQ.0) THEN
         CALL I1PROMPT ('?NEWP138',IFIL)
         I=GVFFFI(1,ITEMP)
         IF (I.EQ.1) THEN
            IF (ITEMP.EQ.0) THEN
               IERR=1
               GOTO 998
            END IF
            IFIL=ITEMP
         END IF
      ELSE
         IFIL=INNUMB
      END IF



      CALL GVSFMT ('?FMT168')
      CALL GVSCTB (LOCLIN,80)
      WRITE (LOCLIN,FMT,ERR=999) IFIL+1000
      CALL GVSSHL (LOCLIN)
      IUNIT=IFIL



      IF (STATUS.EQ.'OLD') THEN



         IF (.NOT.GVFISF(LOCLIN)) THEN
            CALL GVSTT6 ('?NEWT507')
            CALL GVSTT6 (LOCLIN)
            IERR=1
            GOTO 998
         END IF



         CALL GVSCLF (IFIL)
         CALL GVSOUF (LOCLIN,IFIL,'OLD')
         IF (.NOT.GVFFOP(IFIL)) THEN
            CALL GVSTTE ('?NEWE442')
            IERR=1
            GOTO 998
         END IF



      ELSE IF (STATUS.EQ.'NEW') THEN



         IF (.NOT.DEFALL) THEN
            IF (WIFPAR(1020).EQ.0) THEN
               IF (GVFISF(LOCLIN)) THEN
                  CALL GVSTT6 ('?NEWT505')
                  IF (.NOT.GVFYON('?WALB14',' ')) THEN
                     IERR=1
                     GOTO 998
                  END IF
               END IF
            END IF
         END IF



         CALL GVSDEL (LOCLIN)
         CALL GVSCLF (IFIL)
         CALL GVSOUF (LOCLIN,IFIL,'NEW')
         IF (.NOT.GVFFOP(IFIL)) THEN
            CALL GVSTTE ('?NEWE438')
            GOTO 998
         END IF
      ELSE
         IERR=1
      END IF
      GOTO 998



  999 CONTINUE
      CALL GVSEIW ('MOL330B')
      IERR=1



  998 CONTINUE
      WIFPAR(525)=IFIL
      IF (IERR.NE.0.AND.IFIL.NE.0) CALL GVSCLF (IFIL)


      RETURN
      END   
      SUBROUTINE MOL330C (IFIL)

















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INTEGER       IFIL, I
      LOGICAL       GVFISF







      IFIL=0
      CALL GVSFMT ('?FMT168')



      DO 100 I=1,1000



         CALL GVSCTB (LINE,80)
         WRITE (LINE,FMT,ERR=999) I+1000
         CALL GVSSHL (LINE)



         IF (.NOT.GVFISF(LINE)) THEN
            IFIL=I-1
            GOTO 998
         END IF
 100  CONTINUE
      GOTO 998



  999 CONTINUE
      CALL GVSEIW ('MOL330C')



  998 CONTINUE


      RETURN
      END   
      SUBROUTINE MOL330D

















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INTEGER       ISOUP







      DO 10 ISOUP=1,NUMSOU
         IF (SOUADM(5,ISOUP).EQ.6) THEN
            SOUADM(5,ISOUP)=2
            RESTYP(SOUADM(1,ISOUP))=0
         END IF
 10   CONTINUE





      RETURN
      END   
