      integer function aaconv (aacode, aacod3, hetcod)                  AACO001
c     find the numerical position of an amino acid code                 AACO002
c                                                                       AACO003
      include 'brkcln.par'                                              AACO004
c                                                                       AACO005
CHECK v.3.2-->                                                          AACO006
      save lastcd                                                       AACO007
CHECK v.3.2<--                                                          AACO008
      character aacode*3, aacod3*(3*abetsz), hetcod*63                  AACO009
CHECK v.3.0.1--> (Order of statements changed)                          AACO010
      integer resfnd, aaval                                             AACO011
CHECK v.3.0.1<--                                                        AACO012
CHECK v.2.1.4-->                                                        AACO013
      character lastcd*3                                                AACO014
      data lastcd / '   ' /                                             AACO015
                                                                        AACO016
CHECK v.3.2-->                                                          AACO017
C      save lastcd                                                      AACO018
CHECK v.3.2<--                                                          AACO019
CHECK v.2.1.4<--                                                        AACO020
c                                                                       AACO021
c                                                                       AACO022
  530 format (' "',a3, '":', a)                                         AACO023
c                                                                       AACO024
      aaval = resfnd(aacod3,aacode)                                     AACO025
      if (aaval .eq. 0) then                                            AACO026
         aaval = resfnd(hetcod,aacode)                                  AACO027
         if (aaval .eq. 0) then                                         AACO028
            aaval = unkcod                                              AACO029
CHECK v.2.1.3-->                                                        AACO030
C            write (logfi, 530) aacode,' unknown amino acid code'       AACO031
CHECK v.2.1.4-->                                                        AACO032
C            write (*, 530) aacode,' unknown amino acid code'           AACO033
            if (aacode.ne.lastcd) then                                  AACO034
                write (*, 530) aacode,' unknown amino acid code'        AACO035
                lastcd = aacode                                         AACO036
            endif                                                       AACO037
CHECK v.2.1.4<--                                                        AACO038
CHECK v.2.1.3<--                                                        AACO039
CHECK v.1.0-->                                                          AACO040
C            write (*,     530) aacode,' unknown amino acid code'       AACO041
CHECK v.1.0<--                                                          AACO042
         else                                                           AACO043
            aaval = (abetsz + (aaval / 3)) + 1                          AACO044
         end if                                                         AACO045
      else                                                              AACO046
         aaval = (aaval / 3) + 1                                        AACO047
      end if                                                            AACO048
      aaconv = aaval                                                    AACO049
      end                                                               AACO050
