C LAST UPDATE:
C++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
C
C***************************
C**       LRL_NODIDX      **
C***************************
C
CD-Routine: Get Nodal Index from Indices - LRL_NODIDX
C This routine determines the nodal index from a set of reflection indices.
CD-end
CD-Fortran:
      SUBROUTINE LRL_NODIDX (IH, IK, IL, NODIDX)
CD-end
C
C      INCLUDE 'implicit_none.finc'
C
C Purpose: To calculate the "nodal spot selection index" at which a
C          nodal would be selected.
C
C Author:  Based on code from GENLAUE by Clifton et al.
C
C Arguments:
C
      INTEGER IH
      INTEGER IK
      INTEGER IL
      INTEGER NODIDX
C
CD-Parameters:
C IH      i  (R) 'h' index
C IK      i  (R) 'k' index
C IL      i  (R) 'l' index
C NODIDX  i  (W) Returns nodal index
CD-end
C
C====== FUNCTION TYPES:
C
      INTEGER LRL_HCF
C
C====== LOCALS:
C
      INTEGER   HCF1, HCF2
      INTEGER   H1, K1, L1
      INTEGER   HI, LO
C
C------------------------------------------------------------------------------
C
      H1 = IH
      K1 = IK
      L1 = IL
      HCF1 = LRL_HCF(H1,K1)
      HCF2 = LRL_HCF(HCF1,L1)
      H1 = H1/HCF2
      K1 = K1/HCF2
      L1 = L1/HCF2
C
      HI = MAX0(H1,K1,L1)
      LO = MIN0(H1,K1,L1)
      NODIDX = MAX0(HI,-LO)
C
      RETURN
      END
