pure function calcB_vector_ilut(ilut) result(bVector)
! function to calculate bVector of length (nBasis) for a given
! CSF bitRep ilut of length (2*nBasis), save this b-vector
! in the nI array, normally used to store occupied orbitals
! update: changed convention to not use nI for bVector but also for
! occupied orbitals as in normal NECI implementation
! but nethertheless need a b-vector of lenght of spatial orbitals
! for excitaiton and matrix element calculation
! UPDATE: change b vector calculation to update b vector directly on
! the spot of the corresponding stepvector, eg:
! d = 0 1 2 3
! b = 0 1 0 0
! because otherwise i actually only needed the bvector of one orbital
! ahead. and never the first entry otherwise. and that would cause
! problems when accessing b vector at the end of an excitaiton if
! that is the last orbital..
integer(n_int), intent(in) :: ilut(0:GugaBits%len_orb)
real(dp) :: bVector(nSpatOrbs) ! b-vector stored in bVector
integer :: i
real(dp) :: bValue
! loop over CSF entries and increment, decrement bValue
! accordingly, have to correctly access ilut entries and
! check if they are 0,1,2 or 3... -> how to for multiple
! integers?
bVector = 0.0_dp
bValue = 0.0_dp
do i = 1, nSpatOrbs
if (isOne(ilut, i)) then
bValue = bValue + 1.0_dp
else if (isTwo(ilut, i)) then
bValue = bValue - 1.0_dp
end if
! define bvalue to always only get updated for the next
! UPDATE: changed definition to update on the spot.
bVector(i) = bValue
end do
end function calcB_vector_ilut