mult_hamil_vector_par_sparse_complex Subroutine

public subroutine mult_hamil_vector_par_sparse_complex(this, input_vector, output_vector)

Arguments

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

Contents


Source Code

    subroutine mult_hamil_vector_par_sparse_complex(this, input_vector, output_vector)
        type(HamiltonianCalcType), intent(inout) :: this
        complex(dp), intent(in) :: input_vector(:)
        complex(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
#ifdef CMPLX_
                this%partial_H_ket(i) = this%partial_H_ket(i) + &
                                        sparse_ham(i)%elements(j) * output_vector(sparse_ham(i)%positions(j))
#endif
            end do
        end do
#ifdef CMPLX_
        call MPIGatherV(this%partial_H_ket, output_vector, this%space_sizes, this%partial_H_ket_disps, ierr)
#else
        call MPIGatherV(cmplx(this%partial_H_ket, 0.0_dp, dp), output_vector, this%space_sizes, this%partial_H_ket_disps, ierr)
#endif
        !call MPIGatherV(this%partial_H_ket, output_vector, this%space_sizes, this%partial_H_ket_disps, ierr)
    end subroutine mult_hamil_vector_par_sparse_complex