!******************************************************************************
! real*8 function renorm
! Renormalize Line Shape
!******************************************************************************

    real(8) function renorm( lowid, dowid, wnmax )

      use vtype_module
      use const_module

      implicit none

      real(dp), intent(in ) :: lowid,dowid
      real(dp), intent(in ) :: wnmax


      !
      ! local variables
      !
      integer(i4b) :: l, lm
      real(dp)     :: dwn, wn
      real(dp)     :: val1, val2

      real(dp)     :: voigt


      dwn    = dowid / 5.0d0
      lm     = int( wnmax / dwn ) + 1
      dwn    = wnmax / dble( lm )

      renorm = 0.0d0

      l = 1
      wn   = dwn * dble( l - 1 )
      val1 = voigt( lowid, dowid, wn )
      val2 = val1
      do l = 1+1, lm
         wn     = dwn * dble( l - 1 )
         val1   = voigt( lowid, dowid, wn )
         renorm = renorm + ( val1 + val2 ) * dwn * 0.5d0
         val2   = val1
      end do

      renorm = renorm + renorm

      renorm = 1.0d0 / renorm


    end function renorm
