subroutine tran_read_htX(nxx, h_00, h_01, h_file, stdout, error, comm)
!================================================!
use w90_constants, only: dp, maxlen
use w90_error, only: w90_error_type, set_error_file, set_error_file
implicit none
type(w90_error_type), allocatable, intent(out) :: error
type(w90_comm_type), intent(in) :: comm
integer, intent(in) :: nxx
integer, intent(in) :: stdout
real(kind=dp), intent(out) :: h_00(nxx, nxx), h_01(nxx, nxx)
character(len=50), intent(in) :: h_file
integer :: i, j, nw, file_unit
character(len=maxlen) :: dummy
open (newunit=file_unit, file=h_file, form='formatted', &
status='old', action='read', err=101)
write (stdout, '(/a)', advance='no') ' Reading H matrix from '//h_file//' : '
read (file_unit, '(a)', err=102, end=102) dummy
write (stdout, '(a)') trim(dummy)
read (file_unit, *, err=102, end=102) nw
if (nw .ne. nxx) then
call set_error_file(error, 'wrong matrix size in transport: read_htX', comm)
return
end if
read (file_unit, *) ((h_00(i, j), i=1, nxx), j=1, nxx)
read (file_unit, *, err=102, end=102) nw
if (nw .ne. nxx) then
call set_error_file(error, 'wrong matrix size in transport: read_htX', comm)
return
end if
read (file_unit, *, err=102, end=102) ((h_01(i, j), i=1, nxx), j=1, nxx)
close (unit=file_unit)
return
101 call set_error_file(error, 'Error: Problem opening input file '//h_file, comm)
return
102 call set_error_file(error, 'Error: Problem reading input file '//h_file, comm)
return
end subroutine tran_read_htX