w90_readwrite_get_keyword Subroutine

public subroutine w90_readwrite_get_keyword(settings, keyword, found, error, comm, c_value, l_value, i_value, r_value)

Uses

  • proc~~w90_readwrite_get_keyword~~UsesGraph proc~w90_readwrite_get_keyword w90_readwrite_get_keyword module~w90_error w90_error proc~w90_readwrite_get_keyword->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

Finds the value of the required keyword.

Arguments

Type IntentOptional Attributes Name
type(settings_type), intent(inout) :: settings
character(len=*), intent(in) :: keyword

Keyword to examine

logical, intent(out) :: found

Is keyword present

type(w90_error_type), intent(out), allocatable :: error
type(w90_comm_type), intent(in) :: comm
character(len=*), intent(inout), optional :: c_value

Keyword value

logical, intent(inout), optional :: l_value

Keyword value

integer, intent(inout), optional :: i_value

Keyword value

real(kind=dp), intent(inout), optional :: r_value

Keyword value


Calls

proc~~w90_readwrite_get_keyword~~CallsGraph proc~w90_readwrite_get_keyword w90_readwrite_get_keyword proc~set_error_fatal set_error_fatal proc~w90_readwrite_get_keyword->proc~set_error_fatal proc~set_error_input set_error_input proc~w90_readwrite_get_keyword->proc~set_error_input proc~comms_sync_error comms_sync_error proc~set_error_fatal->proc~comms_sync_error proc~set_base_error set_base_error proc~set_error_fatal->proc~set_base_error proc~set_error_input->proc~comms_sync_error proc~set_error_input->proc~set_base_error

Called by

proc~~w90_readwrite_get_keyword~~CalledByGraph proc~w90_readwrite_get_keyword w90_readwrite_get_keyword proc~get_module_kmesh get_module_kmesh proc~get_module_kmesh->proc~w90_readwrite_get_keyword proc~w90_readwrite_clear_keywords w90_readwrite_clear_keywords proc~w90_readwrite_clear_keywords->proc~w90_readwrite_get_keyword proc~w90_readwrite_read_algorithm_control w90_readwrite_read_algorithm_control proc~w90_readwrite_read_algorithm_control->proc~w90_readwrite_get_keyword proc~w90_readwrite_read_dis_manifold w90_readwrite_read_dis_manifold proc~w90_readwrite_read_dis_manifold->proc~w90_readwrite_get_keyword proc~w90_readwrite_read_fermi_energy w90_readwrite_read_fermi_energy proc~w90_readwrite_read_fermi_energy->proc~w90_readwrite_get_keyword proc~w90_readwrite_read_gamma_only w90_readwrite_read_gamma_only proc~w90_readwrite_read_gamma_only->proc~w90_readwrite_get_keyword proc~w90_readwrite_read_kmesh_data w90_readwrite_read_kmesh_data proc~w90_readwrite_read_kmesh_data->proc~w90_readwrite_get_keyword proc~w90_readwrite_read_kpath w90_readwrite_read_kpath proc~w90_readwrite_read_kpath->proc~w90_readwrite_get_keyword proc~w90_readwrite_read_num_bands w90_readwrite_read_num_bands proc~w90_readwrite_read_num_bands->proc~w90_readwrite_get_keyword proc~w90_readwrite_read_num_wann w90_readwrite_read_num_wann proc~w90_readwrite_read_num_wann->proc~w90_readwrite_get_keyword proc~w90_readwrite_read_system w90_readwrite_read_system proc~w90_readwrite_read_system->proc~w90_readwrite_get_keyword proc~w90_readwrite_read_total_bands w90_readwrite_read_total_bands proc~w90_readwrite_read_total_bands->proc~w90_readwrite_get_keyword proc~w90_readwrite_read_units w90_readwrite_read_units proc~w90_readwrite_read_units->proc~w90_readwrite_get_keyword proc~w90_readwrite_read_verbosity w90_readwrite_read_verbosity proc~w90_readwrite_read_verbosity->proc~w90_readwrite_get_keyword proc~w90_readwrite_read_ws_data w90_readwrite_read_ws_data proc~w90_readwrite_read_ws_data->proc~w90_readwrite_get_keyword proc~w90_wannier90_readwrite_read_band_plot w90_wannier90_readwrite_read_band_plot proc~w90_wannier90_readwrite_read_band_plot->proc~w90_readwrite_get_keyword proc~w90_wannier90_readwrite_read_berry w90_wannier90_readwrite_read_berry proc~w90_wannier90_readwrite_read_berry->proc~w90_readwrite_get_keyword proc~w90_wannier90_readwrite_read_bloch_phase w90_wannier90_readwrite_read_bloch_phase proc~w90_wannier90_readwrite_read_bloch_phase->proc~w90_readwrite_get_keyword proc~w90_wannier90_readwrite_read_boltzwann w90_wannier90_readwrite_read_boltzwann proc~w90_wannier90_readwrite_read_boltzwann->proc~w90_readwrite_get_keyword proc~w90_wannier90_readwrite_read_disentangle w90_wannier90_readwrite_read_disentangle proc~w90_wannier90_readwrite_read_disentangle->proc~w90_readwrite_get_keyword proc~w90_wannier90_readwrite_read_dist_cutoff w90_wannier90_readwrite_read_dist_cutoff proc~w90_wannier90_readwrite_read_dist_cutoff->proc~w90_readwrite_get_keyword proc~w90_wannier90_readwrite_read_dos w90_wannier90_readwrite_read_dos proc~w90_wannier90_readwrite_read_dos->proc~w90_readwrite_get_keyword proc~w90_wannier90_readwrite_read_effective_model w90_wannier90_readwrite_read_effective_model proc~w90_wannier90_readwrite_read_effective_model->proc~w90_readwrite_get_keyword proc~w90_wannier90_readwrite_read_energy_range w90_wannier90_readwrite_read_energy_range proc~w90_wannier90_readwrite_read_energy_range->proc~w90_readwrite_get_keyword proc~w90_wannier90_readwrite_read_fermi_surface w90_wannier90_readwrite_read_fermi_surface proc~w90_wannier90_readwrite_read_fermi_surface->proc~w90_readwrite_get_keyword proc~w90_wannier90_readwrite_read_geninterp w90_wannier90_readwrite_read_geninterp proc~w90_wannier90_readwrite_read_geninterp->proc~w90_readwrite_get_keyword proc~w90_wannier90_readwrite_read_global_kmesh w90_wannier90_readwrite_read_global_kmesh proc~w90_wannier90_readwrite_read_global_kmesh->proc~w90_readwrite_get_keyword proc~w90_wannier90_readwrite_read_gyrotropic w90_wannier90_readwrite_read_gyrotropic proc~w90_wannier90_readwrite_read_gyrotropic->proc~w90_readwrite_get_keyword proc~w90_wannier90_readwrite_read_hamil w90_wannier90_readwrite_read_hamil proc~w90_wannier90_readwrite_read_hamil->proc~w90_readwrite_get_keyword proc~w90_wannier90_readwrite_read_kslice w90_wannier90_readwrite_read_kslice proc~w90_wannier90_readwrite_read_kslice->proc~w90_readwrite_get_keyword proc~w90_wannier90_readwrite_read_one_dim w90_wannier90_readwrite_read_one_dim proc~w90_wannier90_readwrite_read_one_dim->proc~w90_readwrite_get_keyword proc~w90_wannier90_readwrite_read_oper w90_wannier90_readwrite_read_oper proc~w90_wannier90_readwrite_read_oper->proc~w90_readwrite_get_keyword proc~w90_wannier90_readwrite_read_outfiles w90_wannier90_readwrite_read_outfiles proc~w90_wannier90_readwrite_read_outfiles->proc~w90_readwrite_get_keyword proc~w90_wannier90_readwrite_read_plot_info w90_wannier90_readwrite_read_plot_info proc~w90_wannier90_readwrite_read_plot_info->proc~w90_readwrite_get_keyword proc~w90_wannier90_readwrite_read_post_proc w90_wannier90_readwrite_read_post_proc proc~w90_wannier90_readwrite_read_post_proc->proc~w90_readwrite_get_keyword proc~w90_wannier90_readwrite_read_projections w90_wannier90_readwrite_read_projections proc~w90_wannier90_readwrite_read_projections->proc~w90_readwrite_get_keyword proc~w90_wannier90_readwrite_read_pw90_calcs w90_wannier90_readwrite_read_pw90_calcs proc~w90_wannier90_readwrite_read_pw90_calcs->proc~w90_readwrite_get_keyword proc~w90_wannier90_readwrite_read_pw90_kpath w90_wannier90_readwrite_read_pw90_kpath proc~w90_wannier90_readwrite_read_pw90_kpath->proc~w90_readwrite_get_keyword proc~w90_wannier90_readwrite_read_pw90ham w90_wannier90_readwrite_read_pw90ham proc~w90_wannier90_readwrite_read_pw90ham->proc~w90_readwrite_get_keyword proc~w90_wannier90_readwrite_read_pw90spin w90_wannier90_readwrite_read_pw90spin proc~w90_wannier90_readwrite_read_pw90spin->proc~w90_readwrite_get_keyword proc~w90_wannier90_readwrite_read_restart w90_wannier90_readwrite_read_restart proc~w90_wannier90_readwrite_read_restart->proc~w90_readwrite_get_keyword proc~w90_wannier90_readwrite_read_scissors_shift w90_wannier90_readwrite_read_scissors_shift proc~w90_wannier90_readwrite_read_scissors_shift->proc~w90_readwrite_get_keyword proc~w90_wannier90_readwrite_read_smearing w90_wannier90_readwrite_read_smearing proc~w90_wannier90_readwrite_read_smearing->proc~w90_readwrite_get_keyword proc~w90_wannier90_readwrite_read_spin_hall w90_wannier90_readwrite_read_spin_hall proc~w90_wannier90_readwrite_read_spin_hall->proc~w90_readwrite_get_keyword proc~w90_wannier90_readwrite_read_sym w90_wannier90_readwrite_read_sym proc~w90_wannier90_readwrite_read_sym->proc~w90_readwrite_get_keyword proc~w90_wannier90_readwrite_read_transport w90_wannier90_readwrite_read_transport proc~w90_wannier90_readwrite_read_transport->proc~w90_readwrite_get_keyword proc~w90_wannier90_readwrite_read_w90_calcs w90_wannier90_readwrite_read_w90_calcs proc~w90_wannier90_readwrite_read_w90_calcs->proc~w90_readwrite_get_keyword proc~w90_wannier90_readwrite_read_wann_plot w90_wannier90_readwrite_read_wann_plot proc~w90_wannier90_readwrite_read_wann_plot->proc~w90_readwrite_get_keyword proc~w90_wannier90_readwrite_read_wannierise w90_wannier90_readwrite_read_wannierise proc~w90_wannier90_readwrite_read_wannierise->proc~w90_readwrite_get_keyword proc~w90_postw90_readwrite_read w90_postw90_readwrite_read proc~w90_postw90_readwrite_read->proc~w90_readwrite_read_algorithm_control proc~w90_postw90_readwrite_read->proc~w90_readwrite_read_dis_manifold proc~w90_postw90_readwrite_read->proc~w90_readwrite_read_fermi_energy proc~w90_postw90_readwrite_read->proc~w90_readwrite_read_gamma_only proc~w90_postw90_readwrite_read->proc~w90_readwrite_read_kmesh_data proc~w90_postw90_readwrite_read->proc~w90_readwrite_read_kpath proc~w90_postw90_readwrite_read->proc~w90_readwrite_read_num_bands proc~w90_postw90_readwrite_read->proc~w90_readwrite_read_num_wann proc~w90_postw90_readwrite_read->proc~w90_readwrite_read_system proc~w90_postw90_readwrite_read->proc~w90_readwrite_read_units proc~w90_postw90_readwrite_read->proc~w90_readwrite_read_verbosity proc~w90_postw90_readwrite_read->proc~w90_readwrite_read_ws_data 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_effective_model proc~w90_postw90_readwrite_read->proc~w90_wannier90_readwrite_read_energy_range proc~w90_postw90_readwrite_read->proc~w90_wannier90_readwrite_read_geninterp proc~w90_postw90_readwrite_read->proc~w90_wannier90_readwrite_read_global_kmesh proc~w90_postw90_readwrite_read->proc~w90_wannier90_readwrite_read_gyrotropic proc~w90_postw90_readwrite_read->proc~w90_wannier90_readwrite_read_kslice proc~w90_postw90_readwrite_read->proc~w90_wannier90_readwrite_read_oper proc~w90_postw90_readwrite_read->proc~w90_wannier90_readwrite_read_pw90_calcs proc~w90_postw90_readwrite_read->proc~w90_wannier90_readwrite_read_pw90_kpath proc~w90_postw90_readwrite_read->proc~w90_wannier90_readwrite_read_pw90ham proc~w90_postw90_readwrite_read->proc~w90_wannier90_readwrite_read_pw90spin proc~w90_postw90_readwrite_read->proc~w90_wannier90_readwrite_read_scissors_shift proc~w90_postw90_readwrite_read->proc~w90_wannier90_readwrite_read_smearing proc~w90_postw90_readwrite_read->proc~w90_wannier90_readwrite_read_spin_hall proc~w90_wannier90_readwrite_read_local_kmesh w90_wannier90_readwrite_read_local_kmesh proc~w90_postw90_readwrite_read->proc~w90_wannier90_readwrite_read_local_kmesh 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_effective_model proc~w90_postw90_readwrite_readall->proc~w90_wannier90_readwrite_read_energy_range proc~w90_postw90_readwrite_readall->proc~w90_wannier90_readwrite_read_geninterp proc~w90_postw90_readwrite_readall->proc~w90_wannier90_readwrite_read_global_kmesh proc~w90_postw90_readwrite_readall->proc~w90_wannier90_readwrite_read_gyrotropic proc~w90_postw90_readwrite_readall->proc~w90_wannier90_readwrite_read_kslice proc~w90_postw90_readwrite_readall->proc~w90_wannier90_readwrite_read_oper proc~w90_postw90_readwrite_readall->proc~w90_wannier90_readwrite_read_pw90_calcs proc~w90_postw90_readwrite_readall->proc~w90_wannier90_readwrite_read_pw90_kpath proc~w90_postw90_readwrite_readall->proc~w90_wannier90_readwrite_read_pw90ham proc~w90_postw90_readwrite_readall->proc~w90_wannier90_readwrite_read_pw90spin proc~w90_postw90_readwrite_readall->proc~w90_wannier90_readwrite_read_scissors_shift proc~w90_postw90_readwrite_readall->proc~w90_wannier90_readwrite_read_smearing proc~w90_postw90_readwrite_readall->proc~w90_wannier90_readwrite_read_spin_hall proc~w90_postw90_readwrite_readall->proc~w90_wannier90_readwrite_read_local_kmesh proc~w90_readwrite_clean_infile w90_readwrite_clean_infile proc~w90_readwrite_clean_infile->proc~w90_readwrite_clear_keywords proc~w90_wannier90_readwrite_read w90_wannier90_readwrite_read proc~w90_wannier90_readwrite_read->proc~w90_readwrite_read_algorithm_control proc~w90_wannier90_readwrite_read->proc~w90_readwrite_read_dis_manifold proc~w90_wannier90_readwrite_read->proc~w90_readwrite_read_fermi_energy proc~w90_wannier90_readwrite_read->proc~w90_readwrite_read_gamma_only proc~w90_wannier90_readwrite_read->proc~w90_readwrite_read_kpath proc~w90_wannier90_readwrite_read->proc~w90_readwrite_read_units proc~w90_wannier90_readwrite_read->proc~w90_readwrite_read_verbosity proc~w90_wannier90_readwrite_read->proc~w90_readwrite_read_ws_data proc~w90_wannier90_readwrite_read->proc~w90_wannier90_readwrite_read_band_plot proc~w90_wannier90_readwrite_read->proc~w90_wannier90_readwrite_read_bloch_phase proc~w90_wannier90_readwrite_read->proc~w90_wannier90_readwrite_read_disentangle proc~w90_wannier90_readwrite_read->proc~w90_wannier90_readwrite_read_dist_cutoff proc~w90_wannier90_readwrite_read->proc~w90_wannier90_readwrite_read_fermi_surface proc~w90_wannier90_readwrite_read->proc~w90_wannier90_readwrite_read_hamil proc~w90_wannier90_readwrite_read->proc~w90_wannier90_readwrite_read_one_dim proc~w90_wannier90_readwrite_read->proc~w90_wannier90_readwrite_read_outfiles proc~w90_wannier90_readwrite_read->proc~w90_wannier90_readwrite_read_plot_info proc~w90_wannier90_readwrite_read->proc~w90_wannier90_readwrite_read_post_proc proc~w90_wannier90_readwrite_read->proc~w90_wannier90_readwrite_read_restart proc~w90_wannier90_readwrite_read->proc~w90_wannier90_readwrite_read_sym proc~w90_wannier90_readwrite_read->proc~w90_wannier90_readwrite_read_transport proc~w90_wannier90_readwrite_read->proc~w90_wannier90_readwrite_read_w90_calcs proc~w90_wannier90_readwrite_read->proc~w90_wannier90_readwrite_read_wann_plot proc~w90_wannier90_readwrite_read->proc~w90_wannier90_readwrite_read_wannierise proc~w90_wannier90_readwrite_read_local_kmesh->proc~get_module_kmesh proc~w90_wannier90_readwrite_read_special w90_wannier90_readwrite_read_special proc~w90_wannier90_readwrite_read_special->proc~w90_readwrite_read_kmesh_data proc~w90_wannier90_readwrite_read_special->proc~w90_readwrite_read_num_bands proc~w90_wannier90_readwrite_read_special->proc~w90_readwrite_read_num_wann proc~w90_wannier90_readwrite_read_special->proc~w90_readwrite_read_system proc~w90_wannier90_readwrite_read_special->proc~w90_readwrite_read_total_bands proc~w90_wannier90_readwrite_read_special->proc~w90_wannier90_readwrite_read_projections proc~input_reader_special input_reader_special proc~input_reader_special->proc~w90_readwrite_clean_infile proc~input_reader_special->proc~w90_wannier90_readwrite_read_special proc~w90_input_reader~2 w90_input_reader proc~w90_input_reader~2->proc~w90_readwrite_clean_infile proc~w90_input_reader~2->proc~w90_wannier90_readwrite_read proc~w90_input_setopt w90_input_setopt proc~w90_input_setopt->proc~w90_wannier90_readwrite_read proc~w90_input_setopt->proc~w90_wannier90_readwrite_read_special program~postw90 postw90 program~postw90->proc~w90_postw90_readwrite_read program~postw90->proc~w90_readwrite_clean_infile proc~w90_input_reader w90_input_reader proc~w90_input_reader->proc~w90_input_reader~2 proc~w90_input_setopt_f w90_input_setopt_f proc~w90_input_setopt_f->proc~w90_input_setopt program~wannier wannier program~wannier->proc~input_reader_special program~wannier->proc~w90_input_reader~2

Source Code

  subroutine w90_readwrite_get_keyword(settings, keyword, found, error, comm, c_value, l_value, i_value, r_value)
    !================================================!
    !
    !! Finds the value of the required keyword.
    !
    !================================================!

    use w90_error, only: w90_error_type, set_error_input, set_error_fatal

    implicit none

    character(*), intent(in)  :: keyword
    !! Keyword to examine
    logical, intent(out) :: found
    !! Is keyword present
    character(*), optional, intent(inout) :: c_value
    !! Keyword value
    logical, optional, intent(inout) :: l_value
    !! Keyword value
    integer, optional, intent(inout) :: i_value
    !! Keyword value
    real(kind=dp), optional, intent(inout) :: r_value
    !! Keyword value
    type(w90_error_type), allocatable, intent(out) :: error
    type(w90_comm_type), intent(in) :: comm
    type(settings_type), intent(inout) :: settings

    integer           :: kl, in, loop, itmp
    character(len=maxlen) :: dummy

    kl = len_trim(keyword)

    found = .false.

    if (allocated(settings%entries) .and. allocated(settings%in_data)) then
      call set_error_fatal(error, 'Error: (library use) options interface and .win parsing clash.'// &
                           '  See library documentation "setting options." (readwrite.F90)', comm)
      return
    elseif (allocated(settings%entries)) then
      do loop = 1, settings%num_entries  ! this means the first occurance of the variable in settings is used
        ! memory beyond num_entries is not initialised
        if (settings%entries(loop)%keyword == keyword) then
          if (present(i_value)) then
            i_value = settings%entries(loop)%idata
          else if (present(r_value)) then
            r_value = settings%entries(loop)%rdata
          else if (present(l_value)) then
            l_value = settings%entries(loop)%ldata
          else if (present(c_value)) then
            c_value = settings%entries(loop)%txtdata
          else
            call set_error_fatal(error, 'Error: keyword sought, but no variable provided to assign to. (readwrite.F90)', comm)
            return
          end if
          found = .true.
          return
        end if
      end do
    else if (allocated(settings%in_data)) then
      ! by default, scan the input file

      do loop = 1, settings%num_lines
        in = index(settings%in_data(loop), trim(keyword))
        if (in == 0 .or. in > 1) cycle
        itmp = in + len(trim(keyword))
        if (settings%in_data(loop) (itmp:itmp) /= '=' &
            .and. settings%in_data(loop) (itmp:itmp) /= ':' &
            .and. settings%in_data(loop) (itmp:itmp) /= ' ') cycle
        if (found) then
          call set_error_input(error, 'Error: Found keyword '//trim(keyword)//' more than once in input file', comm)
          return
        end if
        found = .true.
        dummy = settings%in_data(loop) (kl + 1:)
        settings%in_data(loop) (1:maxlen) = ' '
        dummy = adjustl(dummy)
        if (dummy(1:1) == '=' .or. dummy(1:1) == ':') then
          dummy = dummy(2:)
          dummy = adjustl(dummy)
        end if
      end do

      if (found) then
        if (present(c_value)) c_value = dummy
        if (present(l_value)) then
          if (index(dummy, 't') > 0) then
            l_value = .true.
          elseif (index(dummy, 'f') > 0) then
            l_value = .false.
          else
            call set_error_input(error, 'Error: Problem reading logical keyword '//trim(keyword), comm)
            return
          end if
        end if
        if (present(i_value)) read (dummy, *, err=220, end=220) i_value
        if (present(r_value)) read (dummy, *, err=220, end=220) r_value
      end if
    else
      ! error condition
    end if

    return
220 call set_error_input(error, 'Error: Problem reading keyword '//trim(keyword), comm)
    return
  end subroutine w90_readwrite_get_keyword