c
c
c     ###################################################
c     ##  COPYRIGHT (C)  1994  by  Jay William Ponder  ##
c     ###################################################
c
c     #################################################################
c     ##                                                             ##
c     ##  subroutine burial  --  percentage accessible surface area  ##
c     ##                                                             ##
c     #################################################################
c
c
c     "burial" computes the percentage of buried surface area for
c     each residue in a protein by comparing the solvent accessible
c     area in the protein to the accessible area for the same residue
c     in an extended GLY-XXX-GLY tripeptide
c
c     literature references :
c
c     C. Chothia, "The Nature of the Accessible and Buried Surfaces
c     in Proteins", Journal of Molecular Biology, 105, 1-14 (1975)
c
c     D. Eisenberg, M. Wesson and M. Yamashita, Chemica Scripta,
c     29A, 217 (1989)
c
c
      subroutine burial (surftyp,nres,resatm,radius,schain,bury,fbury)
      implicit none
      include 'sizes.i'
      include 'pdb.i'
      include 'sequen.i'
      integer i,k,nres,resatm(2,maxres)
      real*8 expose(maxres)
      real*8 bury(maxres),fbury(maxres)
      real*8 allarea,resarea(maxamino)
      real*8 cyrus(maxamino),fred(maxamino)
      real*8 total,area(maxatm),darea(3,maxatm)
      real*8 probe,radius(maxatm),weight(maxatm)
      character*8 surftyp
      logical schain(maxatm)
c
c     exposed area for each amino acid in an extended GLY-X-GLY;
c     note that the Cyrus Chothia-style values use whole residue X,
c     while Fred Richards-style values use only sidechain and CA for
c     compatibility with the Eisenberg 3D-1D structural profiles
c
      data cyrus /  75.0d0, 115.0d0, 155.0d0, 170.0d0, 175.0d0,
     &             115.0d0, 140.0d0, 135.0d0, 145.0d0, 210.0d0,
     &             230.0d0, 255.0d0, 195.0d0, 150.0d0, 160.0d0,
     &             190.0d0, 180.0d0, 185.0d0, 200.0d0, 225.0d0,
     &             180.0d0, 130.0d0, 205.0d0,  75.0d0 /
      data fred  /  34.8d0,  72.6d0, 118.8d0, 147.8d0, 143.5d0,
     &              83.6d0, 106.9d0,  99.2d0, 124.5d0, 166.8d0,
     &             181.0d0, 205.0d0, 150.2d0, 110.5d0, 120.9d0,
     &             138.6d0, 148.6d0, 159.4d0, 173.4d0, 208.9d0,
     &             145.5d0, 102.4d0, 149.8d0,  34.8d0 /
c
c
c     decide which residue reference surface areas to use
c
      if (surftyp .eq. 'CHOTHIA ') then
         do i = 1, maxamino
            resarea(i) = cyrus(i)
         end do
      else if (surftyp .eq. 'RICHARDS') then
         do i = 1, maxamino
            resarea(i) = fred(i)
         end do
      end if
c
c     find the solvent accessible surface area of each atom,
c     note that atomic radii have already had probe added
c
      probe = 0.0d0
      do i = 1, npdb
         weight(i) = 1.0d0
      end do
      call surface (total,area,darea,radius,weight,probe)
c
c     find the buried area and percent buried for each residue;
c     for Richards-Eisenberg, consider only the sidechain atoms
c
      do i = 1, nres
         allarea = resarea(seqtyp(i))
         expose(i) = 0.0d0
         do k = resatm(1,i), resatm(2,i)
            if (schain(k) .or. surftyp.ne.'RICHARDS') then
               expose(i) = expose(i) + area(k)
            end if
         end do
         bury(i) = allarea - expose(i)
         if (bury(i) .lt. 0.0d0)  bury(i) = 0.0d0
         fbury(i) = 100.0d0 * (bury(i) / allarea)
      end do
      return
      end
