Line data Source code
1 : !-------------------------------------------------------------------------------- 2 : ! Copyright (c) 2016 Peter Grünberg Institut, Forschungszentrum Jülich, Germany 3 : ! This file is part of FLEUR and available as free software under the conditions 4 : ! of the MIT license as expressed in the LICENSE file in more detail. 5 : !-------------------------------------------------------------------------------- 6 : MODULE m_mpi_bc_xcpot 7 : use m_judft 8 : #ifdef CPP_MPI 9 : use mpi 10 : #endif 11 : CONTAINS 12 0 : SUBROUTINE mpi_bc_xcpot(xcpot,fmpi) 13 : 14 : USE m_types 15 : USE m_types_xcpot_libxc 16 : IMPLICIT NONE 17 : CLASS(t_xcpot),ALLOCATABLE,INTENT(INOUT):: xcpot 18 : TYPE(t_mpi),INTENT(IN) :: fmpi 19 : 20 : #ifdef CPP_MPI 21 : LOGICAL :: l_relcor 22 : CHARACTER(len=100):: namex 23 : INTEGER :: ierr,n,i(5) 24 : 25 0 : IF (fmpi%isize==1) RETURN !nothing to be done with only one PE 26 : !First determine type on pe0 27 0 : IF (fmpi%irank==0) THEN 28 : SELECT TYPE(xcpot) 29 : TYPE IS (t_xcpot_inbuild) 30 0 : n=1 31 : TYPE IS (t_xcpot_libxc) 32 0 : n=2 33 : CLASS DEFAULT 34 0 : CALL judft_error("Type could not be determined in mpi_bc_xcpot") 35 : END SELECT 36 : END IF 37 0 : CALL MPI_BCAST(n,1,MPI_INTEGER,0,fmpi%mpi_comm,ierr) 38 0 : IF (fmpi%irank /= 0) THEN 39 0 : IF (ALLOCATED(xcpot)) DEALLOCATE(xcpot) 40 : !Now we know the types and can allocate on the other PE type dependend 41 0 : SELECT CASE(n) 42 : CASE(1) 43 0 : ALLOCATE(t_xcpot_inbuild::xcpot) 44 : CASE(2) 45 0 : ALLOCATE(t_xcpot_libxc::xcpot) 46 : CASE DEFAULT 47 0 : CALL judft_error("Type bcast failed in mpi_bc_xcpot") 48 : END SELECT 49 : END IF 50 : !Now we can do the the type dependend bc 51 0 : call xcpot%mpi_bc(fmpi%mpi_comm,0) 52 : #endif 53 : END SUBROUTINE mpi_bc_xcpot 54 0 : END MODULE m_mpi_bc_xcpot