mult_hamil_vector_par_sparse_real Subroutine

public subroutine mult_hamil_vector_par_sparse_real(this, input_vector, output_vector)

Arguments

Type IntentOptional Attributes Name
type(HamiltonianCalcType), intent(inout) :: this
real(kind=dp), intent(in) :: input_vector(:)
real(kind=dp), intent(out) :: output_vector(:)

Contents


Source Code

    subroutine mult_hamil_vector_par_sparse_real(this, input_vector, output_vector)
        type(HamiltonianCalcType), intent(inout) :: this
        real(dp), intent(in) :: input_vector(:)
        real(dp), intent(out) :: output_vector(:)
        integer :: i, j, ierr

        ! Use output_vector as temporary space.
        output_vector = input_vector

        call MPIBarrier(ierr, tTimeIn=.false.)

        call MPIBCast(output_vector)

        this%partial_H_ket = 0.0_dp

        do i = 1, this%space_sizes(iProcIndex)
            do j = 1, sparse_ham(i)%num_elements
                this%partial_H_ket(i) = this%partial_H_ket(i) + &
                                        sparse_ham(i)%elements(j) * output_vector(sparse_ham(i)%positions(j))
            end do
        end do
        ! this templated routine forbids mixing real and complex arrays
        call MPIGatherV(real(this%partial_H_ket, dp), output_vector, this%space_sizes, this%partial_H_ket_disps, ierr)
    end subroutine mult_hamil_vector_par_sparse_real