!==============================================================
!
program main
   use initialset
   implicit none

   real(8) :: HITRAN(linenumber(3), 6, SpNum)
   real(8) :: path

   real(8) :: delta_wavenumber  !  0.001 cm^-1, line by line for CO2, H2O
   real(8) :: wavenumberMin     !  calculasion range
   real(8) :: wavenumberMax     !  calculasion range
   real(8) :: Pres              !! [Pa] 
   real(8) :: Temp              !! [K]
   real, allocatable :: AbsorbCoeffi(:)  ! Absorb Coefficient 

   integer :: kmax, SpLoop, i

   character(len=64) :: ctlfn = "ctlfile"
   namelist /wavenum/ wavenumberMin, wavenumberMax, delta_wavenumber 
   namelist /SP/ SpLoop
   namelist /atmos/ temp, pres, path

   open( 50, file=ctlfn )
   read( 50, wavenum )
   read( 50, SP )
   read( 50, atmos )
   close( 50 )

   kmax = int ( ( wavenumberMax-wavenumberMin ) / delta_wavenumber)

   allocate ( AbsorbCoeffi(1:kmax) )

   call HITRAN_READ( HITRAN )


!   path = 1.0/3.72 * 6.02E+23/m(SpLoop)

   write(*,*) '# absorp Coefficient [cm^2 / (molecule)] '
   write(*,*) '#' 
   write(*,*) '# modelcule ID =', SpLoop,'    (CO2:1, H2O:2, CH4:3) '
   write(*,*) '#   Temperature =', Temp ,'    [K]'
   write(*,*) '#   Pressure =', Pres ,'       [Pa]' 
   write(*,*) '#   calculation range: ', wavenumbermin , '--' , wavenumbermax,'  [cm^-1]'
   write(*,*) '#   resolution; ', delta_wavenumber ,'  [cm^-1] '
   write(*,*) '#' 
   write(*,*) '#' 
   
   call AbsorpCoeffiLBL(Pres, Temp, wavenumberMin, wavenumberMax, delta_wavenumber, &
        HITRAN(1:linenumber(SpLoop), :, SpLoop:SpLoop),  &
        & kmax, SpLoop, path, AbsorbCoeffi(1:kmax) )

   deallocate ( AbsorbCoeffi )

   stop
   end

