Fill_ExplicitRDM_this_Iter Subroutine

public subroutine Fill_ExplicitRDM_this_Iter(TotWalkers)

Arguments

Type IntentOptional Attributes Name
integer(kind=int64), intent(in) :: TotWalkers

Contents


Source Code

    subroutine Fill_ExplicitRDM_this_Iter(TotWalkers)

        use FciMCData, only: CurrentDets
        use global_utilities, only: set_timer, halt_timer
        use Parallel_neci, only: iProcIndex, MPIAllReduceDataType
        use MPI_wrapper, only: MPI_MAXLOC, MPI_2integer
        use rdm_data, only: nElRDM_Time

        integer(int64), intent(in) :: TotWalkers
        integer(n_int) :: iLutnI(0:NIfTot)
        integer(int64) :: MaxTotWalkers, TotWalkIn(2), TotWalkOut(2)
        integer :: i, error
        real(dp) :: TempTotParts, NormalisationTemp, Sum_Coeffs
        logical :: blank_det
        integer :: SignI(lenof_sign), SignI2(lenof_sign)

        ! Run through the current determinants.
        ! Find the max number of determinants on a processor - all need to
        ! run through this number so that the communication can be done at
        ! all stages.

        TotWalkIn(1) = TotWalkers
        TotWalkIn(2) = iProcIndex

        call MPIAllReduceDatatype(TotWalkIn, 1, MPI_MAXLOC, MPI_2integer, TotWalkOut)

        MaxTotWalkers = TotWalkOut(1)

        call set_timer(nElRDM_Time, 30)

        do i = 1, int(MaxTotWalkers)

            ! But if the actual number of determinants on this processor is
            ! less than the number  we're running through, feed in 0
            ! determinants and 0 sign.
            if (i > TotWalkers) then
                iLutnI(:) = 0
                blank_det = .true.
            else
                iLutnI(:) = CurrentDets(:, i)
                blank_det = .false.
            end if

            call Add_ExplicitRDM_Contrib(iLutnI, blank_det)

        end do

        call halt_timer(nElRDM_Time)

    end subroutine Fill_ExplicitRDM_this_Iter