subroutine setup_orb_ind_mat
character(*), parameter :: this_routine = "setup_orb_ind_mat"
integer :: i, j, k, orb_i, orb_j
if (allocated(orb_ind_mat)) deallocate(orb_ind_mat)
ASSERT(allocated(mask_virt_ni))
allocate(orb_ind_mat(nbasis, nbasis))
orb_ind_mat = 0
k = 1
do i = 1, Nvirt
orb_i = mask_virt_ni(i, 1)
do j = i + 1, nvirt
orb_j = mask_virt_ni(j, 1)
orb_ind_mat(orb_i, orb_j) = k
k = k + 1
end do
end do
ASSERT(k - 1 == n_virt_pairs)
end subroutine setup_orb_ind_mat