Returns the UMatInd values of all possible permutations of the input indices @param[in] a,b,c,d orbital indices of a two-body element @return inds array of size 4 containing the indices of UMat corresponding to these four orbitals (in this order) and their hermitian conjugates entries of 0 indicate that no position in UMat has to be addressed
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer, | intent(in) | :: | a | |||
integer, | intent(in) | :: | b | |||
integer, | intent(in) | :: | c | |||
integer, | intent(in) | :: | d |
function permute_umat_inds(a, b, c, d) result(inds)
integer, intent(in) :: a, b, c, d
integer(int64) :: inds(num_ex)
integer :: ct
inds = 0
! These are adjoint to each other, they are the same in LMat, but not UMat
inds(1) = UMatInd(a, b, c, d)
inds(2) = UMatInd(c, b, a, d)
inds(3) = UMatInd(a, d, c, b)
inds(4) = UMatInd(c, d, a, b)
! All terms are only counted if they are different from a previously occuring index
! This approach might be less performant than competing ways of doing this check,
! but it is very clear and less prone to bugs. If this proves to be a performance
! bottleneck, it can be changed to a faster implementation later on
do ct = 2, num_ex
! If the index already appeared, delete it
if(any(inds(ct) == inds(1:ct - 1))) inds(ct) = 0
end do
end function permute_umat_inds