check_reblock_monotonic_inc Subroutine

public subroutine check_reblock_monotonic_inc(these_errors, tPrint, iValue)

Arguments

Type IntentOptional Attributes Name
real(kind=dp), intent(in) :: these_errors(:)
logical, intent(in) :: tPrint
integer, intent(in) :: iValue

Contents


Source Code

    subroutine check_reblock_monotonic_inc(these_errors, tPrint, iValue)
        ! One of the simplest checks on the errors for F&P blocking analysis
        ! is to look for a monotonic increase in errors
        ! which indicates no tail-off/plateauing.
        ! General routine, does not require global data
        ! iValue indicates the value which is currently being blocked:
        ! 1 = denominantor
        ! 2 = real numerator
        ! 3 = shift
        ! 4 = imaginary numerator

        real(dp), intent(in) :: these_errors(:)
        logical, intent(in) :: tPrint
        integer, intent(in) :: iValue
        integer :: length
        integer :: i
        logical :: monotonic
        character(len=*), parameter :: t_r = 'check_reblock_monotonic_inc'

        monotonic = .true.
        length = size(these_errors)
        do i = 2, length
            if (these_errors(i) < these_errors(i - 1)) monotonic = .false.
        end do
        if (monotonic .and. tPrint) then
            if (iValue == 1) then
                write(stdout, "(A)") "WARNING: Error increases monotonically on the blocking graph for " &
                    & //"*denominator of projected energy*"
            else if (iValue == 2) then
                write(stdout, "(A)") "WARNING: Error increases monotonically on the blocking graph for " &
                    & //"*numerator of projected energy*"
            else if (iValue == 3) then
                write(stdout, "(A)") "WARNING: Error increases monotonically on the blocking graph for *shift*"
            else if (iValue == 4) then
                write(stdout, "(A)") "WARNING: Error increases monotonically on the blocking graph for " &
                    & //"*imaginary numerator of projected energy*"
            else
                call stop_all(t_r, "Unknown iValue passed in")
            end if
            write(stdout, "(A)") "         whilst performing Flyvbjerg and Petersen blocking analysis."
            write(stdout, "(A)") "         Inspect BLOCKING files carefully. Manual reblocking may be necessary."
        else if (monotonic .and. (ErrorDebug > 0)) then
            if (iValue == 1) then
                write(stdout, "(A)") "WARNING: Error increases monotonically on the blocking graph for " &
                    & //"*denominator of projected energy*"
            else if (iValue == 2) then
                write(stdout, "(A)") "WARNING: Error increases monotonically on the blocking graph for " &
                    & //"*numerator of projected energy*"
            else if (iValue == 3) then
                write(stdout, "(A)") "WARNING: Error increases monotonically on the blocking graph for *shift*"
            else if (iValue == 4) then
                write(stdout, "(A)") "WARNING: Error increases monotonically on the blocking graph for " &
                    & //"*imaginary numerator of projected energy*"
            else
                call stop_all(t_r, "Unknown iValue passed in")
            end if
            write(stdout, "(A)") "         whilst performing Flyvbjerg and Petersen blocking analysis. If this warning"
            write(stdout, "(A)") "         appears after equilibration time has been removed, then inspect"
            write(stdout, "(A)") "         BLOCKING files carefully"
        end if

    end subroutine check_reblock_monotonic_inc