
module initialize_rad_mod_cam

! version h2on68
!
! read in and initialize radiaive transfer grids
!

use kabs
use exoplanet_mod, only: solar_file => exo_solar_file
use cloud
use radgrid
use spmd_utils,       only: masterproc
use sys_rootdir

implicit none
private 
save

!
! Pubic Interfaces
!
  public :: initialize_kcoeff
  public :: initialize_solar
  public :: initialize_cldopts
  public :: initialize_radbuffer


!============================================================================
contains
!============================================================================

!============================================================================
!
! Public subroutines
!
!============================================================================

!============================================================================

  subroutine initialize_kcoeff

!------------------------------------------------------------------------
!
! Purpose:  Initialize k coefficient data from input file.
!
!------------------------------------------------------------------------

#if ( defined SPMD)
  use mpishorthand
#endif

    use ioFileMod, only: getfil
    use cam_pio_utils, only: cam_pio_openfile
    use pio,  only: pio_inq_varid, pio_get_var, pio_closefile, pio_nowrite,  &
              file_desc_t, var_desc_t


    implicit none
    include 'netcdf.inc'

!------------------------------------------------------------------------
!
! Local Variables
!
    type(file_desc_t) :: ncid
    integer :: gid
    integer :: pid
    integer :: tid
    integer :: wid
    integer :: nid
    integer :: keff_id
    character(len=256) :: locfn
    character(len=256) :: filename
    integer :: ierr

!------------------------------------------------------------------------
!
! Start Code
!

    if ( masterproc ) then
      write (6, '(2x, a)') '_______________________________________________________'
      write (6, '(2x, a)') '_________ initializing gas absorption coeffs __________'
      write (6, '(2x, a)') '_______________________________________________________'
    endif
     
    ! Load K coefficients, interval 1  
    filename = trim(exort_rootdir)//trim(dirk_h2o)//trim(k01_h2o_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k01_h2o)
    call pio_closefile(ncid)

    filename = trim(exort_rootdir)//trim(dirk_co2)//trim(k01_co2_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k01_co2)
    call pio_closefile(ncid)

    filename = trim(exort_rootdir)//trim(dirk_ch4)//trim(k01_ch4_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k01_ch4)
    call pio_closefile(ncid)


    ! Load K coefficients, interval 2  
    filename = trim(exort_rootdir)//trim(dirk_h2o)//trim(k02_h2o_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k02_h2o)
    call pio_closefile(ncid)

    filename = trim(exort_rootdir)//trim(dirk_co2)//trim(k02_co2_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k02_co2)
    call pio_closefile(ncid)

    filename = trim(exort_rootdir)//trim(dirk_ch4)//trim(k02_ch4_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k02_ch4)
    call pio_closefile(ncid)


    ! Load K coefficients, interval 3  
    filename = trim(exort_rootdir)//trim(dirk_h2o)//trim(k03_h2o_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k03_h2o)
    call pio_closefile(ncid)

    filename = trim(exort_rootdir)//trim(dirk_co2)//trim(k03_co2_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k03_co2)
    call pio_closefile(ncid)

    filename = trim(exort_rootdir)//trim(dirk_ch4)//trim(k03_ch4_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k03_ch4)
    call pio_closefile(ncid)


    ! Load K coefficients, interval 4  
    filename = trim(exort_rootdir)//trim(dirk_h2o)//trim(k04_h2o_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k04_h2o)
    call pio_closefile(ncid)

    filename = trim(exort_rootdir)//trim(dirk_co2)//trim(k04_co2_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k04_co2)
    call pio_closefile(ncid)

    filename = trim(exort_rootdir)//trim(dirk_ch4)//trim(k04_ch4_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k04_ch4)
    call pio_closefile(ncid)


    ! Load K coefficients, interval 5  
    filename = trim(exort_rootdir)//trim(dirk_h2o)//trim(k05_h2o_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k05_h2o)
    call pio_closefile(ncid)

    filename = trim(exort_rootdir)//trim(dirk_co2)//trim(k05_co2_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k05_co2)
    call pio_closefile(ncid)

    filename = trim(exort_rootdir)//trim(dirk_ch4)//trim(k05_ch4_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k05_ch4)
    call pio_closefile(ncid)


    ! Load K coefficients, interval 6  
    filename = trim(exort_rootdir)//trim(dirk_h2o)//trim(k06_h2o_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k06_h2o)
    call pio_closefile(ncid)

    filename = trim(exort_rootdir)//trim(dirk_co2)//trim(k06_co2_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k06_co2)
    call pio_closefile(ncid)

    filename = trim(exort_rootdir)//trim(dirk_ch4)//trim(k06_ch4_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k06_ch4)
    call pio_closefile(ncid)


    ! Load K coefficients, interval 7  
    filename = trim(exort_rootdir)//trim(dirk_h2o)//trim(k07_h2o_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k07_h2o)
    call pio_closefile(ncid)

    filename = trim(exort_rootdir)//trim(dirk_co2)//trim(k07_co2_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k07_co2)
    call pio_closefile(ncid)

    filename = trim(exort_rootdir)//trim(dirk_ch4)//trim(k07_ch4_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k07_ch4)
    call pio_closefile(ncid)


    ! Load K coefficients, interval 8  
    filename = trim(exort_rootdir)//trim(dirk_h2o)//trim(k08_h2o_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k08_h2o)
    call pio_closefile(ncid)

    filename = trim(exort_rootdir)//trim(dirk_co2)//trim(k08_co2_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k08_co2)
    call pio_closefile(ncid)

    filename = trim(exort_rootdir)//trim(dirk_ch4)//trim(k08_ch4_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k08_ch4)
    call pio_closefile(ncid)


    ! Load K coefficients, interval 9  
    filename = trim(exort_rootdir)//trim(dirk_h2o)//trim(k09_h2o_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k09_h2o)
    call pio_closefile(ncid)

    filename = trim(exort_rootdir)//trim(dirk_co2)//trim(k09_co2_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k09_co2)
    call pio_closefile(ncid)

    filename = trim(exort_rootdir)//trim(dirk_ch4)//trim(k09_ch4_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k07_ch4)
    call pio_closefile(ncid)


    ! Load K coefficients, interval 10  
    filename = trim(exort_rootdir)//trim(dirk_h2o)//trim(k10_h2o_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k10_h2o)
    call pio_closefile(ncid)

    filename = trim(exort_rootdir)//trim(dirk_co2)//trim(k10_co2_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k10_co2)
    call pio_closefile(ncid)

    filename = trim(exort_rootdir)//trim(dirk_ch4)//trim(k10_ch4_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k10_ch4)
    call pio_closefile(ncid)


    ! Load K coefficients, interval 11  
    filename = trim(exort_rootdir)//trim(dirk_h2o)//trim(k11_h2o_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k11_h2o)
    call pio_closefile(ncid)

    filename = trim(exort_rootdir)//trim(dirk_co2)//trim(k11_co2_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k11_co2)
    call pio_closefile(ncid)

    filename = trim(exort_rootdir)//trim(dirk_ch4)//trim(k11_ch4_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k11_ch4)
    call pio_closefile(ncid)


    ! Load K coefficients, interval 12  
    filename = trim(exort_rootdir)//trim(dirk_h2o)//trim(k12_h2o_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k12_h2o)
    call pio_closefile(ncid)

    filename = trim(exort_rootdir)//trim(dirk_co2)//trim(k12_co2_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k12_co2)
    call pio_closefile(ncid)

    filename = trim(exort_rootdir)//trim(dirk_ch4)//trim(k12_ch4_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k12_ch4)
    call pio_closefile(ncid)


    ! Load K coefficients, interval 13  
    filename = trim(exort_rootdir)//trim(dirk_h2o)//trim(k13_h2o_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k13_h2o)
    call pio_closefile(ncid)

    filename = trim(exort_rootdir)//trim(dirk_co2)//trim(k13_co2_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k13_co2)
    call pio_closefile(ncid)

    filename = trim(exort_rootdir)//trim(dirk_ch4)//trim(k13_ch4_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k13_ch4)
    call pio_closefile(ncid)


    ! Load K coefficients, interval 14  
    filename = trim(exort_rootdir)//trim(dirk_h2o)//trim(k14_h2o_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k14_h2o)
    call pio_closefile(ncid)

    filename = trim(exort_rootdir)//trim(dirk_co2)//trim(k14_co2_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k14_co2)
    call pio_closefile(ncid)

    filename = trim(exort_rootdir)//trim(dirk_ch4)//trim(k14_ch4_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k14_ch4)
    call pio_closefile(ncid)


    ! Load K coefficients, interval 15  
    filename = trim(exort_rootdir)//trim(dirk_h2o)//trim(k15_h2o_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k15_h2o)
    call pio_closefile(ncid)

    filename = trim(exort_rootdir)//trim(dirk_co2)//trim(k15_co2_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k15_co2)
    call pio_closefile(ncid)

    filename = trim(exort_rootdir)//trim(dirk_ch4)//trim(k15_ch4_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k15_ch4)
    call pio_closefile(ncid)


    ! Load K coefficients, interval 16  
    filename = trim(exort_rootdir)//trim(dirk_h2o)//trim(k16_h2o_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k16_h2o)
    call pio_closefile(ncid)

    filename = trim(exort_rootdir)//trim(dirk_co2)//trim(k16_co2_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k16_co2)
    call pio_closefile(ncid)

    filename = trim(exort_rootdir)//trim(dirk_ch4)//trim(k16_ch4_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k16_ch4)
    call pio_closefile(ncid)


    ! Load K coefficients, interval 17  
    filename = trim(exort_rootdir)//trim(dirk_h2o)//trim(k17_h2o_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k17_h2o)
    call pio_closefile(ncid)

    filename = trim(exort_rootdir)//trim(dirk_co2)//trim(k17_co2_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k17_co2)
    call pio_closefile(ncid)

    filename = trim(exort_rootdir)//trim(dirk_ch4)//trim(k17_ch4_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k17_ch4)
    call pio_closefile(ncid)


    ! Load K coefficients, interval 18  
    filename = trim(exort_rootdir)//trim(dirk_h2o)//trim(k18_h2o_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k18_h2o)
    call pio_closefile(ncid)

    filename = trim(exort_rootdir)//trim(dirk_co2)//trim(k18_co2_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k18_co2)
    call pio_closefile(ncid)

    filename = trim(exort_rootdir)//trim(dirk_ch4)//trim(k18_ch4_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k18_ch4)
    call pio_closefile(ncid)


    ! Load K coefficients, interval 19  
    filename = trim(exort_rootdir)//trim(dirk_h2o)//trim(k19_h2o_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k19_h2o)
    call pio_closefile(ncid)

    filename = trim(exort_rootdir)//trim(dirk_co2)//trim(k19_co2_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k19_co2)
    call pio_closefile(ncid)

    filename = trim(exort_rootdir)//trim(dirk_ch4)//trim(k19_ch4_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k19_ch4)
    call pio_closefile(ncid)


    ! Load K coefficients, interval 20  
    filename = trim(exort_rootdir)//trim(dirk_h2o)//trim(k20_h2o_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k20_h2o)
    call pio_closefile(ncid)

    filename = trim(exort_rootdir)//trim(dirk_co2)//trim(k20_co2_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k20_co2)
    call pio_closefile(ncid)

    filename = trim(exort_rootdir)//trim(dirk_ch4)//trim(k20_ch4_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k20_ch4)
    call pio_closefile(ncid)


    ! Load K coefficients, interval 21  
    filename = trim(exort_rootdir)//trim(dirk_h2o)//trim(k21_h2o_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k21_h2o)
    call pio_closefile(ncid)

    filename = trim(exort_rootdir)//trim(dirk_co2)//trim(k21_co2_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k21_co2)
    call pio_closefile(ncid)

    filename = trim(exort_rootdir)//trim(dirk_ch4)//trim(k21_ch4_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k21_ch4)
    call pio_closefile(ncid)


    ! Load K coefficients, interval 22  
    filename = trim(exort_rootdir)//trim(dirk_h2o)//trim(k22_h2o_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k22_h2o)
    call pio_closefile(ncid)

    filename = trim(exort_rootdir)//trim(dirk_co2)//trim(k22_co2_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k22_co2)
    call pio_closefile(ncid)

    filename = trim(exort_rootdir)//trim(dirk_ch4)//trim(k22_ch4_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k22_ch4)
    call pio_closefile(ncid)


    ! Load K coefficients, interval 23  
    filename = trim(exort_rootdir)//trim(dirk_h2o)//trim(k23_h2o_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k23_h2o)
    call pio_closefile(ncid)

    filename = trim(exort_rootdir)//trim(dirk_co2)//trim(k23_co2_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k23_co2)
    call pio_closefile(ncid)

    filename = trim(exort_rootdir)//trim(dirk_ch4)//trim(k23_ch4_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k23_ch4)
    call pio_closefile(ncid)


    ! Load K coefficients, interval 24  
    filename = trim(exort_rootdir)//trim(dirk_h2o)//trim(k24_h2o_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k24_h2o)
    call pio_closefile(ncid)

    filename = trim(exort_rootdir)//trim(dirk_co2)//trim(k24_co2_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k24_co2)
    call pio_closefile(ncid)

    filename = trim(exort_rootdir)//trim(dirk_ch4)//trim(k24_ch4_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k24_ch4)
    call pio_closefile(ncid)


    ! Load K coefficients, interval 25  
    filename = trim(exort_rootdir)//trim(dirk_h2o)//trim(k25_h2o_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k25_h2o)
    call pio_closefile(ncid)

    filename = trim(exort_rootdir)//trim(dirk_co2)//trim(k25_co2_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k25_co2)
    call pio_closefile(ncid)

    filename = trim(exort_rootdir)//trim(dirk_ch4)//trim(k25_ch4_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k25_ch4)
    call pio_closefile(ncid)


    ! Load K coefficients, interval 26  
    filename = trim(exort_rootdir)//trim(dirk_h2o)//trim(k26_h2o_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k26_h2o)
    call pio_closefile(ncid)

    filename = trim(exort_rootdir)//trim(dirk_co2)//trim(k26_co2_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k26_co2)
    call pio_closefile(ncid)

    filename = trim(exort_rootdir)//trim(dirk_ch4)//trim(k26_ch4_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k26_ch4)
    call pio_closefile(ncid)


    ! Load K coefficients, interval 27  
    filename = trim(exort_rootdir)//trim(dirk_h2o)//trim(k27_h2o_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k27_h2o)
    call pio_closefile(ncid)

    filename = trim(exort_rootdir)//trim(dirk_co2)//trim(k27_co2_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k27_co2)
    call pio_closefile(ncid)

    filename = trim(exort_rootdir)//trim(dirk_ch4)//trim(k27_ch4_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k27_ch4)
    call pio_closefile(ncid)


    ! Load K coefficients, interval 28  
    filename = trim(exort_rootdir)//trim(dirk_h2o)//trim(k28_h2o_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k28_h2o)
    call pio_closefile(ncid)

    filename = trim(exort_rootdir)//trim(dirk_co2)//trim(k28_co2_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k28_co2)
    call pio_closefile(ncid)

    filename = trim(exort_rootdir)//trim(dirk_ch4)//trim(k28_ch4_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k28_ch4)
    call pio_closefile(ncid)


    ! Load K coefficients, interval 29  
    filename = trim(exort_rootdir)//trim(dirk_h2o)//trim(k29_h2o_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k29_h2o)
    call pio_closefile(ncid)

    filename = trim(exort_rootdir)//trim(dirk_co2)//trim(k29_co2_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k29_co2)
    call pio_closefile(ncid)

    filename = trim(exort_rootdir)//trim(dirk_ch4)//trim(k29_ch4_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k29_ch4)
    call pio_closefile(ncid)


    ! Load K coefficients, interval 30  
    filename = trim(exort_rootdir)//trim(dirk_h2o)//trim(k30_h2o_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k30_h2o)
    call pio_closefile(ncid)

    filename = trim(exort_rootdir)//trim(dirk_co2)//trim(k30_co2_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k30_co2)
    call pio_closefile(ncid)

    filename = trim(exort_rootdir)//trim(dirk_ch4)//trim(k30_ch4_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k30_ch4)
    call pio_closefile(ncid)


    ! Load K coefficients, interval 31  
    filename = trim(exort_rootdir)//trim(dirk_h2o)//trim(k31_h2o_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k31_h2o)
    call pio_closefile(ncid)

    filename = trim(exort_rootdir)//trim(dirk_co2)//trim(k31_co2_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k31_co2)
    call pio_closefile(ncid)

    filename = trim(exort_rootdir)//trim(dirk_ch4)//trim(k31_ch4_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k31_ch4)
    call pio_closefile(ncid)


    ! Load K coefficients, interval 32  
    filename = trim(exort_rootdir)//trim(dirk_h2o)//trim(k32_h2o_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k32_h2o)
    call pio_closefile(ncid)

    filename = trim(exort_rootdir)//trim(dirk_co2)//trim(k32_co2_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k32_co2)
    call pio_closefile(ncid)

    filename = trim(exort_rootdir)//trim(dirk_ch4)//trim(k32_ch4_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k32_ch4)
    call pio_closefile(ncid)


    ! Load K coefficients, interval 33  
    filename = trim(exort_rootdir)//trim(dirk_h2o)//trim(k33_h2o_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k33_h2o)
    call pio_closefile(ncid)

    filename = trim(exort_rootdir)//trim(dirk_co2)//trim(k33_co2_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k33_co2)
    call pio_closefile(ncid)

    filename = trim(exort_rootdir)//trim(dirk_ch4)//trim(k33_ch4_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k33_ch4)
    call pio_closefile(ncid)


    ! Load K coefficients, interval 34  
    filename = trim(exort_rootdir)//trim(dirk_h2o)//trim(k34_h2o_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k34_h2o)
    call pio_closefile(ncid)

    filename = trim(exort_rootdir)//trim(dirk_co2)//trim(k34_co2_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k34_co2)
    call pio_closefile(ncid)

    filename = trim(exort_rootdir)//trim(dirk_ch4)//trim(k34_ch4_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k34_ch4)
    call pio_closefile(ncid)


    ! Load K coefficients, interval 35  
    filename = trim(exort_rootdir)//trim(dirk_h2o)//trim(k35_h2o_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k35_h2o)
    call pio_closefile(ncid)

    filename = trim(exort_rootdir)//trim(dirk_co2)//trim(k35_co2_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k35_co2)
    call pio_closefile(ncid)

    filename = trim(exort_rootdir)//trim(dirk_ch4)//trim(k35_ch4_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k35_ch4)
    call pio_closefile(ncid)


    ! Load K coefficients, interval 36  
    filename = trim(exort_rootdir)//trim(dirk_h2o)//trim(k36_h2o_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k36_h2o)
    call pio_closefile(ncid)

    filename = trim(exort_rootdir)//trim(dirk_co2)//trim(k36_co2_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k36_co2)
    call pio_closefile(ncid)

    filename = trim(exort_rootdir)//trim(dirk_ch4)//trim(k36_ch4_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k36_ch4)
    call pio_closefile(ncid)


    ! Load K coefficients, interval 37  
    filename = trim(exort_rootdir)//trim(dirk_h2o)//trim(k37_h2o_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k37_h2o)
    call pio_closefile(ncid)

    filename = trim(exort_rootdir)//trim(dirk_co2)//trim(k37_co2_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k37_co2)
    call pio_closefile(ncid)

    filename = trim(exort_rootdir)//trim(dirk_ch4)//trim(k37_ch4_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k37_ch4)
    call pio_closefile(ncid)


    ! Load K coefficients, interval 38  
    filename = trim(exort_rootdir)//trim(dirk_h2o)//trim(k38_h2o_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k38_h2o)
    call pio_closefile(ncid)

    filename = trim(exort_rootdir)//trim(dirk_co2)//trim(k38_co2_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k38_co2)
    call pio_closefile(ncid)

    filename = trim(exort_rootdir)//trim(dirk_ch4)//trim(k38_ch4_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k38_ch4)
    call pio_closefile(ncid)


    ! Load K coefficients, interval 39  
     filename = trim(exort_rootdir)//trim(dirk_h2o)//trim(k39_h2o_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k39_h2o)
    call pio_closefile(ncid)

    filename = trim(exort_rootdir)//trim(dirk_co2)//trim(k39_co2_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k39_co2)
    call pio_closefile(ncid)

    filename = trim(exort_rootdir)//trim(dirk_ch4)//trim(k39_ch4_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k39_ch4)
    call pio_closefile(ncid)


    ! Load K coefficients, interval 40  
    filename = trim(exort_rootdir)//trim(dirk_h2o)//trim(k40_h2o_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k40_h2o)
    call pio_closefile(ncid)

    filename = trim(exort_rootdir)//trim(dirk_co2)//trim(k40_co2_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k40_co2)
    call pio_closefile(ncid)

    filename = trim(exort_rootdir)//trim(dirk_ch4)//trim(k40_ch4_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k40_ch4)
    call pio_closefile(ncid)


    ! Load K coefficients, interval 41  
    filename = trim(exort_rootdir)//trim(dirk_h2o)//trim(k41_h2o_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k41_h2o)
    call pio_closefile(ncid)

    filename = trim(exort_rootdir)//trim(dirk_co2)//trim(k41_co2_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k41_co2)
    call pio_closefile(ncid)

    filename = trim(exort_rootdir)//trim(dirk_ch4)//trim(k41_ch4_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k41_ch4)
    call pio_closefile(ncid)


    ! Load K coefficients, interval 42  
    filename = trim(exort_rootdir)//trim(dirk_h2o)//trim(k42_h2o_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k42_h2o)
    call pio_closefile(ncid)

    filename = trim(exort_rootdir)//trim(dirk_co2)//trim(k42_co2_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k42_co2)
    call pio_closefile(ncid)

    filename = trim(exort_rootdir)//trim(dirk_ch4)//trim(k42_ch4_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k42_ch4)
    call pio_closefile(ncid)


    ! Load K coefficients, interval 43  
    filename = trim(exort_rootdir)//trim(dirk_h2o)//trim(k43_h2o_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k43_h2o)
    call pio_closefile(ncid)

    filename = trim(exort_rootdir)//trim(dirk_co2)//trim(k43_co2_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k43_co2)
    call pio_closefile(ncid)

    filename = trim(exort_rootdir)//trim(dirk_ch4)//trim(k43_ch4_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k43_ch4)
    call pio_closefile(ncid)


    ! Load K coefficients, interval 44  
    filename = trim(exort_rootdir)//trim(dirk_h2o)//trim(k44_h2o_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k44_h2o)
    call pio_closefile(ncid)

    filename = trim(exort_rootdir)//trim(dirk_co2)//trim(k44_co2_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k44_co2)
    call pio_closefile(ncid)

    filename = trim(exort_rootdir)//trim(dirk_ch4)//trim(k44_ch4_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k44_ch4)
    call pio_closefile(ncid)


    ! Load K coefficients, interval 45  
    filename = trim(exort_rootdir)//trim(dirk_h2o)//trim(k45_h2o_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k45_h2o)
    call pio_closefile(ncid)

    filename = trim(exort_rootdir)//trim(dirk_co2)//trim(k45_co2_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k45_co2)
    call pio_closefile(ncid)

    filename = trim(exort_rootdir)//trim(dirk_ch4)//trim(k45_ch4_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k45_ch4)
    call pio_closefile(ncid)


    ! Load K coefficients, interval 46  
    filename = trim(exort_rootdir)//trim(dirk_h2o)//trim(k46_h2o_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k46_h2o)
    call pio_closefile(ncid)

    filename = trim(exort_rootdir)//trim(dirk_co2)//trim(k46_co2_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k46_co2)
    call pio_closefile(ncid)

    filename = trim(exort_rootdir)//trim(dirk_ch4)//trim(k46_ch4_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k46_ch4)
    call pio_closefile(ncid)


    ! Load K coefficients, interval 47  
    filename = trim(exort_rootdir)//trim(dirk_h2o)//trim(k47_h2o_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k47_h2o)
    call pio_closefile(ncid)

    filename = trim(exort_rootdir)//trim(dirk_co2)//trim(k47_co2_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k47_co2)
    call pio_closefile(ncid)

    filename = trim(exort_rootdir)//trim(dirk_ch4)//trim(k47_ch4_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k47_ch4)
    call pio_closefile(ncid)


    ! Load K coefficients, interval 48  
    filename = trim(exort_rootdir)//trim(dirk_h2o)//trim(k48_h2o_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k48_h2o)
    call pio_closefile(ncid)

    filename = trim(exort_rootdir)//trim(dirk_co2)//trim(k48_co2_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k48_co2)
    call pio_closefile(ncid)

    filename = trim(exort_rootdir)//trim(dirk_ch4)//trim(k48_ch4_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k48_ch4)
    call pio_closefile(ncid)


    ! Load K coefficients, interval 49  
    filename = trim(exort_rootdir)//trim(dirk_h2o)//trim(k49_h2o_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k49_h2o)
    call pio_closefile(ncid)

    filename = trim(exort_rootdir)//trim(dirk_co2)//trim(k49_co2_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k49_co2)
    call pio_closefile(ncid)

    filename = trim(exort_rootdir)//trim(dirk_ch4)//trim(k49_ch4_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k49_ch4)
    call pio_closefile(ncid)


    ! Load K coefficients, interval 50  
    filename = trim(exort_rootdir)//trim(dirk_h2o)//trim(k50_h2o_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k50_h2o)
    call pio_closefile(ncid)

    filename = trim(exort_rootdir)//trim(dirk_co2)//trim(k50_co2_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k50_co2)
    call pio_closefile(ncid)

    filename = trim(exort_rootdir)//trim(dirk_ch4)//trim(k50_ch4_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k50_ch4)
    call pio_closefile(ncid)


    ! Load K coefficients, interval 51  
    filename = trim(exort_rootdir)//trim(dirk_h2o)//trim(k51_h2o_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k51_h2o)
    call pio_closefile(ncid)

    filename = trim(exort_rootdir)//trim(dirk_co2)//trim(k51_co2_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k51_co2)
    call pio_closefile(ncid)

    filename = trim(exort_rootdir)//trim(dirk_ch4)//trim(k51_ch4_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k51_ch4)
    call pio_closefile(ncid)


    ! Load K coefficients, interval 52  
    filename = trim(exort_rootdir)//trim(dirk_h2o)//trim(k52_h2o_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k52_h2o)
    call pio_closefile(ncid)

    filename = trim(exort_rootdir)//trim(dirk_co2)//trim(k52_co2_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k52_co2)
    call pio_closefile(ncid)

    filename = trim(exort_rootdir)//trim(dirk_ch4)//trim(k52_ch4_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k52_ch4)
    call pio_closefile(ncid)


    ! Load K coefficients, interval 53  
    filename = trim(exort_rootdir)//trim(dirk_h2o)//trim(k53_h2o_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k53_h2o)
    call pio_closefile(ncid)

    filename = trim(exort_rootdir)//trim(dirk_co2)//trim(k53_co2_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k53_co2)
    call pio_closefile(ncid)

    filename = trim(exort_rootdir)//trim(dirk_ch4)//trim(k53_ch4_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k53_ch4)
    call pio_closefile(ncid)


    ! Load K coefficients, interval 54  
    filename = trim(exort_rootdir)//trim(dirk_h2o)//trim(k54_h2o_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k54_h2o)
    call pio_closefile(ncid)

    filename = trim(exort_rootdir)//trim(dirk_co2)//trim(k54_co2_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k54_co2)
    call pio_closefile(ncid)

    filename = trim(exort_rootdir)//trim(dirk_ch4)//trim(k54_ch4_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k54_ch4)
    call pio_closefile(ncid)


    ! Load K coefficients, interval 55  
    filename = trim(exort_rootdir)//trim(dirk_h2o)//trim(k55_h2o_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k55_h2o)
    call pio_closefile(ncid)

    filename = trim(exort_rootdir)//trim(dirk_co2)//trim(k55_co2_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k55_co2)
    call pio_closefile(ncid)

    filename = trim(exort_rootdir)//trim(dirk_ch4)//trim(k55_ch4_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k55_ch4)
    call pio_closefile(ncid)


    ! Load K coefficients, interval 56  
    filename = trim(exort_rootdir)//trim(dirk_h2o)//trim(k56_h2o_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k56_h2o)
    call pio_closefile(ncid)

    filename = trim(exort_rootdir)//trim(dirk_co2)//trim(k56_co2_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k56_co2)
    call pio_closefile(ncid)

    filename = trim(exort_rootdir)//trim(dirk_ch4)//trim(k56_ch4_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k56_ch4)
    call pio_closefile(ncid)


    ! Load K coefficients, interval 57  
    filename = trim(exort_rootdir)//trim(dirk_h2o)//trim(k57_h2o_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k57_h2o)
    call pio_closefile(ncid)

    filename = trim(exort_rootdir)//trim(dirk_co2)//trim(k57_co2_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k57_co2)
    call pio_closefile(ncid)

    filename = trim(exort_rootdir)//trim(dirk_ch4)//trim(k57_ch4_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k57_ch4)
    call pio_closefile(ncid)


    ! Load K coefficients, interval 58  
    filename = trim(exort_rootdir)//trim(dirk_h2o)//trim(k58_h2o_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k58_h2o)
    call pio_closefile(ncid)

    filename = trim(exort_rootdir)//trim(dirk_co2)//trim(k58_co2_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k58_co2)
    call pio_closefile(ncid)

    filename = trim(exort_rootdir)//trim(dirk_ch4)//trim(k58_ch4_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k58_ch4)
    call pio_closefile(ncid)


    ! Load K coefficients, interval 59  
    filename = trim(exort_rootdir)//trim(dirk_h2o)//trim(k59_h2o_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k59_h2o)
    call pio_closefile(ncid)

    filename = trim(exort_rootdir)//trim(dirk_co2)//trim(k59_co2_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k59_co2)
    call pio_closefile(ncid)

    filename = trim(exort_rootdir)//trim(dirk_ch4)//trim(k59_ch4_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k59_ch4)
    call pio_closefile(ncid)


    ! Load K coefficients, interval 60  
    filename = trim(exort_rootdir)//trim(dirk_h2o)//trim(k60_h2o_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k60_h2o)
    call pio_closefile(ncid)

    filename = trim(exort_rootdir)//trim(dirk_co2)//trim(k60_co2_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k60_co2)
    call pio_closefile(ncid)

    filename = trim(exort_rootdir)//trim(dirk_ch4)//trim(k60_ch4_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k60_ch4)
    call pio_closefile(ncid)

    ! Load K coefficients, interval 61  
    filename = trim(exort_rootdir)//trim(dirk_h2o)//trim(k61_h2o_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k61_h2o)
    call pio_closefile(ncid)

    filename = trim(exort_rootdir)//trim(dirk_co2)//trim(k61_co2_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k61_co2)
    call pio_closefile(ncid)

    filename = trim(exort_rootdir)//trim(dirk_ch4)//trim(k61_ch4_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k61_ch4)
    call pio_closefile(ncid)


    ! Load K coefficients, interval 62  
    filename = trim(exort_rootdir)//trim(dirk_h2o)//trim(k62_h2o_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k62_h2o)
    call pio_closefile(ncid)

    filename = trim(exort_rootdir)//trim(dirk_co2)//trim(k62_co2_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k62_co2)
    call pio_closefile(ncid)

    filename = trim(exort_rootdir)//trim(dirk_ch4)//trim(k62_ch4_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k62_ch4)
    call pio_closefile(ncid)


    ! Load K coefficients, interval 63  
    filename = trim(exort_rootdir)//trim(dirk_h2o)//trim(k63_h2o_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k63_h2o)
    call pio_closefile(ncid)

    filename = trim(exort_rootdir)//trim(dirk_co2)//trim(k63_co2_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k63_co2)
    call pio_closefile(ncid)

    filename = trim(exort_rootdir)//trim(dirk_ch4)//trim(k63_ch4_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k63_ch4)
    call pio_closefile(ncid)


    ! Load K coefficients, interval 64  
    filename = trim(exort_rootdir)//trim(dirk_h2o)//trim(k64_h2o_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k64_h2o)
    call pio_closefile(ncid)

    filename = trim(exort_rootdir)//trim(dirk_co2)//trim(k64_co2_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k64_co2)
    call pio_closefile(ncid)

    filename = trim(exort_rootdir)//trim(dirk_ch4)//trim(k64_ch4_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k64_ch4)
    call pio_closefile(ncid)


    ! Load K coefficients, interval 65  
    filename = trim(exort_rootdir)//trim(dirk_h2o)//trim(k65_h2o_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k65_h2o)
    call pio_closefile(ncid)

    filename = trim(exort_rootdir)//trim(dirk_co2)//trim(k65_co2_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k65_co2)
    call pio_closefile(ncid)

    filename = trim(exort_rootdir)//trim(dirk_ch4)//trim(k65_ch4_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k65_ch4)
    call pio_closefile(ncid)


    ! Load K coefficients, interval 66  
    filename = trim(exort_rootdir)//trim(dirk_h2o)//trim(k66_h2o_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k66_h2o)
    call pio_closefile(ncid)

    filename = trim(exort_rootdir)//trim(dirk_co2)//trim(k66_co2_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k66_co2)
    call pio_closefile(ncid)

    filename = trim(exort_rootdir)//trim(dirk_ch4)//trim(k66_ch4_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k66_ch4)
    call pio_closefile(ncid)


    ! Load K coefficients, interval 67  
    filename = trim(exort_rootdir)//trim(dirk_h2o)//trim(k67_h2o_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k67_h2o)
    call pio_closefile(ncid)

    filename = trim(exort_rootdir)//trim(dirk_co2)//trim(k67_co2_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k67_co2)
    call pio_closefile(ncid)

    filename = trim(exort_rootdir)//trim(dirk_ch4)//trim(k67_ch4_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k67_ch4)
    call pio_closefile(ncid)


    ! Load K coefficients, interval 68  
    filename = trim(exort_rootdir)//trim(dirk_h2o)//trim(k68_h2o_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k68_h2o)
    call pio_closefile(ncid)

    filename = trim(exort_rootdir)//trim(dirk_co2)//trim(k68_co2_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k68_co2)
    call pio_closefile(ncid)

    filename = trim(exort_rootdir)//trim(dirk_ch4)//trim(k68_ch4_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'data',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, k68_ch4)
    call pio_closefile(ncid)


    !! Load mtckd h2o self continuum
    filename = trim(exort_rootdir)//trim(dirct)//trim(kh2oself_mtckd_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'KSELF',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, kh2oself_mtckd)
    call pio_closefile(ncid)
    !! mtckd                         

    !! Load bps h2o vapor self continuum
!    filename = trim(exort_rootdir)//trim(dirct)//trim(kh2oself_bps_file)
!    call getfil(filename, locfn, 0)
!    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
!    ierr =  pio_inq_varid(ncid, 'self',   keff_id)
!    ierr =  pio_get_var(ncid, keff_id, self)
!    ierr =  pio_inq_varid(ncid, 'foreign',   keff_id)
!    ierr =  pio_get_var(ncid, keff_id, foreign)
!    ierr =  pio_inq_varid(ncid, 'base_self',   keff_id)
!    ierr =  pio_get_var(ncid, keff_id, base_self)
!    ierr =  pio_inq_varid(ncid, 'base_foreign',   keff_id)
!    ierr =  pio_get_var(ncid, keff_id, base_foreign)
!    ierr =  pio_inq_varid(ncid, 'TempCoeff',   keff_id)
!    ierr =  pio_get_var(ncid, keff_id, TempCoeff)
!    call pio_closefile(ncid)

    ! Load K coefficients, for n2n2 continuum
    filename = trim(exort_rootdir)//trim(dirci)//trim(kn2n2cia_file )
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'sigma',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, kn2n2)
    call pio_closefile(ncid)

    ! Load K coefficients, for n2h2 continuum 
    filename = trim(exort_rootdir)//trim(dirci)//trim(kn2h2cia_file )
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'sigma',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, kn2h2)
    call pio_closefile(ncid)

    ! Load K coefficients, for h2h2 continuum
    filename = trim(exort_rootdir)//trim(dirci)//trim(kh2h2cia_file )
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'sigma',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, kh2h2)
    call pio_closefile(ncid)

    ! Load K coefficients, for co2co2 lw continuum
    filename = trim(exort_rootdir)//trim(dirci)//trim(kco2co2cia_lw_file )
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'sigma',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, kco2co2_lw)
    call pio_closefile(ncid)

    ! Load K coefficients, for co2co2 sw continuum
    filename = trim(exort_rootdir)//trim(dirci)//trim(kco2co2cia_sw_file )
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'sigma',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, kco2co2_sw)
    call pio_closefile(ncid)

    ! Load K coefficients, for co2h2 continuum
    filename = trim(exort_rootdir)//trim(dirci)//trim(kco2h2cia_file )
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'sigma',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, kco2h2)
    call pio_closefile(ncid)

    ! Load K coefficients, for co2h4 continuum
    filename = trim(exort_rootdir)//trim(dirci)//trim(kco2ch4cia_file )
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'sigma',   keff_id)
    ierr =  pio_get_var(ncid, keff_id, kco2ch4)
    call pio_closefile(ncid)

  
! broadcast optical constants to all nodes
#if ( defined SPMD )
    call mpibcast(k01_h2o, ngauss_pts(1)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k02_h2o, ngauss_pts(2)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k03_h2o, ngauss_pts(3)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k04_h2o, ngauss_pts(4)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k05_h2o, ngauss_pts(5)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k06_h2o, ngauss_pts(6)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k07_h2o, ngauss_pts(7)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k08_h2o, ngauss_pts(8)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k09_h2o, ngauss_pts(9)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k10_h2o, ngauss_pts(10)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k11_h2o, ngauss_pts(11)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k12_h2o, ngauss_pts(12)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k13_h2o, ngauss_pts(13)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k14_h2o, ngauss_pts(14)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k15_h2o, ngauss_pts(15)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k16_h2o, ngauss_pts(16)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k17_h2o, ngauss_pts(17)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k18_h2o, ngauss_pts(18)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k19_h2o, ngauss_pts(19)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k20_h2o, ngauss_pts(20)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k21_h2o, ngauss_pts(21)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k22_h2o, ngauss_pts(22)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k23_h2o, ngauss_pts(23)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k24_h2o, ngauss_pts(24)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k25_h2o, ngauss_pts(25)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k26_h2o, ngauss_pts(26)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k27_h2o, ngauss_pts(27)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k28_h2o, ngauss_pts(28)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k29_h2o, ngauss_pts(29)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k30_h2o, ngauss_pts(30)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k31_h2o, ngauss_pts(31)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k32_h2o, ngauss_pts(32)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k33_h2o, ngauss_pts(33)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k34_h2o, ngauss_pts(34)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k35_h2o, ngauss_pts(35)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k36_h2o, ngauss_pts(36)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k37_h2o, ngauss_pts(37)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k38_h2o, ngauss_pts(38)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k39_h2o, ngauss_pts(39)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k40_h2o, ngauss_pts(40)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k41_h2o, ngauss_pts(41)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k42_h2o, ngauss_pts(42)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k43_h2o, ngauss_pts(43)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k44_h2o, ngauss_pts(44)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k45_h2o, ngauss_pts(45)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k46_h2o, ngauss_pts(46)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k47_h2o, ngauss_pts(47)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k48_h2o, ngauss_pts(48)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k49_h2o, ngauss_pts(49)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k50_h2o, ngauss_pts(50)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k51_h2o, ngauss_pts(51)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k52_h2o, ngauss_pts(52)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k53_h2o, ngauss_pts(53)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k54_h2o, ngauss_pts(54)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k55_h2o, ngauss_pts(55)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k56_h2o, ngauss_pts(56)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k57_h2o, ngauss_pts(57)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k58_h2o, ngauss_pts(58)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k59_h2o, ngauss_pts(59)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k60_h2o, ngauss_pts(60)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k61_h2o, ngauss_pts(61)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k62_h2o, ngauss_pts(62)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k63_h2o, ngauss_pts(63)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k64_h2o, ngauss_pts(64)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k65_h2o, ngauss_pts(65)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k66_h2o, ngauss_pts(66)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k67_h2o, ngauss_pts(67)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k68_h2o, ngauss_pts(68)*kc_npress*kc_ntemp, mpir8, 0, mpicom)

    call mpibcast(k01_co2, ngauss_pts(1)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k02_co2, ngauss_pts(2)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k03_co2, ngauss_pts(3)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k04_co2, ngauss_pts(4)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k05_co2, ngauss_pts(5)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k06_co2, ngauss_pts(6)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k07_co2, ngauss_pts(7)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k08_co2, ngauss_pts(8)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k09_co2, ngauss_pts(9)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k10_co2, ngauss_pts(10)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k11_co2, ngauss_pts(11)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k12_co2, ngauss_pts(12)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k13_co2, ngauss_pts(13)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k14_co2, ngauss_pts(14)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k15_co2, ngauss_pts(15)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k16_co2, ngauss_pts(16)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k17_co2, ngauss_pts(17)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k18_co2, ngauss_pts(18)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k19_co2, ngauss_pts(19)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k20_co2, ngauss_pts(20)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k21_co2, ngauss_pts(21)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k22_co2, ngauss_pts(22)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k23_co2, ngauss_pts(23)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k24_co2, ngauss_pts(24)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k25_co2, ngauss_pts(25)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k26_co2, ngauss_pts(26)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k27_co2, ngauss_pts(27)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k28_co2, ngauss_pts(28)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k29_co2, ngauss_pts(29)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k30_co2, ngauss_pts(30)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k31_co2, ngauss_pts(31)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k32_co2, ngauss_pts(32)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k33_co2, ngauss_pts(33)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k34_co2, ngauss_pts(34)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k35_co2, ngauss_pts(35)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k36_co2, ngauss_pts(36)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k37_co2, ngauss_pts(37)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k38_co2, ngauss_pts(38)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k39_co2, ngauss_pts(39)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k40_co2, ngauss_pts(40)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k41_co2, ngauss_pts(41)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k42_co2, ngauss_pts(42)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k43_co2, ngauss_pts(43)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k44_co2, ngauss_pts(44)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k45_co2, ngauss_pts(45)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k46_co2, ngauss_pts(46)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k47_co2, ngauss_pts(47)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k48_co2, ngauss_pts(48)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k49_co2, ngauss_pts(49)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k50_co2, ngauss_pts(50)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k51_co2, ngauss_pts(51)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k52_co2, ngauss_pts(52)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k53_co2, ngauss_pts(53)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k54_co2, ngauss_pts(54)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k55_co2, ngauss_pts(55)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k56_co2, ngauss_pts(56)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k57_co2, ngauss_pts(57)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k58_co2, ngauss_pts(58)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k59_co2, ngauss_pts(59)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k60_co2, ngauss_pts(60)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k61_co2, ngauss_pts(61)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k62_co2, ngauss_pts(62)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k63_co2, ngauss_pts(63)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k64_co2, ngauss_pts(64)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k65_co2, ngauss_pts(65)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k66_co2, ngauss_pts(66)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k67_co2, ngauss_pts(67)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k68_co2, ngauss_pts(68)*kc_npress*kc_ntemp, mpir8, 0, mpicom)

    call mpibcast(k01_ch4, ngauss_pts(1)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k02_ch4, ngauss_pts(2)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k03_ch4, ngauss_pts(3)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k04_ch4, ngauss_pts(4)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k05_ch4, ngauss_pts(5)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k06_ch4, ngauss_pts(6)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k07_ch4, ngauss_pts(7)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k08_ch4, ngauss_pts(8)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k09_ch4, ngauss_pts(9)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k10_ch4, ngauss_pts(10)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k11_ch4, ngauss_pts(11)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k12_ch4, ngauss_pts(12)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k13_ch4, ngauss_pts(13)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k14_ch4, ngauss_pts(14)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k15_ch4, ngauss_pts(15)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k16_ch4, ngauss_pts(16)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k17_ch4, ngauss_pts(17)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k18_ch4, ngauss_pts(18)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k19_ch4, ngauss_pts(19)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k20_ch4, ngauss_pts(20)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k21_ch4, ngauss_pts(21)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k22_ch4, ngauss_pts(22)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k23_ch4, ngauss_pts(23)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k24_ch4, ngauss_pts(24)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k25_ch4, ngauss_pts(25)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k26_ch4, ngauss_pts(26)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k27_ch4, ngauss_pts(27)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k28_ch4, ngauss_pts(28)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k29_ch4, ngauss_pts(29)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k30_ch4, ngauss_pts(30)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k31_ch4, ngauss_pts(31)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k32_ch4, ngauss_pts(32)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k33_ch4, ngauss_pts(33)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k34_ch4, ngauss_pts(34)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k35_ch4, ngauss_pts(35)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k36_ch4, ngauss_pts(36)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k37_ch4, ngauss_pts(37)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k38_ch4, ngauss_pts(38)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k39_ch4, ngauss_pts(39)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k40_ch4, ngauss_pts(40)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k41_ch4, ngauss_pts(41)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k42_ch4, ngauss_pts(42)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k43_ch4, ngauss_pts(43)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k44_ch4, ngauss_pts(44)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k45_ch4, ngauss_pts(45)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k46_ch4, ngauss_pts(46)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k47_ch4, ngauss_pts(47)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k48_ch4, ngauss_pts(48)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k49_ch4, ngauss_pts(49)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k50_ch4, ngauss_pts(50)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k51_ch4, ngauss_pts(51)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k52_ch4, ngauss_pts(52)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k53_ch4, ngauss_pts(53)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k54_ch4, ngauss_pts(54)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k55_ch4, ngauss_pts(55)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k56_ch4, ngauss_pts(56)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k57_ch4, ngauss_pts(57)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k58_ch4, ngauss_pts(58)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k59_ch4, ngauss_pts(59)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k60_ch4, ngauss_pts(60)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k61_ch4, ngauss_pts(61)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k62_ch4, ngauss_pts(62)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k63_ch4, ngauss_pts(63)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k64_ch4, ngauss_pts(64)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k65_ch4, ngauss_pts(65)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k66_ch4, ngauss_pts(66)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k67_ch4, ngauss_pts(67)*kc_npress*kc_ntemp, mpir8, 0, mpicom)
    call mpibcast(k68_ch4, ngauss_pts(68)*kc_npress*kc_ntemp, mpir8, 0, mpicom)

    call mpibcast(kh2oself_mtckd, ntot_wavlnrng*ks_ntemp, mpir8, 0, mpicom)

    call mpibcast(kn2n2, ntot_wavlnrng*kn2n2_ntemp, mpir8, 0, mpicom)
    call mpibcast(kn2h2, ntot_wavlnrng*kn2h2_ntemp, mpir8, 0, mpicom)
    call mpibcast(kh2h2, ntot_wavlnrng*kh2h2_ntemp, mpir8, 0, mpicom)

    call mpibcast(kco2co2_sw, ntot_wavlnrng*kco2co2_sw_ntemp, mpir8, 0, mpicom)
    call mpibcast(kco2co2_lw, ntot_wavlnrng*kco2co2_lw_ntemp, mpir8, 0, mpicom)
    call mpibcast(kco2h2, ntot_wavlnrng*kco2h2_ntemp, mpir8, 0, mpicom)
    call mpibcast(kco2ch4, ntot_wavlnrng*kco2ch4_ntemp, mpir8, 0, mpicom)

#endif


  end subroutine initialize_kcoeff


!============================================================================

  subroutine initialize_solar

!------------------------------------------------------------------------
!
! Purpose:  Initialize solar data from input file.
!
!------------------------------------------------------------------------
!
#if ( defined SPMD)
  use mpishorthand
#endif

    use ioFileMod, only: getfil
    use cam_pio_utils, only: cam_pio_openfile
    use pio,  only: pio_inq_varid, pio_get_var, pio_closefile, pio_nowrite,  &
                    file_desc_t, var_desc_t, pio_inq_dimid, pio_inquire_dimension

    implicit none
    include 'netcdf.inc'

!------------------------------------------------------------------------
!
! Local Variables
!
    type(file_desc_t) :: ncid
    character(len=256) :: locfn
    integer :: solarflux_id
    integer :: S0_id
    integer :: ierr

    if (masterproc) then
        write(6,*) "INITIALIZING SOLAR SPECTRAL FILE"
    endif     

    ! Load solar data
    call getfil(solar_file, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
    ierr =  pio_inq_varid(ncid, 'S0',   S0_id)
    ierr =  pio_get_var(ncid, S0_id, S0)
    ierr =  pio_inq_varid(ncid, 'solarflux',   solarflux_id)
    ierr =  pio_get_var(ncid, solarflux_id, solarflux)
    call pio_closefile(ncid)


#if ( defined SPMD )
    call mpibcast(S0, 1, mpir8, 0, mpicom)
    call mpibcast(solarflux, ntot_wavlnrng, mpir8, 0, mpicom)
#endif

  end subroutine initialize_solar


!============================================================================

  subroutine initialize_cldopts

!------------------------------------------------------------------------
!
! Purpose:  Initialize the cloud optical constants from input file.
!
!------------------------------------------------------------------------

#if ( defined SPMD)
  use mpishorthand
#endif

    use ioFileMod, only: getfil
    use cam_pio_utils, only: cam_pio_openfile
    use pio,  only: pio_inq_varid, pio_get_var, pio_closefile, pio_nowrite,  &
                    file_desc_t, var_desc_t, pio_inq_dimid, pio_inquire_dimension

    implicit none
    include 'netcdf.inc'

!------------------------------------------------------------------------
!
! Local Variables
    
    type(file_desc_t) :: ncid
    integer :: bin_id
    integer :: wav_id
    integer :: ncldopt_lbins
    integer :: ncldopt_lwavs
    integer :: ncldopt_ibins
    integer :: ncldopt_iwavs
    integer :: q_id
    integer :: w_id
    integer :: g_id
    character(len=256) :: filename
    character(len=256) :: locfn
    integer :: ierr

!------------------------------------------------------------------------
!
! Start Code
!
    if (masterproc) then
      write(6,*) "CLDOPTS: INITIALIZING CLOUD OPTICAL PROPERTIES"
    endif     

    ! Load K water cloud optics file
    filename = trim(exort_rootdir)//trim(dircld)//trim(cldoptsL_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
!!    ierr =  pio_inq_dimid(ncid, 'rel_bins',   bin_id)
!!    ierr =  pio_inquire_dimension(ncid, bin_id, len=ncldopt_lbins)
    ierr =  pio_inq_varid(ncid, 'Qext_liq',   q_id)
    ierr =  pio_get_var(ncid, q_id, Qcldliq)
    ierr =  pio_inq_varid(ncid, 'W_liq',   w_id)
    ierr =  pio_get_var(ncid, w_id, Wcldliq)
    ierr =  pio_inq_varid(ncid, 'G_liq',   g_id)
    ierr =  pio_get_var(ncid, g_id, Gcldliq)
    call pio_closefile(ncid)


    ! Load ice cloud optics file
    filename = trim(exort_rootdir)//trim(dircld)//trim(cldoptsI_file)
    call getfil(filename, locfn, 0)
    call cam_pio_openfile(ncid, locfn, PIO_NOWRITE)
!!    ierr =  pio_inq_dimid(ncid, 'rei_bins',   bin_id)
!!    ierr =  pio_inquire_dimension(ncid, bin_id, len=ncldopt_ibins)
    ierr =  pio_inq_varid(ncid, 'Qext_ice',   q_id)
    ierr =  pio_get_var(ncid, q_id, Qcldice)
    ierr =  pio_inq_varid(ncid, 'W_ice',   w_id)
    ierr =  pio_get_var(ncid, w_id, Wcldice)
    ierr =  pio_inq_varid(ncid, 'G_ice',   g_id)
    ierr =  pio_get_var(ncid, g_id, Gcldice)
    call pio_closefile(ncid)

! broadcast water cloud optical constants to all nodes
#if ( defined SPMD )
    call mpibcast(Qcldliq, nrel*ntot_wavlnrng, mpir8, 0, mpicom)
    call mpibcast(Wcldliq, nrel*ntot_wavlnrng, mpir8, 0, mpicom)
    call mpibcast(Gcldliq, nrel*ntot_wavlnrng, mpir8, 0, mpicom)
#endif

! broadcast ice cloud optical constants to all nodes
#if ( defined SPMD )
    call mpibcast(Qcldice, nrei*ntot_wavlnrng, mpir8, 0, mpicom)
    call mpibcast(Wcldice, nrei*ntot_wavlnrng, mpir8, 0, mpicom)
    call mpibcast(Gcldice, nrei*ntot_wavlnrng, mpir8, 0, mpicom)
#endif

  end subroutine initialize_cldopts


!============================================================================

subroutine initialize_radbuffer

!
! Initialize radiation buffer data
!

!#include <comhyb.h>

!   integer :: k

 !If the top model level is above ~90 km (0.1 Pa), set the top level to compute
 !longwave cooling to about 80 km (1 Pa)
 !  if (hypm(1) .lt. 0.1) then
 !     do k = 1, pver
 !        if (hypm(k) .lt. 1) camtop = k 
 !        ! set top of cloud layer for cloud overlap assumption (1 hpa)
 !        !if (hypm(k) .lt. 1.e2) ntopcld  = k
 !     end do
 !  else
      camtop  = 1
 !     ntopcld = 2
 !  end if
 !  nlevsRT = pverp-camtop+1   
 !  if (masterproc) then
 !     write (6,*) 'INITIALIZE_RADBUFFER: camtop =',camtop
 !     write (6,*) 'INITIALIZE_RADBUFFER: pressure:',hypm(camtop)
 !     write (6,*) 'INITIALIZE_RADBUFFER: nlevsRT:',nlevsRT
 !  endif
  return
end subroutine initialize_radbuffer

!====================================================================================



end module initialize_rad_mod_cam
