Reads in atomic tables from file and stores them in tables
subroutine read_tables
!+ Reads in atomic tables from file and stores them in [[libfida:tables]]
integer(HID_T) :: fid
integer(HSIZE_T), dimension(2) :: dim2
integer :: error
integer :: n_max, m_max
character(len=4) :: impname
real(Float64), dimension(2) :: b_amu
real(Float64), dimension(:,:), allocatable :: dummy2
!!Initialize HDF5 interface
call h5open_f(error)
!!Open HDF5 file
call h5fopen_f(inputs%tables_file, H5F_ACC_RDONLY_F, fid, error)
!!Read Hydrogen-Hydrogen CX Cross Sections
call read_atomic_cross(fid,"/cross/H_H",tables%H_H_cx_cross)
!!Read Hydrogen-Hydrogen CX Rates
call read_atomic_rate(fid,"/rates/H_H", tables%H_H_cx_rate)
!!Read Hydrogen-Hydrogen Transitions
call read_atomic_transitions(fid,"/rates/H_H", tables%H_H)
!!Read Hydrogen-Electron Transitions
call read_atomic_transitions(fid,"/rates/H_e", tables%H_e)
!!Read Hydrogen-Impurity Transitions
impname = ''
select case (impurity_charge)
case (5)
impname = "B5"
case (6)
impname = "C6"
case DEFAULT
impname = "Aq"
end select
call read_atomic_transitions(fid,"/rates/H_"//trim(adjustl(impname)), tables%H_Aq)
!!Read Einstein coefficients
call h5ltread_dataset_int_scalar_f(fid,"/rates/spontaneous/n_max", n_max, error)
call h5ltread_dataset_int_scalar_f(fid,"/rates/spontaneous/m_max", m_max, error)
allocate(dummy2(n_max,m_max))
dim2 = [n_max, m_max]
call h5ltread_dataset_double_f(fid,"/rates/spontaneous/einstein",dummy2, dim2, error)
tables%einstein(:,:) = transpose(dummy2(1:nlevs,1:nlevs))
deallocate(dummy2)
!!Read nuclear Deuterium-Deuterium rates
if(inputs%calc_neutron.ge.1.or.inputs%calc_cfpd.ge.1) then
call read_nuclear_rates(fid, "/rates/D_D", tables%D_D)
endif
!!Close file
call h5fclose_f(fid, error)
!!Close HDF5 interface
call h5close_f(error)
if(inputs%verbose.ge.1) then
write(*,'(a)') "---- Atomic tables settings ----"
write(*,'(T2,"Maximum n/m: ",i2)') nlevs
write(*,*) ''
endif
end subroutine read_tables