subroutine gen_cum_list_real_hub_1(csf_i, orb_i, cum_arr)
type(CSF_Info_t), intent(in) :: csf_i
integer, intent(in) :: orb_i
real(dp), intent(out) :: cum_arr(nSpatOrbs)
real(dp) :: cum_sum
integer :: i, lower, upper
! for the case of d(i) = 1 i need to exclude d(j) = 1 when there
! is no switch possible in the middle
cum_sum = 0.0_dp
call find_switches(csf_i, orb_i, lower, upper)
! so from 1 to lower-1 d=1 is possible and allowed!
! if lower = 1 (default if no switch is found) no accessing loop anyway
do i = 1, lower - 1
! this means in this regime only doubly occupied orbs get
! excluded (i cant be orb_i also, since lower is strictly lower
! or 1, which means the loop is not entered!)
if (csf_i%stepvector(i) == 3) then
cum_arr(i) = cum_sum
else
cum_sum = cum_sum + abs(GetTMatEl(2 * orb_i, 2 * i))
cum_arr(i) = cum_sum
end if
end do
! do i loop from lower to upper now? or until orb_i - 1 ?
! i can loop until upper already, since d(i) = 1, which means it
! get excluded here anyway!
do i = lower, upper
! here d = 1 and d = 3 are excluded!
if (mod(csf_i%stepvector(i), 2) == 1) then
cum_arr(i) = cum_sum
else
cum_sum = cum_sum + abs(GetTMatEl(2 * orb_i, 2 * i))
cum_arr(i) = cum_sum
end if
end do
! from upper+1 until end everything except d = 3 is allowed again
do i = upper + 1, nSpatOrbs
if (csf_i%stepvector(i) == 3) then
cum_arr(i) = cum_sum
else
cum_sum = cum_sum + abs(GetTMatEl(2 * orb_i, 2 * i))
cum_arr(i) = cum_sum
end if
end do
end subroutine gen_cum_list_real_hub_1