Fills the kpath data block
| Type | Intent | Optional | 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 |
subroutine w90_readwrite_get_keyword_kpath(settings, kpoint_path, error, comm) !================================================! ! !! Fills the kpath 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=20) :: 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 = "kpoint_path" 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 + 2 dummy = settings%in_data(loop) read (dummy, *, err=240, end=240) kpoint_path%labels(counter - 1), & (kpoint_path%points(i, counter - 1), i=1, 3), & 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 kpath '//trim(dummy), comm) return end subroutine w90_readwrite_get_keyword_kpath