      subroutine chnset (brksym, chnsz,  chnct,  chnend, ninchn, seqbcd,CHNS001
     &                   nxres,  seqlen, chstop, chstrt, chnlt)         CHNS002
c                                                                       CHNS003
      include 'brkcln.par'                                              CHNS004
c                                                                       CHNS005
      integer   chnsz(maxchn), chnct, ninchn, seqlen, nxres,            CHNS006
     &          chnend(maxchn), chnlt                                   CHNS007
c                                                                       CHNS008
      character seqbcd(maxres)*6, brksym(maxres)*1, chstop(maxres)*1,   CHNS009
     &          chstrt(maxres)*1                                        CHNS010
c                                                                       CHNS011
  100 format (' Chain break between ',i4, ' (', a6, ') and ', i4, ' (', CHNS012
     & a6, ')')                                                         CHNS013
c                                                                       CHNS014
      chnsz(chnct) = ninchn                                             CHNS015
      if (chnct .eq. 1) then                                            CHNS016
         chnend(chnct) = ninchn                                         CHNS017
      else                                                              CHNS018
         chnend(chnct) = chnend(chnct-1) + ninchn                       CHNS019
      end if                                                            CHNS020
      ninchn = 1                                                        CHNS021
      if (nxres .le. seqlen) then                                       CHNS022
         brksym(nxres-1) = brkch                                        CHNS023
         brksym(nxres)   = brkch                                        CHNS024
CHECK v.2.1.3-->                                                        CHNS025
C         write (logfi, 100) nxres-1, seqbcd(nxres-1),                  CHNS026
C     +                      nxres,   seqbcd(nxres)                     CHNS027
         write (*, 100) nxres-1, seqbcd(nxres-1),                       CHNS028
     &                      nxres,   seqbcd(nxres)                      CHNS029
CHECK v.2.1.3<--                                                        CHNS030
CHECK v.1.0-->                                                          CHNS031
C         write (*,     100) nxres-1, seqbcd(nxres-1),                  CHNS032
C     +                      nxres,   seqbcd(nxres)                     CHNS033
CHECK v.1.0<--                                                          CHNS034
         if (seqbcd(nxres-1)(1:1) .ne. seqbcd(nxres)(1:1)) chnlt =      CHNS035
     &                                                     chnlt + 1    CHNS036
         chnct = chnct + 1                                              CHNS037
CHECK v.3.3.1-->                                                        CHNS038
         if (chnct.gt.maxchn) then                                      CHNS039
             chnct = maxchn                                             CHNS040
             print*, '*** Maximum number of chain-breaks exceeded',     CHNS041
     &           maxchn                                                 CHNS042
         endif                                                          CHNS043
CHECK v.3.3.1<--                                                        CHNS044
         chstop(nxres-1) = '>'                                          CHNS045
         chstrt(nxres)   = '<'                                          CHNS046
      end if                                                            CHNS047
      end                                                               CHNS048
