Prefactor in k \neq 0 in gradQ_U
I compared the k \neq 0 part with that given in Hu (JCTC, 2014, 10, 5254-5264) therein in Eq. 39. The approach Hu used seems, however, equivalent to yours, except that you approximate the integral over du by a trapezoidal integration in his Eq. 38. In contrast, Hu performed the 2D Fourier transform analytically. I think this expression of UF-2D could drastically speed up the computation of the A matrix, since a third loop over the z components of the k-space vector can be skipped which might allow flexible electrodes more easily?
Edited by Robert Meißner