Generate a histogram of the 6-index integrals and write it to stdout
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(lMat_t), | intent(in) | :: | this |
subroutine histogram_lMat(this)
class(lMat_t), intent(in) :: this
integer(int64) :: i
integer :: thresh
integer, parameter :: minExp = 10
integer :: histogram(0:minExp)
real :: ratios(0:minExp)
histogram = 0
do i = 1, this%lMat_size()
do thresh = minExp, 1, -1
! in each step, count all matrix elements that are below the threshold and
! have not been counted yet
if (abs(this%get_elem(i)) < 0.1**(thresh)) then
histogram(thresh) = histogram(thresh) + 1
! do not count this one again
exit
end if
end do
! the last check has a different form: everything that is bigger than 0.1 counts here
if (abs(this%get_elem(i)) > 0.1) histogram(0) = histogram(0) + 1
end do
ratios(:) = real(histogram(:)) / real(this%lMat_size())
! print the ratios
write(stdout, *) "Matrix elements below", 0.1**(minExp), ":", ratios(minExp)
do i = minExp - 1, 1, -1
write(stdout, *) "Matrix elements from", 0.1**(i + 1), "to", 0.1**(i), ":", ratios(i)
end do
write(stdout, *) "Matrix elements above", 0.1, ":", ratios(0)
write(stdout, *) "Total number of logged matrix elements", sum(histogram)
end subroutine histogram_lMat