LCOV - code coverage report
Current view: top level - wannier/uhu - wann_uHu_util.F (source / functions) Hit Total Coverage
Test: FLEUR test coverage Lines: 0 21 0.0 %
Date: 2024-03-28 04:22:06 Functions: 0 2 0.0 %

          Line data    Source code
       1             :       module m_wann_uHu_util
       2             :       implicit none
       3             :       contains
       4             : 
       5           0 :       subroutine array_split(nkpts,nnodes,counts,displs)
       6             :       implicit none
       7             :       integer, intent(in) :: nkpts,nnodes
       8             :       integer, intent(inout) :: counts(0:nnodes-1),displs(0:nnodes-1)
       9             :       integer :: ratio,remainder,i
      10             : 
      11           0 :       counts = 0; displs = 0
      12             : 
      13           0 :       ratio = nkpts / nnodes
      14           0 :       remainder = mod(nkpts,nnodes)
      15           0 :       do i=0,nnodes-1
      16           0 :        if(i<remainder) then
      17           0 :         counts(i) = ratio+1
      18           0 :         displs(i) = i*(ratio+1)
      19             :        else
      20           0 :         counts(i) = ratio
      21           0 :         displs(i) = remainder*(ratio+1) + (i-remainder)*ratio
      22             :        endif
      23             :       enddo
      24             : 
      25           0 :       end subroutine array_split
      26             : 
      27             : 
      28           0 :       integer function kpt_on_node(nkpt,nnodes,counts,displs)
      29             :       implicit none
      30             :       integer,intent(in) :: nkpt,nnodes
      31             :       integer,intent(in) :: counts(0:nnodes-1),displs(0:nnodes-1)
      32             :       integer :: i
      33             : 
      34           0 :       if(nnodes.eq.1) then
      35           0 :        kpt_on_node=0
      36             :        return
      37             :       endif
      38             : 
      39           0 :       if(nkpt.le.counts(0)) then
      40           0 :        kpt_on_node=0
      41             :        return
      42           0 :       elseif(nkpt.gt.displs(nnodes-1)) then
      43           0 :        kpt_on_node = nnodes-1
      44             :        return
      45             :       endif
      46             : 
      47           0 :       do i=2,nnodes-1
      48           0 :        kpt_on_node=i-1
      49           0 :        if(nkpt.le.displs(i)) return
      50             :       enddo
      51             : 
      52             :       end function kpt_on_node
      53             : 
      54             :       end module m_wann_uHu_util

Generated by: LCOV version 1.14