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 : 7 : MODULE m_mpi_dist_forcetheorem 8 : #ifdef CPP_MPI 9 : use mpi 10 : #endif 11 : CONTAINS 12 : #ifndef CPP_OLDINTEL 13 0 : SUBROUTINE mpi_dist_forcetheorem(fmpi,forcetheo) 14 : USE m_types_mpi 15 : USE m_types_forcetheo, ONLY: t_forcetheo 16 : USE m_types_forcetheo_extended 17 : IMPLICIT NONE 18 : TYPE(t_mpi),INTENT(in)::fmpi 19 : CLASS(t_forcetheo),ALLOCATABLE,INTENT(INOUT)::forcetheo 20 : 21 : INTEGER::t,ierr 22 : #ifdef CPP_MPI 23 : 24 0 : IF (fmpi%irank==0) THEN 25 : SELECT TYPE(forcetheo) 26 : TYPE IS (t_forcetheo) 27 0 : t=1 28 : TYPE IS (t_forcetheo_mae) 29 0 : t=2 30 : TYPE IS (t_forcetheo_ssdisp) 31 0 : t=3 32 : TYPE IS (t_forcetheo_dmi) 33 0 : t=4 34 : TYPE IS (t_forcetheo_jij) 35 0 : t=5 36 : END SELECT 37 : ENDIF 38 0 : CALL MPI_BCAST(t,1,MPI_INTEGER,0,fmpi%mpi_comm,ierr) 39 0 : IF (fmpi%irank.NE.0) THEN 40 0 : IF (ALLOCATED(forcetheo)) DEALLOCATE(forcetheo) 41 0 : SELECT CASE (t) 42 : CASE(1) 43 0 : ALLOCATE(t_forcetheo::forcetheo) 44 : CASE(2) 45 0 : ALLOCATE(t_forcetheo_mae::forcetheo) 46 : CASE(3) 47 0 : ALLOCATE(t_forcetheo_ssdisp::forcetheo) 48 : CASE(4) 49 0 : ALLOCATE(t_forcetheo_dmi::forcetheo) 50 : CASE(5) 51 0 : ALLOCATE(t_forcetheo_jij::forcetheo) 52 : END SELECT 53 : END IF 54 : 55 : !now we have the correct type, now we have to distribute the data 56 : SELECT TYPE(forcetheo) 57 : TYPE IS (t_forcetheo_mae) 58 0 : CALL forcetheo%dist(fmpi) 59 : TYPE IS (t_forcetheo_ssdisp) 60 0 : CALL forcetheo%dist(fmpi) 61 : TYPE IS (t_forcetheo_dmi) 62 0 : CALL forcetheo%dist(fmpi) 63 : TYPE IS (t_forcetheo_jij) 64 0 : CALL forcetheo%dist(fmpi) 65 : END SELECT 66 : #endif 67 0 : END SUBROUTINE mpi_dist_forcetheorem 68 : #else 69 : #endif 70 : 71 0 : END MODULE m_mpi_dist_forcetheorem