w90_readwrite_get_smearing_index Function

public function w90_readwrite_get_smearing_index(string, keyword, error, comm)

Uses

  • proc~~w90_readwrite_get_smearing_index~~UsesGraph proc~w90_readwrite_get_smearing_index w90_readwrite_get_smearing_index module~w90_error w90_error proc~w90_readwrite_get_smearing_index->module~w90_error module~w90_comms w90_comms module~w90_error->module~w90_comms module~w90_error_base w90_error_base module~w90_error->module~w90_error_base module~w90_comms->module~w90_error_base module~w90_constants w90_constants module~w90_comms->module~w90_constants

This function parses a string containing the type of smearing and returns the correct index for the smearing_index variable

If the string is not valid, an io_error is issued

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: string

The string read from input

character(len=*), intent(in) :: keyword

The keyword that was read (e.g., smr_type), so that we can print a more useful error message

type(w90_error_type), intent(out), allocatable :: error
type(w90_comm_type), intent(in) :: comm

Return Value integer


Calls

proc~~w90_readwrite_get_smearing_index~~CallsGraph proc~w90_readwrite_get_smearing_index w90_readwrite_get_smearing_index proc~set_error_input set_error_input proc~w90_readwrite_get_smearing_index->proc~set_error_input proc~comms_sync_error comms_sync_error proc~set_error_input->proc~comms_sync_error proc~set_base_error set_base_error proc~set_error_input->proc~set_base_error

Called by

proc~~w90_readwrite_get_smearing_index~~CalledByGraph proc~w90_readwrite_get_smearing_index w90_readwrite_get_smearing_index proc~w90_wannier90_readwrite_read_berry w90_wannier90_readwrite_read_berry proc~w90_wannier90_readwrite_read_berry->proc~w90_readwrite_get_smearing_index proc~w90_wannier90_readwrite_read_boltzwann w90_wannier90_readwrite_read_boltzwann proc~w90_wannier90_readwrite_read_boltzwann->proc~w90_readwrite_get_smearing_index proc~w90_wannier90_readwrite_read_dos w90_wannier90_readwrite_read_dos proc~w90_wannier90_readwrite_read_dos->proc~w90_readwrite_get_smearing_index proc~w90_wannier90_readwrite_read_gyrotropic w90_wannier90_readwrite_read_gyrotropic proc~w90_wannier90_readwrite_read_gyrotropic->proc~w90_readwrite_get_smearing_index proc~w90_wannier90_readwrite_read_smearing w90_wannier90_readwrite_read_smearing proc~w90_wannier90_readwrite_read_smearing->proc~w90_readwrite_get_smearing_index proc~w90_postw90_readwrite_read w90_postw90_readwrite_read proc~w90_postw90_readwrite_read->proc~w90_wannier90_readwrite_read_berry proc~w90_postw90_readwrite_read->proc~w90_wannier90_readwrite_read_boltzwann proc~w90_postw90_readwrite_read->proc~w90_wannier90_readwrite_read_dos proc~w90_postw90_readwrite_read->proc~w90_wannier90_readwrite_read_gyrotropic proc~w90_postw90_readwrite_read->proc~w90_wannier90_readwrite_read_smearing proc~w90_postw90_readwrite_readall w90_postw90_readwrite_readall proc~w90_postw90_readwrite_readall->proc~w90_wannier90_readwrite_read_berry proc~w90_postw90_readwrite_readall->proc~w90_wannier90_readwrite_read_boltzwann proc~w90_postw90_readwrite_readall->proc~w90_wannier90_readwrite_read_dos proc~w90_postw90_readwrite_readall->proc~w90_wannier90_readwrite_read_gyrotropic proc~w90_postw90_readwrite_readall->proc~w90_wannier90_readwrite_read_smearing program~postw90 postw90 program~postw90->proc~w90_postw90_readwrite_read

Source Code

  function w90_readwrite_get_smearing_index(string, keyword, error, comm)
    !! This function parses a string containing the type of
    !! smearing and returns the correct index for the smearing_index variable
    !
    !! If the string is not valid, an io_error is issued
    use w90_error, only: w90_error_type, set_error_input
    character(len=*), intent(in) :: string
    !! The string read from input
    character(len=*), intent(in) :: keyword
    !! The keyword that was read (e.g., smr_type), so that we can print a more useful error message
    type(w90_comm_type), intent(in) :: comm
    type(w90_error_type), allocatable, intent(out) :: error

    integer :: w90_readwrite_get_smearing_index
    integer :: pos

    w90_readwrite_get_smearing_index = 0 ! To avoid warnings of unset variables

    if (index(string, 'm-v') > 0) then
      w90_readwrite_get_smearing_index = -1
    elseif (index(string, 'm-p') > 0) then
      pos = index(string, 'm-p')
      if (len(trim(string(pos + 3:))) .eq. 0) then
        ! If the string is only 'm-p', we assume that 'm-p1' was intended
        w90_readwrite_get_smearing_index = 1
      else
        read (string(pos + 3:), *, err=337) w90_readwrite_get_smearing_index
        if (w90_readwrite_get_smearing_index < 0) then
          call set_error_input(error, 'Wrong m-p smearing order in keyword '//trim(keyword), comm)
          return
        end if
      end if
    elseif (index(string, 'f-d') > 0) then
      w90_readwrite_get_smearing_index = -99
      ! Some aliases
    elseif (index(string, 'cold') > 0) then
      w90_readwrite_get_smearing_index = -1
    elseif (index(string, 'gauss') > 0) then
      w90_readwrite_get_smearing_index = 0
      ! Unrecognised keyword
    else
      call set_error_input(error, 'Unrecognised value for keyword '//trim(keyword), comm)
      return
    end if

    return

337 call set_error_input(error, 'Wrong m-p smearing order in keyword '//trim(keyword), comm)
    return

  end function w90_readwrite_get_smearing_index