subspace_extraction_ftlm Subroutine

public subroutine subspace_extraction_ftlm()

Arguments

None

Contents


Source Code

    subroutine subspace_extraction_ftlm()

        integer :: lwork, info, i
        real(dp), allocatable :: work(:)

        if (iProcIndex /= root) return

        ! Scrap space for the diagonaliser.
        lwork = max(1, 3 * n_lanc_vecs_ftlm - 1)
        allocate(work(lwork))

        ! This routine diagonalises a symmetric matrix, A.
        ! V tells the routine to calculate eigenvalues *and* eigenvectors.
        ! U tells the routine to get the upper half of A (it is symmetric).
        ! n_lanc_vecs_ftlm is the number of rows and columns in A.
        ! A = ftlm_hamil. This matrix stores the eigenvectors in its columns on output.
        ! n_lanc_vecs_ftlm is the leading dimension of A.
        ! ftlm_h_eigv stores the eigenvalues on output.
        ! work is scrap space.
        ! lwork is the length of the work array.
        ! info = 0 on output if diagonalisation is successful.
        call dsyev('V', 'U', n_lanc_vecs_ftlm, ftlm_hamil, n_lanc_vecs_ftlm, ftlm_h_eigv, work, lwork, info)

        deallocate(work)

        ! Output all of the eigenvalues.
        do i = 1, n_lanc_vecs_ftlm
            write(ftlm_unit, '(1x,f15.10)', advance='no') ftlm_h_eigv(i)
        end do
        write(ftlm_unit, '()')

    end subroutine subspace_extraction_ftlm