
C LAST UPDATE:
C+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
C
C*************************
C**     LSM_ABSC_MU     **
C*************************
C
C **** LSM SERVICE ROUTINE ONLY ****
C 
      REAL FUNCTION LSM_ABSC_MU (ALAM)
C
      INCLUDE 'implicit_none.finc'
C
C
C Purpose:  Return mu(lambda) for a reflection
C
C Author:  Steffi Arzt, John Campbell, July 1997
C
C Arguments:
C
      REAL ALAM 
C
C Parameters:
C
C ALAM    (R)   The wavelength    
C
C====== GLOBALS:
C
      INCLUDE 'limits.finc'
      INCLUDE 'other_scale.finc'
      INCLUDE 'scp.finc'
      INCLUDE 'abscor_muin.finc'
C
C====== FUNCTION TYPES:
C

C
C====== LOCALS:
C
      INTEGER I
      INTEGER K 
      REAL AA
      REAL BB    
      REAL ALAMMU(MAXMU)
      REAL AMUIN(MAXMU)
C
C-------------------------------------------------------------------------------
C 
      LSM_ABSC_MU = MUTABLE(1)*ALAM**3
      IF (MUINPUT.EQ.2) THEN
         LSM_ABSC_MU = MUTABLE(2)+MUTABLE(1)*ALAM**3
      ELSE
         IF (MUINPUT.GT.2) THEN
            K = 1
            DO 10 I = 1, MUINPUT-1, 2  
               ALAMMU(K) = MUTABLE(I) 
               AMUIN(K) = MUTABLE(I+1) 
               K = K+1
 10         CONTINUE
            DO 20 I = 1, MUINPUT/2-1
               IF (ALAM.GE.ALAMMU(I).AND.ALAM.LE.ALAMMU(I+1)) THEN
                  BB = AMUIN(I)
                  AA = (AMUIN(I+1)-AMUIN(I))/ALAMMU(I+1)
                  LSM_ABSC_MU = AA*ALAM + BB
                  RETURN
               END IF
 20         CONTINUE 
            IF (ALAM.LT.ALAMMU(1)) THEN
               BB = AMUIN(1)
               AA = (AMUIN(2)-AMUIN(1))/ALAMMU(2)
               LSM_ABSC_MU = AA*ALAM + BB
               RETURN
            END IF
            IF (ALAM.GT.ALAMMU(MUINPUT/2)) THEN
               BB = AMUIN(MUINPUT/2-1)
               AA = (AMUIN(MUINPUT/2)-AMUIN(MUINPUT/2-1))/
     +              ALAMMU(MUINPUT/2)
               LSM_ABSC_MU = AA*ALAM + BB
               RETURN
            END IF                                        
         END IF
      END IF
      RETURN
      END
