subroutine fill_in_diag_helements()
use FciMCData, only: Hii
use global_det_data, only: set_det_diagH, set_det_offdiagH
integer :: i
integer :: nI(nel)
real(dp) :: tmpH
HElement_t(dp) :: tmpHoff
real(dp) :: sgn(lenof_sign)
do i = 1, int(TotWalkers)
call decode_bit_det(nI, CurrentDets(:, i))
tmpH = get_diagonal_matel(nI, CurrentDets(:, i)) - Hii
tmpHoff = get_off_diagonal_matel(nI, CurrentDets(:, i))
call set_det_diagh(i, tmpH)
call set_det_offdiagh(i, tmpHoff)
end do
end subroutine fill_in_diag_helements