LCOV - code coverage report
Current view: top level - mpi - mpi_bc_xcpot.F90 (source / functions) Hit Total Coverage
Test: combined.info Lines: 30 31 96.8 %
Date: 2019-09-08 04:53:50 Functions: 1 1 100.0 %

          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             : CONTAINS
       9          48 :   SUBROUTINE mpi_bc_xcpot(xcpot,mpi)
      10             :     USE m_types
      11             :     USE m_types_xcpot_libxc
      12             :     IMPLICIT NONE
      13             :     CLASS(t_xcpot),ALLOCATABLE,INTENT(INOUT):: xcpot
      14             :     TYPE(t_mpi),INTENT(IN)                  :: mpi
      15             : 
      16             : #ifdef CPP_MPI
      17             :     LOGICAL           :: l_relcor
      18             :     CHARACTER(len=100):: namex
      19             :     INTEGER           :: ierr,n,i(5)
      20             :     INCLUDE 'mpif.h'
      21             : 
      22          48 :     IF (mpi%isize==1) RETURN !nothing to be done with only one PE
      23             :     !First determine type on pe0
      24          48 :     IF (mpi%irank==0) THEN
      25             :        SELECT TYPE(xcpot)
      26             :        TYPE IS (t_xcpot_inbuild)
      27          22 :           n=1
      28             :        TYPE IS (t_xcpot_libxc)
      29           2 :           n=2
      30             :        CLASS DEFAULT
      31           0 :           CALL judft_error("Type could not be determined in mpi_bc_xcpot")
      32             :        END SELECT
      33             :     END IF
      34          48 :     CALL MPI_BCAST(n,1,MPI_INTEGER,0,mpi%mpi_comm,ierr)
      35          48 :     IF (mpi%irank /= 0) THEN
      36          24 :        IF (ALLOCATED(xcpot)) DEALLOCATE(xcpot)
      37             :        !Now we know the types and can allocate on the other PE type dependend
      38          22 :        SELECT CASE(n)
      39             :        CASE(1)
      40          22 :           ALLOCATE(t_xcpot_inbuild::xcpot)
      41             :        CASE(2)
      42           2 :           ALLOCATE(t_xcpot_libxc::xcpot)
      43             :        CASE DEFAULT
      44          24 :           CALL judft_error("Type bcast failed in mpi_bc_xcpot")
      45             :        END SELECT
      46             :     END IF
      47             :     !Now we can do the the type dependend bc
      48             :     SELECT TYPE(xcpot)
      49             :     TYPE IS (t_xcpot_inbuild)
      50          44 :        IF (mpi%irank==0) THEN
      51          22 :           namex=xcpot%get_name()
      52          22 :           l_relcor=xcpot%DATA%krla==1
      53          22 :           n=SIZE(xcpot%lda_atom)
      54             :        ENDIF
      55          44 :        CALL MPI_BCAST(namex,4,MPI_CHARACTER,0,mpi%mpi_comm,ierr)
      56          44 :        CALL MPI_BCAST(l_relcor,1,MPI_LOGICAL,0,mpi%mpi_comm,ierr)
      57          44 :        CALL MPI_BCAST(n,1,MPI_INTEGER,0,mpi%mpi_comm,ierr)
      58          44 :        IF (mpi%irank /= 0)  CALL xcpot%init(namex(1:4),l_relcor,n)
      59          88 :        CALL MPI_BCAST(xcpot%lda_atom,n,MPI_LOGICAL,0,mpi%mpi_comm,ierr)
      60             :     TYPE IS (t_xcpot_libxc)
      61           4 :        IF (mpi%irank==0) THEN
      62           2 :           i(1) = xcpot%jspins
      63           2 :           i(2) = xcpot%func_vxc_id_x
      64           2 :           i(3) = xcpot%func_vxc_id_c
      65           2 :           i(4) = xcpot%func_exc_id_x
      66           2 :           i(5) = xcpot%func_exc_id_c
      67             :        ENDIF
      68           4 :        CALL MPI_BCAST(i,size(i),MPI_INTEGER,0,mpi%mpi_comm,ierr)
      69           8 :         IF (mpi%irank /= 0)  CALL xcpot%init(i(1),i(2),i(3),i(4),i(5)) 
      70             :     END SELECT
      71             : #endif
      72             :   END SUBROUTINE mpi_bc_xcpot
      73         140 : END MODULE m_mpi_bc_xcpot

Generated by: LCOV version 1.13