! !-------------------------------------------------------- subroutine poolgather (nsize, nkstot, nks, f_in, f_out) !-------------------------------------------------------- ! ! reduce the kpoints and the electronic eigenvalues ! across the pools (adapted from poolscatter by FG) ! ! USE kinds, only : DP #ifdef __PARA use para USE mp_global, ONLY : nproc, my_pool_id, nproc_pool, & inter_pool_comm, me_pool, root_pool, mpime USE mp, ONLY : mp_barrier, mp_bcast #endif implicit none ! INTEGER :: nsize, nkstot, nks ! first dimension of vectors f_in and f_out ! number of k-points per pool ! total number of k-points REAL (KIND=DP) :: f_in(nsize,nks), f_out(nsize,nkstot) ! input ( only for k-points of mypool ) ! output ( contains values for all k-point ) INTEGER :: rest, nbase ! the rest of the integer division nkstot / npo ! the position in the original list ! ! rest = nkstot / kunit - ( nkstot / kunit / npool ) * npool ! nbase = nks * my_pool_id ! IF ( ( my_pool_id + 1 ) > rest ) nbase = nbase + rest * kunit ! f_out = 0.d0 f_out(:,(nbase+1):(nbase+nks)) = f_in(:,1:nks) ! ! ... reduce across the pools ! call poolreduce ( nsize * nkstot, f_out ) ! ! return end subroutine poolgather !-------------------------------------------------------