subroutine w90_wannier90_readwrite_read_kslice(settings, kslicel, pw90_kslice, error, comm)
!================================================!
use w90_error, only: w90_error_type
use w90_comms, only: w90_comm_type
implicit none
logical, intent(in) :: kslicel
type(pw90_kslice_mod_type), intent(inout) :: pw90_kslice
type(w90_error_type), allocatable, intent(out) :: error
type(w90_comm_type), intent(in) :: comm
type(settings_type), intent(inout) :: settings
integer :: i
logical :: found
call w90_readwrite_get_keyword(settings, 'kslice_task', found, error, comm, &
c_value=pw90_kslice%task)
if (allocated(error)) return
if (kslicel .and. index(pw90_kslice%task, 'fermi_lines') == 0 .and. &
index(pw90_kslice%task, 'curv') == 0 .and. &
index(pw90_kslice%task, 'morb') == 0 .and. &
index(pw90_kslice%task, 'shc') == 0) then
call set_error_input(error, 'Error: value of kslice_task not recognised in w90_wannier90_readwrite_read', comm)
return
end if
if (kslicel .and. index(pw90_kslice%task, 'curv') > 0 .and. &
index(pw90_kslice%task, 'morb') > 0) then
call set_error_input(error, "Error: kslice_task cannot include both 'curv' and 'morb'", comm)
return
end if
if (kslicel .and. index(pw90_kslice%task, 'shc') > 0 .and. &
index(pw90_kslice%task, 'morb') > 0) then
call set_error_input(error, "Error: kslice_task cannot include both 'shc' and 'morb'", comm)
return
end if
if (kslicel .and. index(pw90_kslice%task, 'shc') > 0 .and. &
index(pw90_kslice%task, 'curv') > 0) then
call set_error_input(error, "Error: kslice_task cannot include both 'shc' and 'curv'", comm)
return
end if
call w90_readwrite_get_vector_length(settings, 'kslice_2dkmesh', found, i, error, comm)
if (allocated(error)) return
if (found) then
if (i == 1) then
call w90_readwrite_get_keyword_vector(settings, 'kslice_2dkmesh', found, 1, error, comm, &
i_value=pw90_kslice%kmesh2d)
if (allocated(error)) return
pw90_kslice%kmesh2d(2) = pw90_kslice%kmesh2d(1)
elseif (i == 2) then
call w90_readwrite_get_keyword_vector(settings, 'kslice_2dkmesh', found, 2, error, comm, &
i_value=pw90_kslice%kmesh2d)
if (allocated(error)) return
else
call set_error_input(error, 'Error: kslice_2dkmesh must be provided as either' &
//' one integer or a vector of two integers', comm)
return
end if
if (any(pw90_kslice%kmesh2d <= 0)) then
call set_error_input(error, 'Error: kslice_2dkmesh elements must be greater than zero', &
comm)
return
end if
end if
call w90_readwrite_get_keyword_vector(settings, 'kslice_corner', found, 3, error, comm, &
r_value=pw90_kslice%corner)
if (allocated(error)) return
call w90_readwrite_get_keyword_vector(settings, 'kslice_b1', found, 3, error, comm, &
r_value=pw90_kslice%b1)
if (allocated(error)) return
call w90_readwrite_get_keyword_vector(settings, 'kslice_b2', found, 3, error, comm, &
r_value=pw90_kslice%b2)
if (allocated(error)) return
call w90_readwrite_get_keyword(settings, 'kslice_fermi_lines_colour', found, error, comm, &
c_value=pw90_kslice%fermi_lines_colour)
if (allocated(error)) return
if (kslicel .and. index(pw90_kslice%fermi_lines_colour, 'none') == 0 .and. &
index(pw90_kslice%fermi_lines_colour, 'spin') == 0) then
call set_error_input(error, 'Error: value of kslice_fermi_lines_colour not recognised ' &
//'in w90_wannier90_readwrite_read', comm)
return
end if
! slice_plot_format = 'plotmv'
! call w90_readwrite_get_keyword(settings, 'slice_plot_format',found,c_value=slice_plot_format)
end subroutine w90_wannier90_readwrite_read_kslice