real(dp) function hop_transcorr_factor(J, r_vec)
! compute \sum_p exp(i*p*r) exp(J,r) for the 2-body term in the
! hopping transcorrelated real-space hubbard
real(dp), intent(in) :: J
integer, intent(in) :: r_vec(3)
#ifdef DEBUG_
character(*), parameter :: this_routine = "hop_transcorr_factor"
#endif
complex(dp) :: temp
integer :: i, n_sites, k_vec(3)
ASSERT(associated(lat))
n_sites = lat%get_nsites()
temp = 0.0_dp
! i have to have the correct dot-product of the real- and k-space
! vectors...
do i = 1, n_sites
k_vec = lat%get_k_vec(i)
temp = temp + exp(imag_unit * lat%dot_prod(k_vec, r_vec)) * &
exp(-J * epsilon_kvec(i))
end do
hop_transcorr_factor = real(temp) / real(n_sites, dp)
! will this be ever comlex? check the size
ASSERT(abs(aimag(temp)) < EPS)
end function hop_transcorr_factor