Skip to content

Commit

Permalink
Merge pull request dftbplus#1432 from bhourahine/trivialHybTypeErr
Browse files Browse the repository at this point in the history
Correct real to int and make fn pure
  • Loading branch information
bhourahine authored Apr 12, 2024
2 parents c16ab71 + d748f1b commit b1893c6
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/dftbp/dftb/hybridxc.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1068,22 +1068,25 @@ subroutine updateCoords_kpts(this, env, symNeighbourList, nNeighbourCamSym, skOv

contains

!> Returns the number of non-zero elements in a descending array of reals.
!> Returns the number of non-zero elements in a descending array of non-negative reals.
function getNumberOfNonZeroElements(array) result(nNonZeroEntries)

!> Descending, one-dimensional, real-valued array to search
real(dp), intent(in) :: array(:)

!> Number of non-zero entries
real(dp) :: nNonZeroEntries
integer :: nNonZeroEntries

!! iterates over all array elements
integer :: ii

nNonZeroEntries = 0

do ii = 1, size(array)
if (array(ii) < 1e-16_dp) return
if (array(ii) < epsilon(1.0_dp)) then
@:ASSERT(all(array(ii:) >= 0.0_dp))
return
end if
nNonZeroEntries = ii
end do

Expand Down

0 comments on commit b1893c6

Please sign in to comment.