SUBROUTINE CreateInvBRR(BRR, NBASIS)
! Create new INVBRR for the freezing process
! In:
! BRR(i)=j: orbital i is the j-th lowest in energy.
! nBasis: size of bais
! InvBRR is the inverse of BRR. InvBRR(j)=i: the j-th lowest energy
! orbital corresponds to the i-th orbital in the original basis.
INTEGER NBASIS
INTEGER BRR(NBASIS), ierr, I, t
character(*), parameter :: t_r = 'CreateInvBRR'
IF (ASSOCIATED(INVBRR)) THEN
CALL LogMemDealloc(t_r, tagINVBRR)
DEallocate(INVBRR)
end if
allocate(INVBRR(NBASIS / 2), STAT=ierr)
CALL LogMemAlloc('INVBRR', NBASIS / 2, 4, t_r, tagINVBRR, ierr)
INVBRR(1:NBASIS / 2) = 0
t = 0
DO I = 2, NBASIS, 2
t = t + 1
INVBRR(BRR(I) / 2) = t
end do
RETURN
END SUBROUTINE CreateInvBRR