w90_readwrite_get_keyword_explicit_kpath Subroutine

private subroutine w90_readwrite_get_keyword_explicit_kpath(settings, kpoint_path, error, comm)

Uses

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

Fills the explicit_kpath_labels data block

Arguments

Type IntentOptional Attributes Name
type(settings_type), intent(inout) :: settings
type(kpoint_path_type), intent(inout) :: kpoint_path
type(w90_error_type), intent(out), allocatable :: error
type(w90_comm_type), intent(in) :: comm

Calls

proc~~w90_readwrite_get_keyword_explicit_kpath~~CallsGraph proc~w90_readwrite_get_keyword_explicit_kpath w90_readwrite_get_keyword_explicit_kpath proc~set_error_input set_error_input proc~w90_readwrite_get_keyword_explicit_kpath->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_keyword_explicit_kpath~~CalledByGraph proc~w90_readwrite_get_keyword_explicit_kpath w90_readwrite_get_keyword_explicit_kpath proc~w90_readwrite_read_explicit_kpath w90_readwrite_read_explicit_kpath proc~w90_readwrite_read_explicit_kpath->proc~w90_readwrite_get_keyword_explicit_kpath proc~w90_wannier90_readwrite_read w90_wannier90_readwrite_read proc~w90_wannier90_readwrite_read->proc~w90_readwrite_read_explicit_kpath proc~w90_input_reader~2 w90_input_reader 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_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~w90_input_reader~2

Source Code

  subroutine w90_readwrite_get_keyword_explicit_kpath(settings, kpoint_path, error, comm)
    !================================================!
    !
    !!  Fills the explicit_kpath_labels data block
    !
    !================================================!
    use w90_error, only: w90_error_type, set_error_input

    implicit none

    type(kpoint_path_type), intent(inout) :: kpoint_path
    type(w90_error_type), allocatable, intent(out) :: error
    type(w90_comm_type), intent(in) :: comm
    type(settings_type), intent(inout) :: settings

    character(len=22) :: keyword
    integer           :: ic, in, ins, ine, loop, inner_loop, i, line_e, line_s, counter
    logical           :: found_e, found_s
    character(len=maxlen) :: dummy, end_st, start_st

    keyword = "explicit_kpath_labels"

    found_s = .false.
    found_e = .false.

    start_st = 'begin '//trim(keyword)
    end_st = 'end '//trim(keyword)

    do loop = 1, settings%num_lines
      ins = index(settings%in_data(loop), trim(keyword))
      if (ins == 0) cycle
      in = index(settings%in_data(loop), 'begin')
      if (in == 0 .or. in > 1) cycle
      line_s = loop
      if (found_s) then
        call set_error_input(error, 'Error: Found '//trim(start_st)//' more than once in input file', comm)
        return
      end if
      found_s = .true.
    end do

    do loop = 1, settings%num_lines
      ine = index(settings%in_data(loop), trim(keyword))
      if (ine == 0) cycle
      in = index(settings%in_data(loop), 'end')
      if (in == 0 .or. in > 1) cycle
      line_e = loop
      if (found_e) then
        call set_error_input(error, 'Error: Found '//trim(end_st)//' more than once in input file', comm)
        return
      end if
      found_e = .true.
    end do

    if (found_s .and. .not. found_e) then
      call set_error_input(error, 'Error: Found '//trim(start_st)//' but no '//trim(end_st)//' in input file', comm)
      return
    end if

    if (found_s .and. found_e) then
      if (line_e <= line_s) then
        call set_error_input(error, 'Error: '//trim(end_st)//' comes before '//trim(start_st)//' in input file', comm)
        return
      end if
    else
      return !just not found
    end if

    counter = 0
    do loop = line_s + 1, line_e - 1

      counter = counter + 1
      dummy = settings%in_data(loop)
      read (dummy, *, err=240, end=240) kpoint_path%labels(counter), (kpoint_path%points(i, counter), i=1, 3)
    end do

    ! Upper case bands labels (eg, x --> X)
    if (allocated(kpoint_path%labels)) then
      do loop = 1, size(kpoint_path%labels)
        do inner_loop = 1, len(kpoint_path%labels(loop))
          ic = ichar(kpoint_path%labels(loop) (inner_loop:inner_loop))
          if ((ic .ge. ichar('a')) .and. (ic .le. ichar('z'))) &
            kpoint_path%labels(loop) (inner_loop:inner_loop) = char(ic + ichar('Z') - ichar('z'))
        end do
      end do
    end if

    settings%in_data(line_s:line_e) (1:maxlen) = ' '

    return

240 call set_error_input(error, 'w90_readwrite_get_keyword_kpath: Problem reading explicit kpath '//trim(dummy), comm)
    return
  end subroutine w90_readwrite_get_keyword_explicit_kpath