param_get_keyword_vector Subroutine

private subroutine param_get_keyword_vector(keyword, found, length, c_value, l_value, i_value, r_value)

Uses

  • proc~~param_get_keyword_vector~~UsesGraph proc~param_get_keyword_vector param_get_keyword_vector module~w90_io w90_io proc~param_get_keyword_vector->module~w90_io module~w90_constants w90_constants module~w90_io->module~w90_constants

Finds the values of the required keyword vector

Arguments

Type IntentOptional AttributesName
character(len=*), intent(in) :: keyword

Keyword to examine

logical, intent(out) :: found

Is keyword present

integer, intent(in) :: length

Length of vecotr to read

character(len=*), intent(inout), optional :: c_value(length)

Keyword data

logical, intent(inout), optional :: l_value(length)

Keyword data

integer, intent(inout), optional :: i_value(length)

Keyword data

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

Keyword data


Calls

proc~~param_get_keyword_vector~~CallsGraph proc~param_get_keyword_vector param_get_keyword_vector proc~io_error io_error proc~param_get_keyword_vector->proc~io_error

Called by

proc~~param_get_keyword_vector~~CalledByGraph proc~param_get_keyword_vector param_get_keyword_vector proc~param_read param_read proc~param_read->proc~param_get_keyword_vector program~wannier wannier program~wannier->proc~param_read proc~wannier_run wannier_run proc~wannier_run->proc~param_read proc~wannier_setup wannier_setup proc~wannier_setup->proc~param_read program~postw90 postw90 program~postw90->proc~param_read

Contents


Source Code

  subroutine param_get_keyword_vector(keyword, found, length, c_value, l_value, i_value, r_value)
    !=========================================================================================!
    !                                                                                         !
    !! Finds the values of the required keyword vector
    !                                                                                         !
    !=========================================================================================!

    use w90_io, only: io_error

    implicit none

    character(*), intent(in)  :: keyword
    !! Keyword to examine
    logical, intent(out) :: found
    !! Is keyword present
    integer, intent(in)  :: length
    !! Length of vecotr to read
    character(*), optional, intent(inout) :: c_value(length)
    !! Keyword data
    logical, optional, intent(inout) :: l_value(length)
    !! Keyword data
    integer, optional, intent(inout) :: i_value(length)
    !! Keyword data
    real(kind=dp), optional, intent(inout) :: r_value(length)
    !! Keyword data

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

    kl = len_trim(keyword)

    found = .false.

    do loop = 1, num_lines
      in = index(in_data(loop), trim(keyword))
      if (in == 0 .or. in > 1) cycle
      if (found) then
        call io_error('Error: Found keyword '//trim(keyword)//' more than once in input file')
      endif
      found = .true.
      dummy = in_data(loop) (kl + 1:)
      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)) read (dummy, *, err=230, end=230) (c_value(i), i=1, length)
      if (present(l_value)) then
        ! I don't think we need this. Maybe read into a dummy charater
        ! array and convert each element to logical
        call io_error('param_get_keyword_vector unimplemented for logicals')
      endif
      if (present(i_value)) read (dummy, *, err=230, end=230) (i_value(i), i=1, length)
      if (present(r_value)) read (dummy, *, err=230, end=230) (r_value(i), i=1, length)
    end if

    return

230 call io_error('Error: Problem reading keyword '//trim(keyword)//' in param_get_keyword_vector')

  end subroutine param_get_keyword_vector