subroutine setup_elec_ind_mat
character(*), parameter :: this_routine = "setup_elec_ind_mat"
integer :: i, j, k, elec_i, elec_j
if (allocated(elec_ind_mat)) deallocate(elec_ind_mat)
ASSERT(allocated(projedet))
allocate(elec_ind_mat(nbasis, nbasis))
elec_ind_mat = 0
k = 1
do i = 1, nel
elec_i = projedet(i, 1)
do j = i + 1, nel
elec_j = projedet(j, 1)
elec_ind_mat(elec_i, elec_j) = k
k = k + 1
end do
end do
ASSERT(k - 1 == ElecPairs)
end subroutine setup_elec_ind_mat