SUBROUTINE SwapTMat()
! In:
! nBasis: the number of active orbitals post-freezing.
! NHG: the number of orbitals used initially (pre-freezing).
! GG: GG(I) is the new (post-freezing) index of the old
! (pre-freezing) orbital I.
! During freezing, we need to know the TMat arrays both pre- and
! post-freezing. Once freezing is done, clear all the pre-freezing
! arrays and point them to the post-freezing arrays, so the code
! referencing pre-freezing arrays can be used post-freezing.
IMPLICIT NONE
character(*), parameter :: this_routine = 'SwapTMat'
! Deallocate TMAT & reallocate with right size
CALL DestroyTMAT(.false.)
TMAT2D => TMAT2D2
NULLIFY (TMAT2D2)
END SUBROUTINE SwapTMat