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

Generated by: LCOV version 1.13