subroutine w90_readwrite_clean_infile(settings, stdout, seedname, error, comm)
use w90_error, only: w90_error_type, set_error_input, set_error_dealloc
implicit none
integer, intent(in) :: stdout
character(len=*), intent(in) :: seedname
type(w90_error_type), allocatable, intent(out) :: error
type(w90_comm_type), intent(in) :: comm
type(settings_type), intent(inout) :: settings
integer :: loop, ierr
! filter out any remaining accepted keywords from both wannier90.x and postw90.x sets
! assumes settings%in_data is allocated
call w90_readwrite_clear_keywords(settings, error, comm)
if (allocated(error)) return
if (any(len_trim(settings%in_data(:)) > 0)) then
write (stdout, '(1x,a)') 'The following section of file '//trim(seedname)//'.win contained unrecognised keywords'
write (stdout, *)
do loop = 1, settings%num_lines
if (len_trim(settings%in_data(loop)) > 0) then
write (stdout, '(1x,a)') trim(settings%in_data(loop))
end if
end do
write (stdout, *)
call set_error_input(error, 'Unrecognised keyword(s) in input file, see also output file', comm)
return
end if
deallocate (settings%in_data, stat=ierr)
if (ierr /= 0) then
call set_error_dealloc(error, 'Error deallocating in_data in w90_readwrite_clean_infile', comm)
return
end if
settings%num_lines = 0
end subroutine w90_readwrite_clean_infile