subroutine w90_wannier90_readwrite_read_smearing(settings, pw90_smearing, error, comm)
!================================================!
use w90_error, only: w90_error_type
use w90_comms, only: w90_comm_type
implicit none
type(pw90_smearing_type), intent(inout) :: pw90_smearing
type(w90_error_type), allocatable, intent(out) :: error
type(w90_comm_type), intent(in) :: comm
type(settings_type), intent(inout) :: settings
logical :: found
character(len=maxlen) :: ctmp
! [gp-begin, Apr 20, 2012]
! By default: Gaussian
call w90_readwrite_get_keyword(settings, 'smr_type', found, error, comm, c_value=ctmp)
if (allocated(error)) return
if (found) then
pw90_smearing%type_index = w90_readwrite_get_smearing_index(ctmp, 'smr_type', error, comm)
if (allocated(error)) return
end if
! By default: adaptive smearing
call w90_readwrite_get_keyword(settings, 'adpt_smr', found, error, comm, &
l_value=pw90_smearing%use_adaptive)
if (allocated(error)) return
! By default: a=sqrt(2)
call w90_readwrite_get_keyword(settings, 'adpt_smr_fac', found, error, comm, &
r_value=pw90_smearing%adaptive_prefactor)
if (allocated(error)) return
if (found .and. (pw90_smearing%adaptive_prefactor <= 0._dp)) then
call set_error_input(error, 'Error: adpt_smr_fac must be greater than zero', comm)
return
end if
! By default: 1 eV
call w90_readwrite_get_keyword(settings, 'adpt_smr_max', found, error, comm, &
r_value=pw90_smearing%adaptive_max_width)
if (allocated(error)) return
if (pw90_smearing%adaptive_max_width <= 0._dp) then
call set_error_input(error, 'Error: adpt_smr_max must be greater than zero', comm)
return
end if
! By default: if adpt_smr is manually set to false by the user, but he/she doesn't
! define smr_fixed_en_width: NO smearing, i.e. just the histogram
call w90_readwrite_get_keyword(settings, 'smr_fixed_en_width', found, error, comm, &
r_value=pw90_smearing%fixed_width)
if (allocated(error)) return
if (found .and. (pw90_smearing%fixed_width < 0._dp)) then
call set_error_input(error, 'Error: smr_fixed_en_width must be greater than or equal to zero', comm)
return
end if
end subroutine w90_wannier90_readwrite_read_smearing