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