Fills the kpath data block
subroutine param_get_keyword_kpath
!===================================!
! !
!! Fills the kpath data block
! !
!===================================!
use w90_io, only: io_error
implicit none
character(len=20) :: keyword
integer :: in, ins, ine, 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, num_lines
ins = index(in_data(loop), trim(keyword))
if (ins == 0) cycle
in = index(in_data(loop), 'begin')
if (in == 0 .or. in > 1) cycle
line_s = loop
if (found_s) then
call io_error('Error: Found '//trim(start_st)//' more than once in input file')
endif
found_s = .true.
end do
do loop = 1, num_lines
ine = index(in_data(loop), trim(keyword))
if (ine == 0) cycle
in = index(in_data(loop), 'end')
if (in == 0 .or. in > 1) cycle
line_e = loop
if (found_e) then
call io_error('Error: Found '//trim(end_st)//' more than once in input file')
endif
found_e = .true.
end do
if (.not. found_e) then
call io_error('Error: Found '//trim(start_st)//' but no '//trim(end_st)//' in input file')
end if
if (line_e <= line_s) then
call io_error('Error: '//trim(end_st)//' comes before '//trim(start_st)//' in input file')
end if
counter = 0
do loop = line_s + 1, line_e - 1
counter = counter + 2
dummy = in_data(loop)
read (dummy, *, err=240, end=240) bands_label(counter - 1), (bands_spec_points(i, counter - 1), i=1, 3) &
, bands_label(counter), (bands_spec_points(i, counter), i=1, 3)
end do
in_data(line_s:line_e) (1:maxlen) = ' '
return
240 call io_error('param_get_keyword_kpath: Problem reading kpath '//trim(dummy))
end subroutine param_get_keyword_kpath