Line data Source code
1 : module m_create_coul_comms 2 : use m_types 3 : implicit none 4 : contains 5 12 : subroutine create_coul_comms(hybdat, fi, fmpi) 6 : #ifdef CPP_MPI 7 : use mpi 8 : #endif 9 : implicit none 10 : type(t_hybdat), intent(inout) :: hybdat 11 : type(t_fleurinput), intent(in) :: fi 12 : TYPE(t_mpi), INTENT(IN) :: fmpi 13 : 14 : integer :: ik, color, key 15 : logical :: i_am_root 16 : 17 : #ifdef CPP_MPI 18 48 : do ik = 1,fi%kpts%nkpt 19 48 : if(hybdat%coul(ik)%comm == MPI_COMM_NULL) then 20 36 : i_am_root = (fmpi%n_rank == 0) .and. any(ik == fmpi%k_list) 21 : 22 18 : if(hybdat%coul(ik)%l_participate) then 23 18 : color = 1 24 : else 25 0 : color = 2 26 : endif 27 : 28 : ! put the root rank on 0, others don't care 29 18 : key = merge(0, fmpi%irank+1, i_am_root) 30 : 31 18 : call judft_comm_split(MPI_COMM_WORLD, color, key, hybdat%coul(ik)%comm) 32 : endif 33 : enddo 34 : #endif 35 12 : end subroutine 36 : end module m_create_coul_comms