Distribute the chk files
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(dis_manifold_type), | intent(inout) | :: | dis_manifold | |||
| type(wannier_data_type), | intent(inout) | :: | wannier_data | |||
| complex(kind=dp), | intent(inout) | :: | u_matrix(:,:,:) | |||
| complex(kind=dp), | intent(inout) | :: | u_matrix_opt(:,:,:) | |||
| complex(kind=dp), | intent(inout) | :: | m_matrix(:,:,:,:) | |||
| complex(kind=dp), | intent(inout) | :: | m_matrix_local(:,:,:,:) | |||
| real(kind=dp), | intent(inout) | :: | omega_invariant | |||
| integer, | intent(in) | :: | num_bands | |||
| integer, | intent(in) | :: | num_kpts | |||
| integer, | intent(in) | :: | num_wann | |||
| integer, | intent(in) | :: | nntot | |||
| character(len=20), | intent(inout) | :: | checkpoint | |||
| logical, | intent(inout) | :: | have_disentangled | |||
| integer, | intent(in) | :: | distk(:) | |||
| type(w90_error_type), | intent(out), | allocatable | :: | error | ||
| type(w90_comm_type), | intent(in) | :: | comm |
subroutine w90_readwrite_chkpt_dist(dis_manifold, wannier_data, u_matrix, u_matrix_opt, & m_matrix, m_matrix_local, omega_invariant, num_bands, & num_kpts, num_wann, nntot, checkpoint, have_disentangled, & distk, error, comm) !================================================! ! !! Distribute the chk files ! !================================================! use w90_constants, only: dp use w90_io, only: io_date, io_time use w90_comms, only: comms_bcast, w90_comm_type, mpirank use w90_error, only: w90_error_type, set_error_alloc implicit none ! arguments type(wannier_data_type), intent(inout) :: wannier_data type(dis_manifold_type), intent(inout) :: dis_manifold type(w90_error_type), allocatable, intent(out) :: error type(w90_comm_type), intent(in) :: comm integer, intent(in) :: num_bands integer, intent(in) :: num_wann integer, intent(in) :: num_kpts integer, intent(in) :: nntot integer, intent(in) :: distk(:) complex(kind=dp), intent(inout) :: u_matrix(:, :, :) complex(kind=dp), intent(inout) :: u_matrix_opt(:, :, :) complex(kind=dp), intent(inout) :: m_matrix_local(:, :, :, :) complex(kind=dp), intent(inout) :: m_matrix(:, :, :, :) !only alloc/assigned on root real(kind=dp), intent(inout) :: omega_invariant character(len=20), intent(inout) :: checkpoint logical, intent(inout) :: have_disentangled ! local variables integer :: ierr, ikl, nkl, ikg, rank logical :: on_root = .false. rank = mpirank(comm) if (rank == 0) on_root = .true. call comms_bcast(checkpoint, len(checkpoint), error, comm) if (allocated(error)) return ! assumes u is alloc'd on all nodes call comms_bcast(u_matrix(1, 1, 1), num_wann*num_wann*num_kpts, error, comm) if (allocated(error)) return ! assumes m is alloc'd on all nodes call comms_bcast(m_matrix(1, 1, 1, 1), num_wann*num_wann*nntot*num_kpts, error, comm) if (allocated(error)) return ! copy global m into local m nkl = count(distk(:) == rank) ikl = 1 do ikg = 1, num_kpts if (distk(ikg) == rank) then m_matrix_local(:num_wann, :num_wann, :, ikl) = m_matrix(:, :, :, ikg) ikl = ikl + 1 end if end do call comms_bcast(have_disentangled, 1, error, comm) if (allocated(error)) return if (have_disentangled) then if (.not. on_root) then if (.not. allocated(dis_manifold%lwindow)) then allocate (dis_manifold%lwindow(num_bands, num_kpts), stat=ierr) if (ierr /= 0) then call set_error_alloc(error, 'Error allocating lwindow in w90_readwrite_chkpt_dist', comm) return end if end if if (.not. allocated(dis_manifold%ndimwin)) then allocate (dis_manifold%ndimwin(num_kpts), stat=ierr) if (ierr /= 0) then call set_error_alloc(error, 'Error allocating ndimwin in w90_readwrite_chkpt_dist', comm) return end if end if end if call comms_bcast(dis_manifold%lwindow(1, 1), num_bands*num_kpts, error, comm) if (allocated(error)) return call comms_bcast(dis_manifold%ndimwin(1), num_kpts, error, comm) if (allocated(error)) return call comms_bcast(omega_invariant, 1, error, comm) if (allocated(error)) return end if call comms_bcast(u_matrix_opt(1, 1, 1), num_bands*num_wann*num_kpts, error, comm) if (allocated(error)) return call comms_bcast(wannier_data%centres(1, 1), 3*num_wann, error, comm) if (allocated(error)) return call comms_bcast(wannier_data%spreads(1), num_wann, error, comm) if (allocated(error)) return end subroutine w90_readwrite_chkpt_dist