Read MPI distribution of k-points The array to be read must have num_kpt entries, with each entry being the MPI rank to which each k-point is assigned
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(settings_type), | intent(inout) | :: | settings | |||
| integer, | intent(inout), | allocatable | :: | distk(:) | ||
| integer, | intent(in) | :: | nkin | |||
| integer, | intent(in) | :: | stdout | |||
| type(w90_error_type), | intent(out), | allocatable | :: | error | ||
| type(w90_comm_type), | intent(in) | :: | comm |
subroutine w90_readwrite_read_distk(settings, distk, nkin, stdout, error, comm) !! Read MPI distribution of k-points !! The array to be read must have num_kpt entries, with each entry being !! the MPI rank to which each k-point is assigned use w90_error, only: w90_error_type, set_error_input, set_error_alloc, set_error_fatal use w90_comms, only: mpirank implicit none integer, allocatable, intent(inout) :: distk(:) integer, intent(in) :: nkin integer, intent(in) :: stdout type(settings_type), intent(inout) :: settings type(w90_comm_type), intent(in) :: comm type(w90_error_type), allocatable, intent(out) :: error integer :: ik, nk, ierr logical :: found found = .false. call w90_readwrite_get_range_vector(settings, 'distk', found, nk, .true., error, comm) if (allocated(error)) return if (found .and. allocated(settings%in_data)) then ! distk is valid only in library mode, prevent .win abuse call set_error_input(error, 'Error: distk is not a .win file input token', comm) return end if if (found) then if (nk /= nkin) then call set_error_input(error, 'Error: incorrect length of k-distribution (distk)', comm) return end if allocate (distk(nkin), stat=ierr) if (ierr /= 0) then call set_error_alloc(error, 'Error in allocating distk in w90_readwrite_read_distk', comm) return end if call w90_readwrite_get_range_vector(settings, 'distk', found, nk, .false., error, comm, distk) if (allocated(error)) return do ik = 1, nkin if (distk(ik) < 0 .or. distk(ik) >= mpisize(comm)) then call set_error_fatal(error, 'Rank in distk table outside of mpi_size in w90_readwrite_read_distk', comm) return end if end do else if (mpirank(comm) == 0) then write (stdout, '(a)') 'Note: no parallel distribution provided (option distk missing)' write (stdout, '(a)') 'Note: all k-points handled by MPI rank 0' end if allocate (distk(nkin), stat=ierr) if (ierr /= 0) then call set_error_alloc(error, 'Error in allocating distk in w90_readwrite_read_distk', comm) return end if distk = 0 ! default to no distribution if not specified end if end subroutine w90_readwrite_read_distk