      function dang(x,y,z)

c  this subroutine written by alain st-amant of the department of
c  pharmaceutical chemistry, university of california, san francisco.
c  all rights reserved.  this is part of the DeFT project.

      implicit real*8(a-h,o-z)

      dimension x(*),y(*),z(*)

      data dmtwo,dneg,dpos/-2.0d0,-1.0d0,1.0d0/

      d12=dist(x,y)
      d13=dist(x,z)
      d23=dist(y,z)

      bangle=(d13*d13-d12*d12-d23*d23)/dmtwo/d12/d23

      if(bangle.gt.dpos) bangle=dpos
      if(bangle.lt.dneg) bangle=dneg

      dang=acos(bangle)

      return
      end
