3 c ###################################################
4 c ## COPYRIGHT (C) 1996 by Jay William Ponder ##
5 c ## All Rights Reserved ##
6 c ###################################################
8 c ################################################################
10 c ## subroutine surfatom -- exposed surface area of an atom ##
12 c ################################################################
15 c "surfatom" performs an analytical computation of the surface
16 c area of a specified atom; a simplified version of "surface"
18 c literature references:
20 c T. J. Richmond, "Solvent Accessible Surface Area and
21 c Excluded Volume in Proteins", Journal of Molecular Biology,
24 c L. Wesson and D. Eisenberg, "Atomic Solvation Parameters
25 c Applied to Molecular Dynamics of Proteins in Solution",
26 c Protein Science, 1, 227-235 (1992)
28 c variables and parameters:
30 c ir number of atom for which area is desired
31 c area accessible surface area of the atom
32 c radius radii of each of the individual atoms
35 subroutine surfatom (ir,area,radius)
36 implicit real*8 (a-h,o-z)
40 include 'COMMON.IOUNITS'
41 integer nres,nsup,nstart_sup
42 double precision c,dc,dc_old,d_c_work,xloc,xrot,dc_norm
43 common /chain/ c(3,maxres2+2),dc(3,0:maxres2),dc_old(3,0:maxres2),
44 & xloc(3,maxres),xrot(3,maxres),dc_norm(3,0:maxres2),
45 & dc_work(MAXRES6),nres,nres0
47 parameter (maxarc=300)
54 integer intag1(maxarc)
80 real*8 ri(maxarc),risq(maxarc)
81 real*8 ux(maxarc),uy(maxarc),uz(maxarc)
82 real*8 xc(maxarc),yc(maxarc),zc(maxarc)
83 real*8 xc1(maxarc),yc1(maxarc),zc1(maxarc)
84 real*8 dsq(maxarc),bsq(maxarc)
85 real*8 dsq1(maxarc),bsq1(maxarc)
86 real*8 arci(maxarc),arcf(maxarc)
87 real*8 ex(maxarc),lt(maxarc),gr(maxarc)
88 real*8 b(maxarc),b1(maxarc),bg(maxarc)
89 real*8 kent(maxarc),kout(maxarc)
95 c zero out the surface area for the sphere of interest
98 c write (2,*) "ir",ir," radius",radius(ir)
99 if (radius(ir) .eq. 0.0d0) return
101 c set the overlap significance and connectivity shift
105 delta2 = delta * delta
110 c store coordinates and radius of the sphere of interest
118 c initialize values of some counters and summations
127 c test each sphere to see if it overlaps the sphere of interest
130 if (i.eq.ir .or. radius(i).eq.0.0d0) goto 30
131 rplus = rr + radius(i)
133 if (abs(tx) .ge. rplus) goto 30
135 if (abs(ty) .ge. rplus) goto 30
137 if (abs(tz) .ge. rplus) goto 30
139 c check for sphere overlap by testing distance against radii
142 if (xysq .lt. delta2) then
149 if (rplus-cc .le. delta) goto 30
150 rminus = rr - radius(i)
152 c check to see if sphere of interest is completely buried
154 if (cc-abs(rminus) .le. delta) then
155 if (rminus .le. 0.0d0) goto 170
159 c check for too many overlaps with sphere of interest
161 if (io .ge. maxarc) then
163 20 format (/,' SURFATOM -- Increase the Value of MAXARC')
167 c get overlap between current sphere and sphere of interest
176 gr(io) = (ccsq+rplus*rminus) / (2.0d0*rr*b1(io))
182 c case where no other spheres overlap the sphere of interest
185 area = 4.0d0 * pi * rrsq
189 c case where only one sphere overlaps the sphere of interest
192 area = pix2 * (1.0d0 + gr(1))
193 area = mod(area,4.0d0*pi) * rrsq
197 c case where many spheres intersect the sphere of interest;
198 c sort the intersecting spheres by their degree of overlap
200 call sort2 (io,gr,key)
212 c get radius of each overlap circle on surface of the sphere
217 risq(i) = rrsq - gi*gi
218 ri(i) = sqrt(risq(i))
219 ther(i) = 0.5d0*pi - asin(min(1.0d0,max(-1.0d0,gr(i))))
222 c find boundary of inaccessible area on sphere of interest
225 if (.not. omit(k)) then
232 c check to see if J circle is intersecting K circle;
233 c get distance between circle centers and sum of radii
237 cc = (txk*xc(j)+tyk*yc(j)+tzk*zc(j))/(bk*b(j))
238 cc = acos(min(1.0d0,max(-1.0d0,cc)))
241 c check to see if circles enclose separate regions
243 if (cc .ge. td) goto 60
245 c check for circle J completely inside circle K
247 if (cc+ther(j) .lt. therk) goto 40
249 c check for circles that are essentially parallel
251 if (cc .gt. delta) goto 50
256 c check to see if sphere of interest is completely buried
259 if (pix2-cc .le. td) goto 170
265 c find T value of circle intersections
268 if (omit(k)) goto 110
283 c rotation matrix elements
295 if (.not. omit(j)) then
300 c rotate spheres so K vector colinear with z-axis
302 uxj = txj*axx + tyj*axy - tzj*axz
303 uyj = tyj*ayy - txj*ayx
304 uzj = txj*azx + tyj*azy + tzj*azz
305 cosine = min(1.0d0,max(-1.0d0,uzj/b(j)))
306 if (acos(cosine) .lt. therk+ther(j)) then
307 dsqj = uxj*uxj + uyj*uyj
312 tr2 = risqk*dsqj - tb*tb
318 c get T values of intersection for K circle
321 tb = min(1.0d0,max(-1.0d0,tb))
323 if (tyb-txr .lt. 0.0d0) tk1 = pix2 - tk1
325 tb = min(1.0d0,max(-1.0d0,tb))
327 if (tyb+txr .lt. 0.0d0) tk2 = pix2 - tk2
328 thec = (rrsq*uzj-gk*bg(j)) / (rik*ri(j)*b(j))
329 if (abs(thec) .lt. 1.0d0) then
331 else if (thec .ge. 1.0d0) then
333 else if (thec .le. -1.0d0) then
337 c see if "tk1" is entry or exit point; check t=0 point;
338 c "ti" is exit point, "tf" is entry point
340 cosine = min(1.0d0,max(-1.0d0,
341 & (uzj*gk-uxj*rik)/(b(j)*rr)))
342 if ((acos(cosine)-ther(j))*(tk2-tk1) .le. 0.0d0) then
350 if (narc .ge. maxarc) then
352 70 format (/,' SURFATOM -- Increase the Value',
377 c special case; K circle without intersections
379 if (narc .le. 0) goto 90
381 c general case; sum up arclength and set connectivity code
383 call sort2 (narc,arci,key)
388 if (narc .gt. 1) then
391 if (t .lt. arci(j)) then
392 arcsum = arcsum + arci(j) - t
393 exang = exang + ex(ni)
395 if (jb .ge. maxarc) then
397 80 format (/,' SURFATOM -- Increase the Value',
402 kent(jb) = maxarc*i + k
404 kout(jb) = maxarc*k + i
413 arcsum = arcsum + pix2 - t
415 exang = exang + ex(ni)
418 kent(jb) = maxarc*i + k
420 kout(jb) = maxarc*k + i
427 arclen = arclen + gr(k)*arcsum
430 if (arclen .eq. 0.0d0) goto 170
431 if (jb .eq. 0) goto 150
433 c find number of independent boundaries and check connectivity
437 if (kout(k) .ne. 0) then
444 if (m .eq. kent(ii)) then
447 if (j .eq. jb) goto 150
459 c attempt to fix connectivity error by moving atom slightly
463 140 format (/,' SURFATOM -- Connectivity Error at Atom',i6)
472 c compute the exposed surface area for the sphere of interest
475 area = ib*pix2 + exang + arclen
476 area = mod(area,4.0d0*pi) * rrsq
478 c attempt to fix negative area by moving atom slightly
480 if (area .lt. 0.0d0) then
483 160 format (/,' SURFATOM -- Negative Area at Atom',i6)