subroutine w90_wannier90_readwrite_read_spin_hall(settings, pw90_calculation, scissors_shift, &
pw90_spin_hall, berry_task, error, comm)
!================================================!
use w90_error, only: w90_error_type
use w90_comms, only: w90_comm_type
implicit none
type(pw90_calculation_type), intent(in) :: pw90_calculation
type(pw90_spin_hall_type), intent(inout) :: pw90_spin_hall
type(w90_error_type), allocatable, intent(out) :: error
type(w90_comm_type), intent(in) :: comm
type(settings_type), intent(inout) :: settings
real(kind=dp), intent(in) :: scissors_shift
character(len=*), intent(in) :: berry_task
logical :: found, transl_inv_full
transl_inv_full = .false.
call w90_readwrite_get_keyword(settings, 'shc_freq_scan', found, error, comm, &
l_value=pw90_spin_hall%freq_scan)
if (allocated(error)) return
call w90_readwrite_get_keyword(settings, 'shc_alpha', found, error, comm, &
i_value=pw90_spin_hall%alpha)
if (allocated(error)) return
if (found .and. (pw90_spin_hall%alpha < 1 .or. pw90_spin_hall%alpha > 3)) then
call set_error_input(error, 'Error: shc_alpha must be 1, 2 or 3', comm)
return
end if
call w90_readwrite_get_keyword(settings, 'shc_beta', found, error, comm, &
i_value=pw90_spin_hall%beta)
if (allocated(error)) return
if (found .and. (pw90_spin_hall%beta < 1 .or. pw90_spin_hall%beta > 3)) then
call set_error_input(error, 'Error: shc_beta must be 1, 2 or 3', comm)
return
end if
call w90_readwrite_get_keyword(settings, 'shc_gamma', found, error, comm, &
i_value=pw90_spin_hall%gamma)
if (allocated(error)) return
if (found .and. (pw90_spin_hall%gamma < 1 .or. pw90_spin_hall%gamma > 3)) then
call set_error_input(error, 'Error: shc_gamma must be 1, 2 or 3', comm)
return
end if
call w90_readwrite_get_keyword(settings, 'shc_bandshift', found, error, comm, &
l_value=pw90_spin_hall%bandshift)
if (allocated(error)) return
pw90_spin_hall%bandshift = pw90_spin_hall%bandshift .and. pw90_calculation%berry .and. &
.not. (index(berry_task, 'shc') == 0)
if ((abs(scissors_shift) > 1.0e-7_dp) .and. pw90_spin_hall%bandshift) then
call set_error_input(error, 'Error: shc_bandshift and scissors_shift cannot be used simultaneously', comm)
return
end if
call w90_readwrite_get_keyword(settings, 'shc_bandshift_firstband', found, error, comm, &
i_value=pw90_spin_hall%bandshift_firstband)
if (allocated(error)) return
if (pw90_spin_hall%bandshift .and. (.not. found)) then
call set_error_input(error, 'Error: shc_bandshift required but no shc_bandshift_firstband provided', comm)
return
end if
if ((pw90_spin_hall%bandshift_firstband < 1) .and. found) then
call set_error_input(error, 'Error: shc_bandshift_firstband must >= 1', comm)
return
end if
call w90_readwrite_get_keyword(settings, 'shc_bandshift_energyshift', found, error, comm, &
r_value=pw90_spin_hall%bandshift_energyshift)
if (allocated(error)) return
if (pw90_spin_hall%bandshift .and. (.not. found)) then
call set_error_input(error, 'Error: shc_bandshift required but no shc_bandshift_energyshift provided', comm)
return
end if
call w90_readwrite_get_keyword(settings, 'shc_method', found, error, comm, &
c_value=pw90_spin_hall%method)
if (allocated(error)) return
if (index(berry_task, 'shc') > 0 .and. .not. found) then
call set_error_input(error, 'Error: berry_task=shc and shc_method is not set', comm)
return
end if
if (index(berry_task, 'shc') > 0 .and. index(pw90_spin_hall%method, 'qiao') == 0 &
.and. index(pw90_spin_hall%method, 'ryoo') == 0) then
call set_error_input(error, 'Error: value of shc_method not recognised in w90_wannier90_readwrite_read', comm)
return
end if
if (index(pw90_spin_hall%method, 'qiao') > 0) then
call w90_readwrite_get_keyword(settings, 'transl_inv_full', found, error, comm, &
l_value=transl_inv_full)
if (transl_inv_full) then
call set_error_input(error, 'Error: transl_inv_full=T not implemented for shc_method=qiao', comm)
return
end if
end if
end subroutine w90_wannier90_readwrite_read_spin_hall