



      SUBROUTINE MOL350 (ISTART)


















      IMPLICIT      NONE 
      INCLUDE       'BIGINC.INC'
      INCLUDE       'CHIANG.INC'
      INCLUDE       'HBONDS.INC'
      INCLUDE       'HGRINC.INC'
      INTEGER       IAATYP, NUMIAT, I, ICON, I1, I2, ITOR, ICHI, 
     +              IEND, I3, IAT, ISTART, NEXT, IGRP, JAT, IPAR,
     +              INNA
      LOGICAL       TXTPROTON, FIRST
      CHARACTER*1   CHAR1
      CHARACTER*5   ATNAM(MAXTAT)
      CHARACTER*26  CHRHBO(7),CHAR26
      SAVE          CHRHBO
      DATA CHRHBO  /'Backbone nitrogen         ',
     +              'Arg Ne or Trp side chain N',
     +              'Asn side chain NH2        ',
     +              'Ser side chain Og         ',
     +              'Lysine side chain N       ',
     +              'Histidine side chain N    ',
     +              'Oxygen in Asp or Glu      '/







      IF (ISTART.LE.0.OR.ISTART.GT.WIFPAR(276)) THEN
         CALL GVSTTI ('?M2796',ISTART)
         GOTO 998
      END IF



      DO 200 IAATYP=ISTART,WIFPAR(276)



         CALL GVSTTI ('?M3095',IAATYP)
         CALL GVSTTI ('?M3096',ATPRAA(IAATYP))
         CALL GVSTTI ('?M3097',NCPRAA(IAATYP))



         NUMIAT=ATPRAA(IAATYP)
         CALL GVSCTB (LINE,80)
         CALL GVSNL6 (1)
         CALL GVSFMT ('?FMT313')
         WRITE (LINE,FMT,ERR=200) AANAME(IAATYP),NUMIAT
         CALL GVSRDB (LINE)
         CALL GVSBOX (LINE)
         CALL GVSNL6 (1)



         CALL GVSTTI ('?M3095',IAATYP)
         CALL GVSTTI ('?M3096',NUMIAT)



         CALL GVSTT6 ('?M1307')
         CALL GVSCTB (LINE250,250)
         CALL GVSFMT ('?FMT513')
         WRITE (LINE250,FMT,ERR=200) (MUTROW4(I,IAATYP),
     +    I=1,MIN(50,ATPRAA(IAATYP)))
         CALL GVSTT6 (LINE250)
         CALL GVSNL6 (1)
         DO 5 INNA=1,4
            CALL GVSCTB (LINE250,250)
            WRITE (LINE250,FMT,ERR=200) (MUTSTO4(I,IAATYP,INNA),
     +       I=1,MIN(50,ATPRAA(IAATYP)))
            CALL GVSTT6 (LINE250)
 5       CONTINUE
         CALL GVSFMT ('?FMT930')
         DO 10 IAT=1,ATPRAA(IAATYP)
            CHAR1=' '
            IF (HBOPOS(IAATYP,IAT)) THEN
               IF (HBOPAR(IAATYP,IAT).EQ.1) THEN
                  CHAR1='d'
               ELSE IF (HBOPAR(IAATYP,IAT).EQ.0) THEN
                  CHAR1='B'
               ELSE 
                  CHAR1='A'
               END IF
            END IF
            CALL GVSCTB (CHAR26,26)
            IF (HBOTYP(IAATYP,IAT).GT.0) CALL GVSSTX (CHAR26,
     +       CHRHBO(HBOTYP(IAATYP,IAT)))
            CALL GVSCTB (BIGLIN,132)
            WRITE (BIGLIN,FMT,ERR=200) MUTROW4(IAT,IAATYP),
     +       (STDCRD(I,IAT,IAATYP),I=1,3),HBOPOS(IAATYP,IAT),
     +       CHAR1,CHAR26,(MUTSTO4(IAT,IAATYP,IPAR),IPAR=1,5)
            CALL GVSTT6 (BIGLIN)
 10      CONTINUE
         CALL GVSNL6 (1)



         CALL GVSTTI ('?M1308',NCPRAA(IAATYP))
         CALL GVSFMT ('?FMT514')
         DO 20 ICON=1,MAXTAT
            IF (MUTCON(1,ICON,IAATYP).NE.0) THEN
               CALL GVSCTB (LINE,80)
               I1=MUTCON(1,ICON,IAATYP)
               I2=MUTCON(2,ICON,IAATYP)
               WRITE (LINE,FMT,ERR=20) ICON,I1,I2,MUTROW4(I1,IAATYP),
     +          MUTROW4(I2,IAATYP),DSTCON(ICON,IAATYP),
     +          DSTSIG(ICON,IAATYP)
               CALL GVSTT6 (LINE)
            END IF
   20    CONTINUE
         CALL GVSNL6 (1)



         CALL GVSTT6 ('?M1309')
         CALL GVSFMT ('?FMT517')
         DO 21 I=1,MAXANG
            IF (ANGCON(1,I,IAATYP).EQ.0) GOTO 21
            I1=ANGCON(1,I,IAATYP)
            I2=ANGCON(2,I,IAATYP)
            I3=ANGCON(3,I,IAATYP)
            WRITE (6,FMT,ERR=999) MUTROW4(I1,IAATYP),MUTROW4(I2,IAATYP),
     +       MUTROW4(I3,IAATYP),ANGDEF(I,IAATYP),ANGSIG(I,IAATYP)
   21    CONTINUE
         CALL GVSNL6 (1)



         CALL GVSTT6 ('?M1310')
         DO 30 ITOR=1,MAXTOR
            IF (CHICON(1,ITOR,IAATYP).NE.0) THEN
               CALL GVSCTB (LINE,80)
               DO 25 ICHI=1,4
                  ATNAM(ICHI)=MUTROW4(CHICON(ICHI,ITOR,IAATYP),
     +             IAATYP)
   25          CONTINUE
               CALL GVSFMT ('?FMT516')
               WRITE (LINE,FMT,ERR=30) (ATNAM(I),I=1,4)
               CALL GVSTT6 (LINE)
            END IF
   30    CONTINUE
         CALL GVSNL6 (1)



         CALL GVSTT6 ('?M1311')
         DO 60 ITOR=1,MAXTOR
            IEND=0
            IF (TORCON(1,ITOR,IAATYP).EQ.0) GOTO 60
            CALL GVSCTB (BIGLIN,132)
            DO 40 ICHI=1,MAXTAT
               IF (TORCON(ICHI,ITOR,IAATYP).NE.0) IEND=ICHI
 40         CONTINUE
            CALL GVSSTX (BIGLIN(1:5),MUTROW4(TORCON(1,ITOR,IAATYP),
     +       IAATYP))
            CALL GVSSTX (BIGLIN(7:11),MUTROW4(TORCON(2,ITOR,IAATYP),
     +       IAATYP))
            CALL GVSSTX (BIGLIN(13:15),'-->')
            DO 50 ICHI=3,IEND
               CALL GVSSTX (BIGLIN(6*ICHI+2:6*ICHI+6),
     +          MUTROW4(TORCON(ICHI,ITOR,IAATYP),IAATYP))
   50       CONTINUE
            CALL GVSTT6 (BIGLIN)
   60    CONTINUE
         CALL GVSNL6 (1)



         CALL GVSTT6 ('?M1312')
         CALL GVSFMT ('?FMT518')
         DO 65 IAT=1,ATPRAA(IAATYP)
            CALL GVSCTB (BIGLIN,132)
            WRITE (BIGLIN,FMT,ERR=65) MUTROW4(IAT,IAATYP),BOND13(1,IAT,
     +       IAATYP),(MUTROW4(BOND13(I,IAT,IAATYP),IAATYP),I=2,
     +       BOND13(1,IAT,IAATYP))
            CALL GVSTT6 (BIGLIN)
 65      CONTINUE
         CALL GVSNL6 (1)



         CALL GVSTT6 ('?M2839')
         IF (HGRAAN(IAATYP).NE.0) THEN
            DO 80 IGRP=1,HGRAAN(IAATYP)
               CALL GVSTTI ('?M2841',IGRP)
               CALL GVSCTB (BIGLIN,132)
               NEXT=1
               DO 70 IAT=1,ATPRAA(IAATYP)
                  IF (HGRATI(IAATYP,IAT).EQ.IGRP) THEN
                     CALL GVSSTX (BIGLIN(NEXT:NEXT+4),
     +                MUTROW4(IAT,IAATYP))
                     NEXT=NEXT+6
                  END IF
 70            CONTINUE
               CALL GVSTT6 (BIGLIN)
 80         CONTINUE
         ELSE
            CALL GVSTT6 ('?M2840')
         END IF



         IF (WIFPAR(84).NE.0) THEN
            FIRST=.TRUE.
            DO 110 IAT=1,ATPRAA(IAATYP)
               IF (.NOT.TXTPROTON(MUTROW4(IAT,IAATYP),
     +          MUTROW4(IAT,IAATYP)(1:2))) GOTO 110
               DO 100 JAT=1,ATPRAA(IAATYP)
                  DO 90 ICON=1,MAXTAT
                     IF (MUTCON(1,ICON,IAATYP).EQ.0) GOTO 90
                     IF ((MUTCON(1,ICON,IAATYP).EQ.IAT.AND.
     +                    MUTCON(2,ICON,IAATYP).EQ.JAT).OR.
     +                   (MUTCON(2,ICON,IAATYP).EQ.IAT.AND.
     +                    MUTCON(1,ICON,IAATYP).EQ.JAT)) THEN
                        IF (HGRATI(IAATYP,JAT).NE.0) THEN
                           IF (FIRST) THEN
                              FIRST=.FALSE.
                              CALL GVSTT6 ('?M2842')
                           END IF
                           CALL GVSTT6 (MUTROW4(IAT,IAATYP))
                        END IF
                     END IF
 90               CONTINUE
 100           CONTINUE
 110        CONTINUE
         END IF   



         CALL GVSNL6 (1)
         CALL GVSFMT ('?FMT313')
         CALL GVSCTB (LINE,80)
         WRITE (LINE,FMT,ERR=200) AANAME(IAATYP),NUMIAT
         CALL GVSTT6 (LINE)
         CALL GVSCOD (' ')
         CALL GVSNL6 (1)



 200  CONTINUE
      GOTO 998



 999  CALL GVSEIW ('MOL350')



 998  CONTINUE


      RETURN
      END
      SUBROUTINE MOL351

















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INTEGER       IAATYP







      CALL GVSFMT ('?FMT1418')
      DO 10 IAATYP=1,WIFPAR(276)
         CALL GVSCTB (LINE,80)
         WRITE (LINE,FMT,ERR=999) IAATYP,AANAME(IAATYP),ATPRAA(IAATYP),
     +    FAMTYP(IAATYP)
         CALL GVSTT6 (LINE)
 10   CONTINUE
      GOTO 998



  999 CONTINUE
      CALL GVSEIW ('MOL351')



  998 CONTINUE


      RETURN
      END   
      SUBROUTINE MOL352

















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INTEGER       IAA, IERR
      CHARACTER*1   CHID







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



      CALL WIFWTF (' ',IERR)
      IF (IERR.NE.0) GOTO 998
      CALL WRK1TFCOMPLETE



      CALL IPROMPT ('?M0720')
      CALL NEEDWORD (CHID,' ',IERR)
      IF (IERR.NE.0) GOTO 998



      IF (CHID.EQ.'/') CHID=' '



      DO 20 IAA=1,NUMAAT
         IF (WRK1TF(IAA)) CHANAM(IAA)=CHID
   20 CONTINUE



  998 CONTINUE


      RETURN
      END   
      SUBROUTINE MOL353

















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INTEGER       IAT, JAT, IAA, JAA, KAA, ISOUP, JSOUP, KSOUP, 
     +              CIND, IBEST, IBND, INOW, INOT
      CHARACTER*1   CHIDNEW, CIDBEST
      LOGICAL       WIFISR, WIFISD, WIFIRA, WIFIRN







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



      CALL GVSBTF (WRK1TF,MAXAA)
      CALL GVSCTB (CHANAM,MAXAA)
      CIND=-1
      CALL GVSIT0 (FUTURE,MAXAA)



      DO 20 ISOUP=1,NUMSOU
         IF (WIFISR(ISOUP)) THEN



            IF (CIND.EQ.35) CALL SHOWTEXTIF ('?M1998')



            CIND=MOD(CIND+1,36)
            CHIDNEW=CHADEF2(CIND+1:CIND+1)



            DO 10 IAA=SOUADM(1,ISOUP),SOUADM(2,ISOUP)
               WRK1TF(IAA)=.TRUE.
               CHANAM(IAA)=CHIDNEW




               DO 15 IAT=PNTAAS(IAA),PNTAAE(IAA)
                  DO 14 IBND=1,8
                     JAT=BOUND_TO(IBND,IAT)
                     IF (JAT.NE.0) THEN
                        JAA=ATIAA(JAT)
                        KSOUP=CHAINN(2,JAA)
                        IF (WIFIRA(JAA).OR.WIFIRN(JAA)) GOTO 14
                        IF (WRK1TF(JAA)) THEN
                           CALL GVSTTE ('Bound group set too early')
                        END IF
                        DO 13 KAA=SOUADM(1,KSOUP),SOUADM(2,KSOUP)
                           WRK1TF(KAA)=.TRUE.
                           CHANAM(KAA)=CHIDNEW
 13                     CONTINUE
                     END IF
 14               CONTINUE
 15            CONTINUE
 10         CONTINUE
         END IF
 20   CONTINUE



      DO 50 ISOUP=1,NUMSOU
         IF (WIFISD(ISOUP)) THEN
            CIDBEST=' '
            IBEST=0
            DO 30 JSOUP=1,NUMSOU
               IF (WIFISR(JSOUP)) THEN
                  CALL PRP_CHA_CNT (ISOUP,CHANAM(SOUADM(1,JSOUP)),
     +             INOW,INOT)
                  IF (INOW.GT.IBEST) THEN
                     IBEST=INOW
                     CIDBEST=CHANAM(SOUADM(1,JSOUP))
                  END IF
               END IF
 30         CONTINUE
            IF (IBEST.NE.0) THEN
               DO 40 IAA=SOUADM(1,ISOUP),SOUADM(2,ISOUP)
                  CHANAM(IAA)=CIDBEST
 40            CONTINUE
            END IF
         END IF
 50   CONTINUE



  998 CONTINUE


      RETURN
      END   
      SUBROUTINE MOL354 (IFT1,IFT2,TEXT)

















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INTEGER       IAT, JAT, IAA, JAA, KAA, KSOUP, IBND, IFT1, IFT2
      CHARACTER*1   TEXT







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



      CALL GVSBTF (WRK1TF,NUMAAT)
      CALL GVST6C ('Setting new CHAIN name :',TEXT,.TRUE.)



      DO 10 IAA=IFT1, IFT2
         WRK1TF(IAA)=.TRUE.
         CHANAM(IAA)=TEXT




         DO 15 IAT=PNTAAS(IAA),PNTAAE(IAA)
            DO 14 IBND=1,8
               JAT=BOUND_TO(IBND,IAT)
               IF (JAT.NE.0) THEN
                  JAA=ATIAA(JAT)
                  KSOUP=CHAINN(2,JAA)
                  IF (SOUADM(5,KSOUP).EQ.1.OR.SOUADM(5,KSOUP).EQ.3) 
     +             GOTO 14
                  IF (WRK1TF(JAA)) THEN
                     CALL GVSTTE ('Bound group set too early')
                  END IF
                  DO 13 KAA=SOUADM(1,KSOUP),SOUADM(2,KSOUP)
                     WRK1TF(KAA)=.TRUE.
                     CHANAM(KAA)=TEXT
 13               CONTINUE
               END IF
 14         CONTINUE
 15      CONTINUE
 10   CONTINUE



  998 CONTINUE


      RETURN
      END   
      SUBROUTINE MOL355 (JPAR)

















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INTEGER       IPAR, JPAR, IAT, IAA, IAATYP, GVFLEN







   10 CONTINUE
      IF (JPAR.EQ.0) THEN
         CALL IPROMPT ('?M2888')
         CALL GVSFFI (1,IPAR)
      ELSE
         IPAR=JPAR
      END IF
      IF (IPAR.LE.0) GOTO 998
      IF (IPAR.GT.MAXNNA) THEN
         CALL GVSTTI ('?M2889',MAXNNA)
         GOTO 10
      END IF



      DO 30 IAATYP=1,WIFPAR(276)
         DO 20 IAT=1,ATPRAA(IAATYP)
            IF (GVFLEN(MUTSTO4(IAT,IAATYP,IPAR)).GE.2) THEN
              CALL GVSCTB (MUTROW4(IAT,IAATYP),5)
              CALL GVSSTX(MUTROW4(IAT,IAATYP),MUTSTO4(IAT,IAATYP,IPAR))
            END IF
 20      CONTINUE
 30   CONTINUE



      DO 50 IAA=1,NUMAAT
         IF (RESTYP(IAA).NE.0) THEN
            DO 40 IAT=PNTAAS(IAA),PNTAAE(IAA)
              CALL GVSSTX(ONESAT(IAT),MUTROW4(PINIAA(IAT),RESTYP(IAA)))
 40         CONTINUE
         END IF
 50   CONTINUE



  998 CONTINUE


      RETURN
      END   
