espressopp / espressopp

Main ESPResSo++ repository
http://www.espresso-pp.de/
GNU General Public License v3.0
45 stars 33 forks source link

Possible bug report to CoulombKSpaceEwald.hpp #425

Open xzhh opened 2 years ago

xzhh commented 2 years ago

Just leave some remarks:

  1. The coulombic prefactor (e.g. vacuum permitivity) is not included in both computeVirial and computeVirialTensor. If users call espressopp.analysis.PressureTensor(system), for example, they will get a sum of Pij = tensor_real(pref=given) + tensor_kspace(pref=1.0). For the real-space part, it never goes wrong because its computeVirial is handled by VerletListInteractionTemplates which reads forces directly.

  2. The for-loops for building the k-vector are triple-nested with ranges of kx ∊ [0,kmax], ky ∊ [-kmax,kmax] and kz ∊ [-kmax,kmax]. Recently, I found, from other ewald implementations, that the actual range should be {kz ∊ [1,kmax], when kx=ky=0} ⋃ {kx = 0 / ky = [1,kmax] / kz ∊ [-kmax,kmax]} ⋃ {kx ∊ [1,kmax], ky ∊ [-kmax,kmax], kz ∊ [-kmax,kmax]}. Basically, there is no condition like {kx>=0 / ky<0 / kz<0}.

I have patched both of them and will merge to the pull request if there is no further question.

Regards, Zhenhao