Skip to content

Commit

Permalink
Only broadcast kdotp_bands if its allocated
Browse files Browse the repository at this point in the history
  • Loading branch information
sstgfbc committed Mar 3, 2022
1 parent 357b864 commit e592e45
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions src/postw90/postw90_common.F90
Original file line number Diff line number Diff line change
Expand Up @@ -674,16 +674,21 @@ subroutine pw90common_wanint_w90_wannier90_readwrite_dist(print_output, ws_regio
endif
end if

if (on_root) kdotp_nbands = size(pw90_berry%kdotp_bands)
kdotp_nbands = 0
if (on_root) then
if (allocated(pw90_berry%kdotp_bands)) kdotp_nbands = size(pw90_berry%kdotp_bands)
endif
call comms_bcast(kdotp_nbands, 1, error, comm)
if (.not. on_root) then
allocate (pw90_berry%kdotp_bands(kdotp_nbands), stat=ierr)
if (ierr /= 0) then
call set_error_alloc(error, 'Error allocating kdotp_bands in postw90_param_dist', comm)
return
if (kdotp_nbands > 0) then
if (.not. on_root) then
allocate (pw90_berry%kdotp_bands(kdotp_nbands), stat=ierr)
if (ierr /= 0) then
call set_error_alloc(error, 'Error allocating kdotp_bands in postw90_param_dist', comm)
return
endif
endif
call comms_bcast(pw90_berry%kdotp_bands(1), kdotp_nbands, error, comm)
endif
call comms_bcast(pw90_berry%kdotp_bands(1), kdotp_nbands, error, comm)

if (fermi_n > 0) then
call comms_bcast(fermi_energy_list(1), fermi_n, error, comm)
Expand Down

0 comments on commit e592e45

Please sign in to comment.