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) :: imp_amu
real(Float64), dimension(2) :: b_amu
real(Float64), dimension(:,:), allocatable :: dummy2
if(inputs%verbose.ge.1) then
write(*,'(a)') "---- Atomic tables settings ----"
endif
!!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
b_amu = [inputs%ab, inputs%ai]
call read_atomic_rate(fid,"/rates/H_H",b_amu, inputs%ai, tables%H_H_cx_rate)
!!Read Hydrogen-Hydrogen Transitions
call read_atomic_transitions(fid,"/rates/H_H",b_amu, inputs%ai, tables%H_H)
inputs%ab = tables%H_H%ab(1)
inputs%ai = tables%H_H%ab(2)
!!Read Hydrogen-Electron Transitions
call read_atomic_transitions(fid,"/rates/H_e",b_amu, e_amu, tables%H_e)
!!Read Hydrogen-Impurity Transitions
impname = ''
select case (inputs%impurity_charge)
case (5)
impname = "B5"
imp_amu = B5_amu
case (6)
impname = "C6"
imp_amu = C6_amu
case DEFAULT
impname = "Aq"
imp_amu = 2.d0*inputs%impurity_charge
end select
call read_atomic_transitions(fid,"/rates/H_"//trim(adjustl(impname)), b_amu, imp_amu, 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) 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(*,'(T2,"Maximum n/m: ",i2)') nlevs
write(*,'(T2,"Beam/Fast-ion mass: ",f6.3," [amu]")') inputs%ab
write(*,'(T2,"Thermal/Bulk-ion mass: ",f6.3," [amu]")') inputs%ai
write(*,'(T2,"Impurity mass: ",f6.3," [amu]")') imp_amu
write(*,*) ''
endif
end subroutine read_tables