Meanwhile, I found a very strange problem with the real space matrix images themselves.<div>As an example, a very simple system of a 1D H array, with 4 atoms in the unit cell (input file in attachment).</div><div>The coordinates are</div><div> &CELL<br /> ABC 16.0 16.0 6.0<br /> PERIODIC xyz<br /> &END CELL<br /> &COORD<br /> H 0.00000000 0.00000000 0.00000000 <br /> H 0.00000000 0.00000000 1.50000000 <br /> H 0.00000000 0.00000000 3.00000000 <br /> H 0.00000000 0.00000000 4.50000000 <br /> &END COORD</div><div><br /></div><div>The 5 RS image cells are</div><div>S CSR write| 5 periodic images<br /> Number X Y Z<br /> 1 0 0 0<br /> 2 0 0 -1<br /> 3 0 0 1<br /> 4 0 0 -2<br /> 5 0 0 2</div><div><br /></div><div>and the 0,0,0 image for S overlap is (all other in attachment)<br /><div><br /></div><div> 1 1 0.10000000000000E+001<br /> 1 2 0.39126534955779E+000<br /> 1 3 0.39734112631705E-001<br /> 1 4 0.39126534955779E+000<br /> 2 1 0.39126534955779E+000<br /> 2 2 0.10000000000000E+001<br /> 2 3 0.39126534955779E+000<br /> 2 4 0.39734112631705E-001<br /> 3 1 0.39734112631705E-001<br /> 3 2 0.39126534955779E+000<br /> 3 3 0.10000000000000E+001<br /> 3 4 0.12433452435606E-002<br /> 4 1 0.39126534955779E+000<br /> 4 2 0.39734112631705E-001<br /> 4 3 0.12433452435606E-002<br /> 4 4 0.10000000000000E+001</div><div><br /></div><div>As one can see, the values of S correspond to the atom positions in order</div><div>4 1 2 3</div><div>not</div><div>1 2 3 4</div><div>as I assume to be correct.</div><div><br /></div><div>If one makes only one RS image, e.g., taking </div><div>ABC 16.0 16.0 16.0</div><div>in the input file, the file looks correct.</div><div><br /></div><div> 1 1 0.10000000000000E+001<br /> 1 2 0.39126534955779E+000<br /> 1 3 0.39734112631705E-001<br /> 1 4 0.12433452435606E-002<br /> 2 1 0.39126534955779E+000<br /> 2 2 0.10000000000000E+001<br /> 2 3 0.39126534955779E+000<br /> 2 4 0.39734112631705E-001<br /> 3 1 0.39734112631705E-001<br /> 3 2 0.39126534955779E+000<br /> 3 3 0.10000000000000E+001<br /> 3 4 0.39126534955779E+000<br /> 4 1 0.12433452435606E-002<br /> 4 2 0.39734112631705E-001<br /> 4 3 0.39126534955779E+000<br /> 4 4 0.10000000000000E+001</div><div><br /></div><div>Here (1,4) and (4,1) matrix elements are the smallest.<br /></div></div><div><br /></div><div>Besides, this "cyclic shift" depends on k-points and the linear shift of atom coordinates.</div><div>Even if it does not change k-point calculations itself, it can be important in other problems.</div><div>Actually, I found this problem in "NEGF" transport systems, where it is important.</div><div>At the moment, I have not found the origin of this problem.</div><div><br /></div><div><br /></div><div><div dir="auto">Dmitry Ryndyk schrieb am Dienstag, 28. Oktober 2025 um 11:13:35 UTC+1:<br /></div><blockquote style="margin: 0px 0px 0px 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">Dear Augustin,<div><br /></div><div>thank you for the fast answer. It helps me to understand what is going on!</div><div><br /></div><div>Best wishes,</div><div>Dmitry</div><br /><div><div dir="auto">Augustin Bussy schrieb am Dienstag, 28. Oktober 2025 um 11:11:38 UTC+1:<br /></div><blockquote style="margin: 0px 0px 0px 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">For clarity: Both the S and KS matrices are Hermitian in <b>k-space</b>, but in real space, we have: S_ij^<b>b</b> = S_ji^-<b>b</b><br /><br /><div><div dir="auto">On Tuesday, 28 October 2025 at 10:57:55 UTC+1 Augustin Bussy wrote:<br /></div><blockquote style="margin: 0px 0px 0px 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><div>Dear Dimitry,</div><div><br /></div><div>Dealing with CP2K's real space matrices in k-point calculations can be quite challenging. In principle, it follows equations (10) and (11) of <a href="https://arxiv.org/pdf/2508.15559" rel="nofollow" target="_blank">https://arxiv.org/pdf/2508.15559</a>. Elements i of the qs_env%ks_env%matrix_s_kp array contains real space overlap matrix elements between AOs in the main cell, and AOs in periodic image with index i. The indexing of periodic images is that imposed by the neighbor lists.<br /><br />For historical reasons, the KP overlap and KS matrices are stored as DBCSR <b>symmetric</b> types, even though they are not symmetric. That's where it gets complicated. Both the S and KS matrices are Hermitian, and they have the following symmetry: S_ij^<b>b</b> = S_ji^-<b>b</b>, where <b>b</b> denotes the translation from the main cell to a given periodic image.</div><div>If you have access to the upper diagonal of a real space matrix with one AO in a periodic cell shifted by <b>b</b>, and that of a real space matrix with an AO shifted by -<b>b</b>, then you can reconstruct the full, asymmetric, real space matrix at <b>b</b>.</div><div><br /></div><div>In the code, this operation is done when performing Fourier transforms real space to k-space. For example here: <a href="https://github.com/cp2k/cp2k/blob/5f3bc36082e75c975caee6a92073f395a2af7674/src/kpoint_methods.F#L855-L864" rel="nofollow" target="_blank">https://github.com/cp2k/cp2k/blob/5f3bc36082e75c975caee6a92073f395a2af7674/src/kpoint_methods.F#L855-L864</a>.</div><div><br /></div><div>I hope that helps.</div><div>Best,</div><div>Augustin</div><div><div dir="auto">On Tuesday, 28 October 2025 at 01:38:16 UTC+1 Dmitry Ryndyk wrote:<br /></div><blockquote style="margin: 0px 0px 0px 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">Dear developers,<div><br /></div><div>I would greatly appreciate it if you could provide me with the reference to the exact description of the real space S and KS matrices, stored in qs_env%ks_env%matrix_ks_kp and qs_env%ks_env%matrix_s_kp.</div><div>I mean not the details of DBCSR matrices, but the way the matrix elements are placed inside the matrices.</div><div>My test calculations, as well as some code investigation, show that these matrix elements are mixed between space replicas ("images") used at k-point calculations, and some rearrangement is required to get normal symmetrical matrices, which depend on the atomic indices. </div><div><br /></div><div>Thank you,</div><div>Dmitry</div><div><br /></div></blockquote></div></blockquote></div></blockquote></div></blockquote></div>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups "cp2k" group.<br />
To unsubscribe from this group and stop receiving emails from it, send an email to <a href="mailto:cp2k+unsubscribe@googlegroups.com">cp2k+unsubscribe@googlegroups.com</a>.<br />
To view this discussion visit <a href="https://groups.google.com/d/msgid/cp2k/30f85300-5a51-438a-80e3-317598a447ddn%40googlegroups.com?utm_medium=email&utm_source=footer">https://groups.google.com/d/msgid/cp2k/30f85300-5a51-438a-80e3-317598a447ddn%40googlegroups.com</a>.<br />