det_removed_fill_diag_rdm Subroutine

public subroutine det_removed_fill_diag_rdm(spawn, one_rdms, iLutnI, av_sign, iter_occ, tLagrCorr)

Arguments

Type IntentOptional Attributes Name
type(rdm_spawn_t), intent(inout) :: spawn
type(one_rdm_t), intent(inout) :: one_rdms(:)
integer(kind=n_int), intent(in) :: iLutnI(0:nIfTot)
real(kind=dp), intent(in) :: av_sign(:)
real(kind=dp), intent(in) :: iter_occ(:)
logical, intent(in), optional :: tLagrCorr

Contents


Source Code

    subroutine det_removed_fill_diag_rdm(spawn, one_rdms, iLutnI, av_sign, iter_occ, tLagrCorr)

        ! This routine is called if a determinant is removed from the list of
        ! currently occupied. At this point we need to add in its diagonal
        ! contribution for the number of iterations it has been occupied (or
        ! since the contribution was last included).

        use bit_reps, only: decode_bit_det
        use DetBitOps, only: FindBitExcitLevel
        use CalcData, only: NMCyc
        use FciMCData, only: iLutHF_True, Iter, IterRDMStart, PreviousCycles
        use LoggingData, only: RDMEnergyIter
        use rdm_data, only: one_rdm_t
        use SystemData, only: max_ex_level

        type(rdm_spawn_t), intent(inout) :: spawn
        type(one_rdm_t), intent(inout) :: one_rdms(:)
        integer(n_int), intent(in) :: iLutnI(0:nIfTot)
        real(dp), intent(in) :: av_sign(:), iter_occ(:)
        logical, intent(in), optional :: tLagrCorr

        integer :: nI(nel), ExcitLevel
        logical :: tLC

        if (present(tLagrCorr)) then
            tLC = tLagrCorr
        else
            tLC = .true.
        end if

        ! If the determinant is removed on an iteration that the diagonal
        ! RDM elements are  already being calculated, it will already have
        ! been counted. So check this isn't the case first.
        if (.not. ((Iter == NMCyc) .or. (mod((Iter + PreviousCycles - IterRDMStart + 1), RDMEnergyIter) == 0))) then
            call decode_bit_det(nI, iLutnI)
            ExcitLevel = FindBitExcitLevel(iLutHF_True, iLutnI, max_ex_level)

            call fill_rdm_diag_currdet_norm(spawn, one_rdms, iLutnI, nI, ExcitLevel, av_sign, iter_occ, .false., tLC)
        end if

    end subroutine det_removed_fill_diag_rdm