perform_orthogonality_test Subroutine

public subroutine perform_orthogonality_test(this)

Arguments

Type IntentOptional Attributes Name
type(LanczosCalcType), intent(inout) :: this

Contents


Source Code

    subroutine perform_orthogonality_test(this)
        type(LanczosCalcType), intent(inout) :: this
        integer :: i, j
        real(dp) :: overlap, largest_overlap
        character(*), parameter :: t_r = "perform_orthogonality_test"
        largest_overlap = 0.0_dp
        if (this%n_states > 1) then
            do i = 2, this%n_states
                do j = 1, i - 1
                    overlap = inner_product(this%ritz_vectors(:, i), this%ritz_vectors(:, j))

                    if (abs(overlap) > largest_overlap) then
                        largest_overlap = abs(overlap)
                    end if
                    if (abs(overlap) > this%orthog_tolerance) then
                        write(stdout, '(" Largest Ritz vector overlap: ", 5ES16.7)') largest_overlap
                        call stop_all(t_r, "Ritz vector overlap is unacceptably large")
                    end if
                end do
            end do
            write(stdout, '(" Largest Ritz vector overlap: ", 5ES16.7)') largest_overlap
            write(stdout, '(" Ritz vectors are mutually orthogonal to a tolerance of ", 5ES16.7)') this%orthog_tolerance
        end if
    end subroutine perform_orthogonality_test