      subroutine cntset (atpres, thmprs, altcod, nscats, aacode, aacnt, CNTS001
     &                   atcnt,  scatct, thmcnt, setloc)                CNTS002
c     perform end of amino acid flag setting                            CNTS003
c                                                                       CNTS004
      include 'brkcln.par'                                              CNTS005
c                                                                       CNTS006
      character atpres(3,maxres)*1, thmprs(maxres)*1, altcod(maxres)*1, CNTS007
     &          setloc*1                                                CNTS008
c                                                                       CNTS009
      integer   nscats(sideaa), aacode, aacnt, scatct, thmcnt, atcnt    CNTS010
      integer   totats                                                  CNTS011
c                                                                       CNTS012
      character atmchk*1                                                CNTS013
c                                                                       CNTS014
      altcod(aacnt)   = setloc                                          CNTS015
      atpres(1,aacnt) = space                                           CNTS016
      atpres(2,aacnt) = space                                           CNTS017
      atpres(3,aacnt) = space                                           CNTS018
      thmprs(aacnt)   = space                                           CNTS019
      totats          = atcnt + scatct                                  CNTS020
      if (aacode .le. sideaa) then                                      CNTS021
         if (nscats(aacode) .ge. 0) then                                CNTS022
            atpres(1,aacnt) = atmchk((mnchna+nscats(aacode))-1,totats)  CNTS023
            atpres(2,aacnt) = atmchk(mnchna-1,atcnt)                    CNTS024
            atpres(3,aacnt) = atmchk(nscats(aacode),scatct)             CNTS025
            thmprs(aacnt)   = atmchk((mnchna+nscats(aacode))-1,thmcnt)  CNTS026
         end if                                                         CNTS027
      end if                                                            CNTS028
      end                                                               CNTS029
