subroutine writeAPVals(apvals, ndets, initial)
implicit none
real(dp), intent(inout) :: apvals(:, :)
integer, intent(in) :: ndets
integer, intent(in), optional :: initial
integer :: j, k, start
def_default(start, initial, 1)
! write the pops sum/iter per determinant in a contiguous array
! apvals(:,j) = (sum, iter) for determinant j (lenof_sign+1 in size)
do j = 1, nDets
do k = 1, lenof_sign
apvals(k, j) = get_pops_sum(j + start - 1, k)
end do
apvals(lenof_sign + 1, j) = get_pops_iter(j + start - 1)
end do
end subroutine writeAPVals