calcFullStartFullStopMixed Subroutine

public subroutine calcFullStartFullStopMixed(ilut, csf_i, excitInfo, excitations, nExcits, posSwitches, negSwitches)

Arguments

Type IntentOptional Attributes Name
integer(kind=n_int), intent(in) :: ilut(0:nifguga)
type(CSF_Info_t), intent(in) :: csf_i
type(ExcitationInformation_t), intent(in) :: excitInfo
integer(kind=n_int), intent(out), allocatable :: excitations(:,:)
integer, intent(out) :: nExcits
real(kind=dp), intent(in) :: posSwitches(nSpatOrbs)
real(kind=dp), intent(in) :: negSwitches(nSpatOrbs)

Contents


Source Code

    subroutine calcFullStartFullStopMixed(ilut, csf_i, excitInfo, excitations, nExcits, &
                                          posSwitches, negSwitches)
        integer(n_int), intent(in) :: ilut(0:nifguga)
        type(CSF_Info_t), intent(in) :: csf_i
        type(ExcitationInformation_t), intent(in) :: excitInfo
        integer(n_int), intent(out), allocatable :: excitations(:, :)
        integer, intent(out) :: nExcits
        real(dp), intent(in) :: posSwitches(nSpatOrbs), negSwitches(nSpatOrbs)

        integer(n_int), allocatable :: tempExcits(:, :)
        real(dp) :: plusWeight, minusWeight, zeroWeight
        type(WeightObj_t) :: weights
        integer :: iOrb

        ! if 3 at full start or full end, this is then a diagonal element
        ! actually, and should thus be already treated by diagonal matrix
        ! calculator. -> should i take that into account for
        ! compatibility check and excitation type determination?
        ! probably yes! -> so assume such an excitation is not coming

        associate(st => excitInfo%fullStart, en => excitInfo%fullEnd)

            if (csf_i%stepvector(st) == 0 .or. csf_i%stepvector(en) == 0) then
                nExcits = 0
                allocate(excitations(0, 0))
                return
            end if

            if (csf_i%stepvector(st) == 3 .or. csf_i%stepvector(en) == 3) then
                nExcits = 1
                allocate(excitations(0:nifguga, nExcits))
                excitations(:, 1) = ilut
                call encode_matrix_element(excitations(:, 1), 0.0_dp, 2)
                call encode_matrix_element(excitations(:, 1), &
                                           -real(csf_i%Occ_int(st) * csf_i%Occ_int(en), dp) / 2.0_dp, 1)

                return
            end if

            ! so only have to deal with 1, or 2 at start and end -> write this
            ! function specifically for these cases.

            ! can i just use already implemented fullStart? i think
            weights = init_doubleWeight(csf_i, en)
            plusWeight = weights%proc%plus(posSwitches(st), csf_i%B_real(st), weights%dat)
            minusWeight = weights%proc%minus(negSwitches(st), csf_i%B_real(st), weights%dat)
            zeroWeight = weights%proc%zero(negSwitches(st), posSwitches(st), &
                                           csf_i%B_real(st), weights%dat)

            ! then call it
            call mixedFullStart(ilut, csf_i, excitInfo, plusWeight, minusWeight, zeroWeight, tempExcits, &
                                nExcits)

            ! and just do double update for the excitation region
            do iOrb = st + 1, en - 1
                call doubleUpdate(ilut, csf_i, iOrb, excitInfo, weights, tempExcits, nExcits, &
                                  negSwitches, posSwitches)
            end do

            ! and then to already implemented mixed end
            call mixedFullStop(ilut, csf_i, excitInfo, tempExcits, nExcits, excitations)

        end associate

    end subroutine calcFullStartFullStopMixed