      function sum_fun(n,x) ! bernd berg aug 15 2007.
c sums the array elements of x(n).
      include '../../libs/fortran/implicit.sta'
      include '../../libs/fortran/constants.par'
      dimension x(n)
      sum_fun=zero
      do i=1,n
        sum_fun=sum_fun+x(i)
      end do
      return
      end
