print_sl_eigenvecs Subroutine

public subroutine print_sl_eigenvecs()

Arguments

None

Contents

Source Code


Source Code

    subroutine print_sl_eigenvecs()

        use bit_rep_data, only: nifd
        use util_mod, only: get_free_unit

        integer :: ndets_this_proc, ndets_tot
        integer :: k, idet, iproc, iunit, ierr

        ndets_this_proc = ndets_sl(iProcIndex)
        ndets_tot = sum(ndets_sl)

        allocate(full_eigenvecs(ndets_this_proc, ndets_tot))

        ! The following operation returns the components of the eigenvectors in
        ! the full basis in the columns of full_eigenvecs.
        ! sl_hamil will now store the eigenvectors in the Lanczos basis in its
        ! columns. sl_vecs stores the components of the Lanczos vectors in the
        ! full basis in its columns.
        full_eigenvecs = matmul(sl_vecs, sl_hamil)

        if (iProcIndex == root) then
            iunit = get_free_unit()
            open(iunit, file='EIGENVECS', status='replace', recl=50000)
        end if

        do iproc = 0, nProcessors - 1
            if (iproc == iProcIndex) then
                do idet = 1, ndets_this_proc
                    do k = 0, nifd
                        write(iunit, '(i12)', advance='no') sl_ilut_list(k, idet)
                    end do
                    do k = 1, n_lanc_vecs_sl
                        write(iunit, '(f18.8)', advance='no') full_eigenvecs(idet, k)
                    end do
                    write(iunit, '()')
                end do
            end if
            call MPIBarrier(ierr)
        end do

        if (iProcIndex == root) close(iunit)

        deallocate(full_eigenvecs)

    end subroutine print_sl_eigenvecs