subroutine w90_readwrite_read_explicit_kpath_points(settings, kpt_latt, bohr, &
error, comm)
use w90_error, only: w90_error_type, set_error_input, set_error_alloc, set_error_dealloc
implicit none
! arguments
real(kind=dp), allocatable, intent(out) :: kpt_latt(:, :)
real(kind=dp), intent(in) :: bohr
type(settings_type), intent(inout) :: settings
type(w90_comm_type), intent(in) :: comm
type(w90_error_type), allocatable, intent(out) :: error
! local variables
real(kind=dp), allocatable :: kpt_cart(:, :)
integer :: ierr, num_kpts
logical :: found
! pw90_effective_model ignores kpt_cart
! this routine allocates the intent(out) kpt_latt
if (allocated(settings%entries)) then
! library mode: the (3,K) entry sizes kpt_latt on assignment
call w90_readwrite_get_keyword_vector(settings, 'explicit_kpath', found, 0, error, comm, &
r2_value=kpt_latt)
if (allocated(error)) return
if (.not. found) then
call set_error_input(error, 'Error: Found explicit_kpath_symbols but there is no explicit_kpath', comm)
return
end if
if (size(kpt_latt, 1) /= 3) then
call set_error_input(error, 'Error: explicit_kpath must have shape (3,num_points)', comm)
return
end if
return
end if
call w90_readwrite_get_block_length(settings, 'explicit_kpath', found, num_kpts, error, comm)
ierr = 0
allocate (kpt_latt(3, num_kpts), stat=ierr)
if (ierr /= 0) then
call set_error_alloc(error, 'Error allocating kpt_latt in w90_readwrite_read_explicit_kpath_points', comm)
return
end if
allocate (kpt_cart(3, num_kpts), stat=ierr)
if (ierr /= 0) then
call set_error_alloc(error, 'Error allocating kpt_cart in w90_readwrite_read_explicit_kpath_points', comm)
return
end if
call w90_readwrite_get_keyword_block(settings, 'explicit_kpath', found, num_kpts, 3, bohr, error, &
comm, r_value=kpt_cart)
if (allocated(error)) return
if (.not. found) then
call set_error_input(error, 'Error: Found explicit_kpath_labels but there is no explicit_kpath block', comm)
return
end if
kpt_latt = kpt_cart
deallocate (kpt_cart, stat=ierr)
if (ierr /= 0) then
call set_error_dealloc(error, 'Error deallocating kpt_cart in w90_readwrite_read_explicit_kpath_points', comm)
return
end if
end subroutine w90_readwrite_read_explicit_kpath_points