LCOV - code coverage report
Current view: top level - wannier - wann_write_matrix5.F (source / functions) Hit Total Coverage
Test: combined.info Lines: 0 26 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_matrix5
       8             :       contains
       9           0 :       subroutine wann_write_matrix5(
      10             :      >               mpi_comm,l_p0,filename,title,
      11             :      >               num_bands1,num_bands2,
      12             :      >               num_dims1,num_dims2,fullnkpts,
      13             :      >               irank,isize,
      14           0 :      <               matrix5)
      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_dims1,num_dims2
      35             :       integer, intent(in)    :: fullnkpts
      36             : 
      37             :       integer, intent(in)    :: irank,isize
      38             : 
      39             :       complex, intent(inout) :: matrix5(:,:,:,:,:)
      40             : 
      41             :       integer :: ikpt,i,j,ii,jj
      42             :       integer :: cpu_index,dir,dir2
      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 matrix5 matrix from the
      53             : c     various processors.
      54             : c**********************************************************
      55           0 :       if(isize.ne.1)then
      56           0 :        do ikpt=1,fullnkpts
      57           0 :         if(l_p0)then
      58           0 :          do cpu_index=1,isize-1
      59           0 :           if(mod(ikpt-1,isize).eq.cpu_index)then
      60             :            call MPI_RECV(
      61             :      &             matrix5(1:num_dims1,1:num_dims2,
      62             :      &             1:num_bands1,1:num_bands2,ikpt),
      63             :      &             num_bands1*num_bands2*num_dims1*num_dims2,
      64             :      &             CPP_MPI_COMPLEX,cpu_index,
      65           0 :      &             ikpt,mpi_comm,stt,ierr)
      66             :           endif !processors
      67             :          enddo !cpu_index
      68             :         else
      69           0 :          if(mod(ikpt-1,isize).eq.irank)then
      70             :            call MPI_SEND(
      71             :      &             matrix5(1:num_dims1,1:num_dims2,
      72             :      &             1:num_bands1,1:num_bands2,ikpt),
      73             :      &             num_bands1*num_bands2*num_dims1*num_dims2,
      74             :      &             CPP_MPI_COMPLEX,0,
      75           0 :      &             ikpt,mpi_comm,ierr)
      76             :          endif !processors
      77             :         endif ! l_p0
      78           0 :         call MPI_BARRIER(mpi_comm,ierr)
      79             :        enddo !ikpt 
      80             :       endif !isize
      81             : #endif
      82             : 
      83           0 :       write(6,*)"wann_write_matrix5"
      84             : 
      85           0 :       if(l_p0)then
      86           0 :        open (305,file=filename)
      87           0 :        write (305,*)title
      88           0 :        write (305,'(3i5)') num_bands1,num_bands1,fullnkpts
      89           0 :        do ikpt=1,fullnkpts
      90           0 :         do i = 1,num_bands2
      91           0 :          do j = 1,num_bands1
      92           0 :           do dir=1,num_dims2
      93           0 :            do dir2=1,num_dims1
      94           0 :              write (305,'(5i5,3x,2f18.12)') dir2,dir,j,i,ikpt,
      95           0 :      &              real(matrix5(dir2,dir,j,i,ikpt)),
      96           0 :      &              aimag(matrix5(dir2,dir,j,i,ikpt))
      97             :            enddo !dir2  
      98             :           enddo !dir 
      99             :          enddo !j
     100             :         enddo !i
     101             :        enddo !ikpt
     102           0 :        close(305)
     103             :       endif
     104             : 
     105           0 :       end subroutine wann_write_matrix5
     106             :       end module m_wann_write_matrix5

Generated by: LCOV version 1.13