SUBROUTINE CreateInvBRR2(BRR2, 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 BRR2(NBASIS), ierr, I, t
character(*), parameter :: t_r = 'CreateInvBRR2'
! write(stdout,*) "================================"
! write(stdout,*) "BRR2 is "
! write(stdout,*) BRR2(:)
allocate(INVBRR2(NBASIS / 2), STAT=ierr)
CALL LogMemAlloc('INVBRR2', NBASIS / 2, 4, t_r, tagINVBRR2, ierr)
INVBRR2(1:NBASIS / 2) = 0
t = 0
DO I = 2, NBASIS, 2
t = t + 1
INVBRR2(BRR2(I) / 2) = t
end do
! write(stdout,*) "================================"
! write(stdout,*) "InvBRR2 is "
! write(stdout,*) INVBRR2(:)
RETURN
END SUBROUTINE CreateInvBRR2