subroutine CopyAcrossUMAT()
integer :: a, b, g, d, i, j, k, l
real(dp) :: s, t
if (((.not. tERLocalization) .and. (.not. tReadInCoeff) .and. (.not. tUseMP2VarDenMat) .and. (.not. tFindCINatOrbs))&
&.or. (tERLocalization .and. tStoreSpinOrbs)) TMAT2DTemp(:, :) = 0.0_dp
! These loops can be sped up with spatial symmetry and pairwise
! permutation symmetry if needed.
do a = 1, NoOrbs
i = SymLabelList2_rot(a) ! The spin orbital we are looking for.
do g = 1, a
j = SymLabelList2_rot(g)
if (((.not. tERLocalization) .and. (.not. tReadInCoeff) .and. (.not. tUseMP2VarDenMat) .and. (.not. tFindCINatOrbs))&
&.or. (tERLocalization .and. tStoreSpinOrbs)) then
if (tStoreSpinOrbs) then
s = real(TMAT2D(i, j), dp)
TMAT2DTemp(a, g) = s
TMAT2DTemp(g, a) = s
else
s = real(TMAT2D(2 * i, 2 * j), dp)
TMAT2DTemp(a, g) = s
TMAT2DTemp(g, a) = s
end if
end if
do b = 1, NoOrbs
k = SymLabelList2_rot(b)
do d = 1, b
l = SymLabelList2_rot(d)
t = real(UMAT(UMatInd(i, k, j, l)), dp)
UMATTemp01(a, g, b, d) = t ! a, g, d, b chosen to make 'transform2elint' steps more efficient.
UMATTemp01(g, a, b, d) = t
UMATTemp01(a, g, d, b) = t
UMATTemp01(g, a, d, b) = t
if (((.not. tERLocalization) .and. (.not. tReadInCoeff) .and. &
(.not. tUseMP2VarDenMat) .and. (.not. tFindCINatOrbs))&
&.or. (tERLocalization .and. tStoreSpinOrbs)) then
UMATTemp02(d, b, a, g) = t ! d, b, a, g order also chosen to speed up the transformation.
UMATTemp02(d, b, g, a) = t
UMATTemp02(b, d, a, g) = t
UMATTemp02(b, d, g, a) = t
end if
end do
end do
end do
end do
end subroutine CopyAcrossUMAT