*     *************************************************************************

      subroutine hessid( n, hess, alpha )

*     *************************************************************************

*     Purpose :
*     ---------

*     For ALPHA = 1.0D0, this routine sets the square matrix HESS
*     to the identity matrix.
*     In the other cases, this routine sets the diagonal elements
*     of the square matrix HESS to the double precision constant
*     ALPHA.

*     The matrix HESS is considered as symmetric and only its
*     lower triangular part is stored.

*     Parameters :
*     ------------

*     n       ( int )

*       input  : the dimension of the square matrix HESS.
*       output : unmodified.

*     hess    ( dble )

*       input  : a double precision array containing the
*                lower triangular part a one symmetric
*                matrix of dimension N.
*       output : for ALPHA = 1.0D0, this matrix is set to
*                the identity matrix.
*                Otherwise, the diagonal elements are set
*                to the double precision constant ALPHA.

*     alpha   ( dble )

*       input  : the double precision value to assign to the
*                diagonal elements of the square matrix HESS.
*       output : unmodified.

*     Routines used :
*     ---------------

*     None.

*     Programming :
*     -------------

*     D. Tuyttens

*     ========================================================================

*     Routine parameters

      integer           n
      double precision  hess(*), alpha

*     Internal variables

      integer           i, j, ind

      double precision  zero, one, two, three, half, tenm1, tenm2, tenm4
      common / prbcst / zero, one, two, three, half, tenm1, tenm2, tenm4

      ind = 0
*
*     Loop on the N columns.
*
      do 10 i = 1 , n
*
*       Set the diagonal element to ALPHA.
*
        ind = ind + 1
        hess(ind) = alpha
*
*       Loop on the ith row elements.
*
        if( alpha.ne.one ) then
          ind = ind + n - i
        else
          do 20 j = 2 , n-i+1
            ind = ind + 1
            hess(ind) = zero
 20       continue
        endif
*
 10   continue
*
      return
      end