SUBROUTINE GetUMatSize(nBasis, iSize)
use SystemData, only: tStoreSpinOrbs
! Get the prospective size of a UMat (not a UMatCache) for completely
! storing FCIDUMP 2-e integrals
! In:
! nBasis: as above.
! iSS: ratio of spatial orbitals to spin orbitals.
! iSS=0 integrals not stored in UMAT.
! iSS=1 unrestricted calculation
! iSS=2 restricted calculation
! iSS=-1 flag for the Hubbard model.
! Out:
! iSize: size of UMAT.
INTEGER nBasis, iSS
INTEGER iPairs, nBi
INTEGER(int64), intent(out) :: iSize
IF (tStoreSpinOrbs) THEN
iSS = 1
ELSE
iSS = 2
end if
nBi = nBasis / iSS
if (t_non_hermitian_2_body) then
iPairs = nbi**2
else
iPairs = (nBi * (nBi + 1)) / 2
end if
iSize = (int(iPairs, int64) * int(iPairs + 1, int64)) / 2
#ifdef CMPLX_
!Since we now only have 4-fold symmetry, rather than 8-fold.
iSize = iSize * 2
#endif
END SUBROUTINE GetUMatSize