LCOV - code coverage report
Current view: top level - wannier - wann_write_matrix4.F (source / functions) Hit Total Coverage
Test: combined.info Lines: 0 29 0.0 %
Date: 2019-09-08 04:53:50 Functions: 0 1 0.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             : 
       7             :       module m_wann_write_matrix4
       8             :       contains
       9           0 :       subroutine wann_write_matrix4(
      10             :      >               mpi_comm,l_p0,filename,title,
      11             :      >               num_bands1,num_bands2,
      12             :      >               num_dims,fullnkpts,
      13             :      >               irank,isize,
      14           0 :      <               matrix4)
      15             : c*************************************************************
      16             : c     This subroutine is used to write several matrices to 
      17             : c     files. The corresponding 
      18             : c     filename has to be provided as input. 
      19             : c
      20             : c     MPI-Version: Collect the contributions to the matrix
      21             : c     from the various processors.
      22             : c
      23             : c     Frank Freimuth
      24             : c*************************************************************
      25             :       implicit none
      26             :       integer, intent(in)    :: mpi_comm
      27             :       logical, intent(in)    :: l_p0
      28             :       character, intent(in)  :: filename*(*)
      29             :       character, intent(in)  :: title*(*)
      30             : 
      31             :       integer, intent(in)    :: num_bands1
      32             :       integer, intent(in)    :: num_bands2
      33             : 
      34             :       integer, intent(in)    :: num_dims
      35             :       integer, intent(in)    :: fullnkpts
      36             : 
      37             :       integer, intent(in)    :: irank,isize
      38             : 
      39             :       complex, intent(inout) :: matrix4(:,:,:,:)
      40             : 
      41             :       integer :: ikpt,i,j,ii,jj
      42             :       integer :: cpu_index,dir
      43             : #ifdef CPP_MPI
      44             :       include 'mpif.h'
      45             :       integer :: ierr(3)
      46             :       integer :: stt(MPI_STATUS_SIZE)
      47             : #include "cpp_double.h"
      48             : #endif
      49             : 
      50             : #ifdef CPP_MPI
      51             : c**********************************************************
      52             : c     Collect contributions to the matrix4 matrix from the
      53             : c     various processors.
      54             : c**********************************************************
      55           0 :         print*,"dim1=",size(matrix4,1)
      56           0 :         print*,"dim2=",size(matrix4,2)
      57           0 :         print*,"dim3=",size(matrix4,3)
      58           0 :         print*,"dim4=",size(matrix4,4)
      59           0 :       if(isize.ne.1)then
      60           0 :        do ikpt=1,fullnkpts
      61           0 :         if(l_p0)then
      62           0 :          do cpu_index=1,isize-1
      63           0 :           if(mod(ikpt-1,isize).eq.cpu_index)then
      64             :            call MPI_RECV(
      65             :      &             matrix4(1:num_dims,1:num_bands1,
      66             :      &             1:num_bands2,ikpt),
      67             :      &             num_bands1*num_bands2*num_dims,
      68             :      &             CPP_MPI_COMPLEX,cpu_index,
      69           0 :      &             ikpt,mpi_comm,stt,ierr)
      70             :           endif !processors
      71             :          enddo !cpu_index
      72             :         else
      73           0 :          if(mod(ikpt-1,isize).eq.irank)then
      74             :            call MPI_SEND(
      75             :      &             matrix4(1:num_dims,1:num_bands1,
      76             :      &             1:num_bands2,ikpt),
      77             :      &             num_bands1*num_bands2*num_dims,
      78             :      &             CPP_MPI_COMPLEX,0,
      79           0 :      &             ikpt,mpi_comm,ierr)
      80             :          endif !processors
      81             :         endif ! l_p0
      82           0 :         call MPI_BARRIER(mpi_comm,ierr)
      83             :        enddo !ikpt 
      84             :       endif !isize
      85             : #endif
      86             : 
      87           0 :       write(6,*)"wann_write_matrix4"
      88             : 
      89           0 :       if(l_p0)then
      90           0 :        open (305,file=filename)
      91           0 :        write (305,*)title
      92           0 :        write (305,'(3i5)') num_bands1,num_bands1,fullnkpts
      93           0 :        do ikpt=1,fullnkpts
      94           0 :         do i = 1,num_bands2
      95           0 :          do j = 1,num_bands1
      96           0 :           do dir=1,num_dims  
      97           0 :              write (305,'(4i5,3x,2f18.12)') dir,j,i,ikpt,
      98           0 :      &              real(matrix4(dir,j,i,ikpt)),
      99           0 :      &              aimag(matrix4(dir,j,i,ikpt))
     100             :           enddo !dir 
     101             :          enddo !j
     102             :         enddo !i
     103             :        enddo !ikpt
     104           0 :        close(305)
     105             :       endif
     106             : 
     107           0 :       end subroutine wann_write_matrix4
     108             :       end module m_wann_write_matrix4

Generated by: LCOV version 1.13