      function fe_kin(nd,n,xm,v) ! Bernd Berg Jun 08 2008.
C Kinetic Energy for input values (masses, velocities).
      include 'implicit.sta'
      include 'constants.par'
      dimension xm(n),v(nd,n)
      fe_kin=zero
      do i=1,n
        do id=1,nd
          fe_kin=fe_kin+xm(i)*v(id,i)**2
        enddo
      enddo
      fe_kin=half*fe_kin
      return
      end
