Read the eigenvalues from wannier.eig
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| logical, | intent(inout) | :: | eig_found | |||
| real(kind=dp), | intent(inout) | :: | eigval(:,:) | |||
| integer, | intent(in) | :: | num_bands | |||
| integer, | intent(in) | :: | num_kpts | |||
| integer, | intent(in) | :: | stdout | |||
| character(len=*), | intent(in) | :: | seedname | |||
| type(w90_error_type), | intent(out), | allocatable | :: | error | ||
| type(w90_comm_type), | intent(in) | :: | comm |
subroutine w90_readwrite_read_eigvals(eig_found, eigval, num_bands, num_kpts, stdout, & seedname, error, comm) !! Read the eigenvalues from wannier.eig use w90_error, only: w90_error_type, set_error_file, set_error_file, set_error_alloc implicit none ! arguments character(len=*), intent(in) :: seedname integer, intent(in) :: num_bands, num_kpts integer, intent(in) :: stdout logical, intent(inout) :: eig_found real(kind=dp), intent(inout) :: eigval(:, :) type(w90_comm_type), intent(in) :: comm type(w90_error_type), allocatable, intent(out) :: error ! local integer :: i, j, k, n, eig_unit inquire (file=trim(seedname)//'.eig', exist=eig_found) if (.not. eig_found) then call set_error_file(error, 'No '//trim(seedname)//'.eig file found. Needed for disentanglement', comm) return else open (newunit=eig_unit, file=trim(seedname)//'.eig', form='formatted', status='old', err=105) do k = 1, num_kpts do n = 1, num_bands read (eig_unit, *, err=106, end=106) i, j, eigval(n, k) if ((i .ne. n) .or. (j .ne. k)) then write (stdout, '(a)') 'Found a mismatch in '//trim(seedname)//'.eig' write (stdout, '(a,i0,a,i0)') 'Wanted band : ', n, ' found band : ', i write (stdout, '(a,i0,a,i0)') 'Wanted kpoint: ', k, ' found kpoint: ', j write (stdout, '(a)') ' ' write (stdout, '(a)') 'A common cause of this error is using the wrong' write (stdout, '(a)') 'number of bands. Check your input files.' write (stdout, '(a)') 'If your pseudopotentials have shallow core states remember' write (stdout, '(a)') 'to account for these electrons.' write (stdout, '(a)') ' ' call set_error_file(error, 'w90_wannier90_readwrite_read: mismatch in '//trim(seedname)//'.eig', comm) return end if end do end do close (eig_unit) end if return 105 call set_error_file(error, 'Error: Problem opening eigenvalue file '//trim(seedname)//'.eig', comm) return 106 call set_error_file(error, 'Error: Problem reading eigenvalue file '//trim(seedname)//'.eig', comm) return end subroutine w90_readwrite_read_eigvals