      function dimp(coord1,coord2,coord3,coord4)

c  this subroutine written by alain st-amant of the
c  department of chemistry, university of ottawa, ottawa, canada.
c  all rights reserved.  this is part of the DeFT project.

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

      dimension vec42(3),vec43(3),vec41(3),vec(3)

      dimension coord1(*),coord2(*),coord3(*),coord4(*)

      data one/1.0d0/

      phi_1=dang(coord2,coord4,coord3)

      call unitvec(vec42,coord4,coord2)
      call unitvec(vec43,coord4,coord3)
      call unitvec(vec41,coord4,coord1)

      call crossprod(vec,vec42,vec43)

      sin_dimp=(dot(3,vec,vec41))/(sin(phi_1))

      if(sin_dimp.ge.+one) sin_dimp=+one
      if(sin_dimp.le.-one) sin_dimp=-one

      dimp=asin(sin_dimp)

      return
      end
