function determineKMatSize() result(kMatSize)
implicit none
integer(int64) :: kMatSize
integer :: nBI
nBI = numBasisIndices(nBasis)
! kmat has the same access pattern as umat, so use UMatInd as indexing function
! the index of the largest element
kMatSize = UMatInd(nBI, nBI, nBI, nBI)
end function determineKMatSize