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

      subroutine rg( n, ind, d, h )

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

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

*     This routine sets the direction D to the steepest
*     descent direction, i.e. to minus the reduced gradient.

*     The components of these vectors that are considered
*     are the components of indices IND(i) for i=1 up to
*     i=n.

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

*     n       ( int )

*       input  : number of components of D to assign
*                to minus the reduced gradient value.
*                It is also the length of array IND.
*       output : unmodified.

*     ind     ( int )

*       input  : array of length N, containing the indices
*                of the components of D to assign to minus
*                the reduced gradient value.
*       output : unmodified.

*     d       ( dble )

*       input  : vector that is designed to contain the search
*                direction.
*       output : identical to the input value, except for
*                the components of indices IND(i) for i=1
*                up to i=n, that are set to minus the
*                reduced gradient.

*     h       ( dble )

*       input  : the reduced gradient vector.
*       output : unmodified.

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

*     None.

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

*     D. Tuyttens

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

*     Routine parameters

      integer           n,  ind(*)
      double precision  d(*), h(*)

*     Internal variables

      integer           i, k

      do 10 i = 1 , n
        k    = ind(i)
        d(k) = -h(k)
 10   continue
*
      return
      end
