      SUBROUTINE Chnset(brksym, chnsz, chnct, chnend, ninchn, seqbcd,   CHNS001
     &                  nxres, seqlen)                                  CHNS002
      include 'sstruc.par'                                              CHNS003
      integer   chnsz(maxchn), chnct, ninchn, seqlen, nxres,            CHNS004
     &          chnend(maxchn)                                          CHNS005
      character seqbcd(maxres)*6, brksym(maxres)*1                      CHNS006
                                                                        CHNS007
      chnsz(chnct) = ninchn                                             CHNS008
      if (chnct .eq. 1) then                                            CHNS009
         chnend(chnct) = ninchn                                         CHNS010
      else                                                              CHNS011
         chnend(chnct) = chnend(chnct-1) + ninchn                       CHNS012
      end if                                                            CHNS013
      ninchn = 1                                                        CHNS014
      if (nxres .le. seqlen) then                                       CHNS015
         brksym(nxres-1) = brkch                                        CHNS016
         brksym(nxres) = brkch                                          CHNS017
         write(errfi,100) nxres-1, seqbcd(nxres-1), nxres, seqbcd(nxres)CHNS018
  100    format('chain break between ',i4,'(',a6,') and ',i4,'(',a6,')')CHNS019
         chnct = chnct + 1                                              CHNS020
CHECK v.3.3.1-->                                                        CHNS021
         if (chnct.gt.maxchn) then                                      CHNS022
             chnct = maxchn                                             CHNS023
             print*, '*** Maximum number of chain-breaks exceeded',     CHNS024
     &           maxchn                                                 CHNS025
         endif                                                          CHNS026
CHECK v.3.3.1<--                                                        CHNS027
      end if                                                            CHNS028
      end                                                               CHNS029
