<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">
</head>
<body>
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Helvetica,sans-serif;" dir="ltr">
<p>Dear All,</p>
<p><br>
</p>
<p>Just for reference: Max tested the latest development version of QE for DFT+U with ortho-atomic orbitals to compute forces in TiO2. The agreement between the finite differences and the analytical formulas that are implemented in QE is excellent:</p>
<p><br>
</p>
<p></p>
<div> # Difference of total energies 0.243038055000000 <br>
# Integral force*displacement 0.243038055033344 <br>
# Difference 3.334407749910895E-011</div>
<p></p>
<p><br>
</p>
<p>This validates the correctness of the implementation, and this is in agreement with my tests. The problem was in the patch that I sent to Max, but all is good in the development version. QE 6.6 is also fine, but there was another bug which was also fixed
in the development version: <i>"<span>Bug in Hubbard forces and stress for bands parallelization (when nproc_pool>nbnd)</span>".</i></p>
<p><i><br>
</i></p>
<p>Greetings,</p>
<p>Iurii<i><br>
</i></p>
<p><br>
</p>
<div id="Signature">
<div id="divtagdefaultwrapper" dir="ltr" style="font-size: 12pt; color: rgb(0, 0, 0); font-family: Calibri, Helvetica, sans-serif, "EmojiFont", "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols;">
<div name="divtagdefaultwrapper" style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:; margin:0">
<div name="divtagdefaultwrapper" style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:; margin:0">
<font size="3" face="'Times New Roman', Times, serif" color="808080">--<br>
Dr. Iurii TIMROV<br>
Postdoctoral Researcher<br>
<font color="808080"><font face="'Times New Roman', Times, serif"></font></font></font></div>
<font color="808080"></font>
<div name="divtagdefaultwrapper" style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:; margin:0">
<font size="3" face="'Times New Roman', Times, serif" color="808080">STI - IMX <font color="808080">
<font face="'Times New Roman', Times, serif">- THEOS</font></font></font><font size="3" face="'Times New Roman', Times, serif" color="808080"> and NCCR - MARVEL<br>
</font></div>
<div name="divtagdefaultwrapper" style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:; margin:0">
<font size="3" face="'Times New Roman', Times, serif" color="808080"><font size="3" face="'Times New Roman', Times, serif" color="808080">Swiss Federal Institute of Technology Lausanne (EPFL<font color="808080"><font face="'Times New Roman', Times, serif">)</font></font></font><br>
</font></div>
<font color="808080"></font>
<div name="divtagdefaultwrapper" style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:; margin:0">
<font size="3" face="'Times New Roman', Times, serif" color="808080">CH-1015 Lausanne, Switzerland<br>
+41 21 69 34 881</font></div>
<div name="divtagdefaultwrapper" style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:; margin:0">
<a href="http://people.epfl.ch/265334" tabindex="0" id="LPNoLP">http://people.epfl.ch/265334</a><br>
</div>
</div>
</div>
</div>
</div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> developers <developers-bounces@lists.quantum-espresso.org> on behalf of Timrov Iurii <iurii.timrov@epfl.ch><br>
<b>Sent:</b> Sunday, September 13, 2020 10:58:24 AM<br>
<b>To:</b> General discussion list for Quantum ESPRESSO developers<br>
<b>Subject:</b> Re: [QE-developers] Forces are not exact derivatives of the energy for U_projection_type = 'ortho-atomic'</font>
<div> </div>
</div>
<div><style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Helvetica,sans-serif;" dir="ltr">
<p>Dear Max,</p>
<p><br>
</p>
<p><span style="caret-color: rgb(33, 33, 33); color: rgb(33, 33, 33); font-family: wf_segoe-ui_normal, "Segoe UI", "Segoe WP", Tahoma, Arial, sans-serif, serif, EmojiFont; font-size: 15px;">> Is the relative error of the same magnitude as the ones form “atomic”
or no U at all?</span><br>
</p>
<p><br>
</p>
<p>Yes</p>
<p><br>
</p>
<p><span style="caret-color: rgb(33, 33, 33); color: rgb(33, 33, 33); font-family: wf_segoe-ui_normal, "Segoe UI", "Segoe WP", Tahoma, Arial, sans-serif, serif, EmojiFont; font-size: 15px;">> What you are suggesting is the central difference. For a particular
structure this might give the correct force, but if you do the integral for a completely arbitrary path (and many of them) you can uncover particular configurations where the forces are wrong (e.g., when atoms cross the periodic boundaries), or you accumulate
small errors in the forces that show up as significant deviations from the energy difference. On several occasions, I have discovered in this way several bugs in my own implementations of forces that were not easily detectable, and I found that this kind of
test is rather robust. </span><br>
</p>
<p><br>
</p>
<p>Ok, interesting. I did not know about that.</p>
<p><br>
</p>
<p><span style="caret-color: rgb(33, 33, 33); color: rgb(33, 33, 33); font-family: wf_segoe-ui_normal, "Segoe UI", "Segoe WP", Tahoma, Arial, sans-serif, serif, EmojiFont; font-size: 15px;">> I am using the new version with your patch. I am running it on daint,
compiled with Intel version 19.1.1.217 and 2020.1.217 MKL libraries.</span><br>
</p>
<p><span style="caret-color: rgb(33, 33, 33); color: rgb(33, 33, 33); font-family: wf_segoe-ui_normal, "Segoe UI", "Segoe WP", Tahoma, Arial, sans-serif, serif, EmojiFont; font-size: 15px;"><br>
</span></p>
<p><font face="wf_segoe-ui_normal, Segoe UI, Segoe WP, Tahoma, Arial, sans-serif, serif, EmojiFont"><span style="caret-color: rgb(33, 33, 33); font-size: 15px;">Ok, thanks for the details. Concerning the patch, it contains three modified routines: initially
I uploaded to Google D</span></font><font face="wf_segoe-ui_normal, Segoe UI, Segoe WP, Tahoma, Arial, sans-serif, serif, EmojiFont"><span style="caret-color: rgb(33, 33, 33); font-size: 15px;">rive only </span></font><font face="wf_segoe-ui_normal, Segoe UI, Segoe WP, Tahoma, Arial, sans-serif, serif, EmojiFont"><span style="caret-color: rgb(33, 33, 33); font-size: 15px;">two
routines and one hour latter I realised that I forgot that there is yet another routine, which eventually I also uploaded. I hope you used three new routines and recompiled the code. To be safe, you can try to use the latest development version of QE:</span></font></p>
<p><span style="caret-color: rgb(33, 33, 33); color: rgb(33, 33, 33); font-family: wf_segoe-ui_normal, "Segoe UI", "Segoe WP", Tahoma, Arial, sans-serif, serif, EmojiFont; font-size: 15px;"><span style="color: rgb(0, 0, 0);">HTTPS: </span><span style="color: rgb(0, 0, 0);">git
clone </span></span><span style="font-size: 12pt;"><a href="https://gitlab.com/QEF/q-e.git" class="OWAAutoLink" id="LPlnk440059" previewremoved="true"><span style="color: rgb(0, 0, 0);">https://gitlab.com/QEF/q-e.git</span></a></span></p>
<p><span style="font-size: 12pt;"><a href="https://gitlab.com/QEF/q-e.git" class="OWAAutoLink"></a></span><span style="caret-color: rgb(33, 33, 33); color: rgb(0, 0, 0); font-family: wf_segoe-ui_normal, "Segoe UI", "Segoe WP", Tahoma, Arial, sans-serif, serif, EmojiFont; font-size: 15px;">or</span></p>
<p><span style="caret-color: rgb(33, 33, 33); color: rgb(33, 33, 33); font-family: wf_segoe-ui_normal, "Segoe UI", "Segoe WP", Tahoma, Arial, sans-serif, serif, EmojiFont; font-size: 15px;"><span style="color: rgb(0, 0, 0);">SSH: </span><span style="color: rgb(0, 0, 0);">git
clone </span></span><span style="font-size: 12pt; color: rgb(0, 0, 0);">git@gitlab.com:QEF/q-e.git</span></p>
<p><span style="font-size: 12pt;"></span><span style="caret-color: rgb(33, 33, 33); color: rgb(0, 0, 0); font-family: wf_segoe-ui_normal, "Segoe UI", "Segoe WP", Tahoma, Arial, sans-serif, serif, EmojiFont; font-size: 15px;">I hope that this was the reason
of the problem. If yes, then sorry about the confusion with the patch.</span></p>
<p><span style="caret-color: rgb(33, 33, 33); color: rgb(33, 33, 33); font-family: wf_segoe-ui_normal, "Segoe UI", "Segoe WP", Tahoma, Arial, sans-serif, serif, EmojiFont; font-size: 15px;"><br>
</span></p>
<p><span style="caret-color: rgb(33, 33, 33); color: rgb(33, 33, 33); font-family: wf_segoe-ui_normal, "Segoe UI", "Segoe WP", Tahoma, Arial, sans-serif, serif, EmojiFont; font-size: 15px;"> > </span><span style="caret-color: rgb(33, 33, 33); color: rgb(33, 33, 33); font-family: wf_segoe-ui_normal, "Segoe UI", "Segoe WP", Tahoma, Arial, sans-serif, serif, EmojiFont; font-size: 15px;">I
can increase the cutoff and rerun the test. But I am already using very tight parameters (100.00 Ry). I could increase the k-point mesh (which is not fully converged), but then again I would expect that I would see larger errors for No-U and “atomic”.</span></p>
<p><span style="caret-color: rgb(33, 33, 33); color: rgb(33, 33, 33); font-family: wf_segoe-ui_normal, "Segoe UI", "Segoe WP", Tahoma, Arial, sans-serif, serif, EmojiFont; font-size: 15px;"><br>
</span></p>
<p><span style="caret-color: rgb(33, 33, 33); color: rgb(0, 0, 0); font-family: wf_segoe-ui_normal, "Segoe UI", "Segoe WP", Tahoma, Arial, sans-serif, serif, EmojiFont; font-size: 15px;">Yes, indeed the cutoff is already very large. I do not expect that increasing
the number of k points will solve the problem, but maybe it is worth to check. </span></p>
<p><span style="caret-color: rgb(33, 33, 33); color: rgb(0, 0, 0); font-family: wf_segoe-ui_normal, "Segoe UI", "Segoe WP", Tahoma, Arial, sans-serif, serif, EmojiFont; font-size: 15px;">Another test that we can do is to use NCPP instead of USPP, to see if
the problem is related to USPP.</span></p>
<p><span style="caret-color: rgb(33, 33, 33); color: rgb(33, 33, 33); font-family: wf_segoe-ui_normal, "Segoe UI", "Segoe WP", Tahoma, Arial, sans-serif, serif, EmojiFont; font-size: 15px;"><span style="color: rgb(0, 0, 0);">But first of all I would make a
test with the latest development version (instead of using a patch</span><span style="color: rgb(0, 0, 0);">)</span></span><span style="caret-color: rgb(33, 33, 33); color: rgb(0, 0, 0); font-family: wf_segoe-ui_normal, "Segoe UI", "Segoe WP", Tahoma, Arial, sans-serif, serif, EmojiFont; font-size: 15px;">.</span></p>
<p><span style="caret-color: rgb(33, 33, 33); color: rgb(33, 33, 33); font-family: wf_segoe-ui_normal, "Segoe UI", "Segoe WP", Tahoma, Arial, sans-serif, serif, EmojiFont; font-size: 15px;"><br>
</span></p>
<p><span style="caret-color: rgb(33, 33, 33); color: rgb(33, 33, 33); font-family: wf_segoe-ui_normal, "Segoe UI", "Segoe WP", Tahoma, Arial, sans-serif, serif, EmojiFont; font-size: 15px;">> I can recompile with PGI and see if I see a change in behavior.</span><span style="caret-color: rgb(33, 33, 33); color: rgb(33, 33, 33); font-family: wf_segoe-ui_normal, "Segoe UI", "Segoe WP", Tahoma, Arial, sans-serif, serif, EmojiFont; font-size: 15px;"><br>
</span></p>
<p><span style="caret-color: rgb(33, 33, 33); color: rgb(33, 33, 33); font-family: wf_segoe-ui_normal, "Segoe UI", "Segoe WP", Tahoma, Arial, sans-serif, serif, EmojiFont; font-size: 15px;"><br>
</span></p>
<p><span style="caret-color: rgb(33, 33, 33); color: rgb(33, 33, 33); font-family: wf_segoe-ui_normal, "Segoe UI", "Segoe WP", Tahoma, Arial, sans-serif, serif, EmojiFont; font-size: 15px;">Thanks. But to be honest I am not sure that this will solve the problem
(even though I proposed to check this).</span></p>
<p><br>
</p>
<p><span style="caret-color: rgb(33, 33, 33); color: rgb(33, 33, 33); font-family: wf_segoe-ui_normal, "Segoe UI", "Segoe WP", Tahoma, Arial, sans-serif, serif, EmojiFont; font-size: 15px;">> Yes, I will perform the test with NiO. Please send me your input
files.</span><span style="caret-color: rgb(33, 33, 33); color: rgb(33, 33, 33); font-family: wf_segoe-ui_normal, "Segoe UI", "Segoe WP", Tahoma, Arial, sans-serif, serif, EmojiFont; font-size: 15px;"><br>
</span></p>
<p><span style="caret-color: rgb(33, 33, 33); color: rgb(33, 33, 33); font-family: wf_segoe-ui_normal, "Segoe UI", "Segoe WP", Tahoma, Arial, sans-serif, serif, EmojiFont; font-size: 15px;"><br>
</span></p>
<p><span style="caret-color: rgb(33, 33, 33); color: rgb(33, 33, 33); font-family: wf_segoe-ui_normal, "Segoe UI", "Segoe WP", Tahoma, Arial, sans-serif, serif, EmojiFont; font-size: 15px;">Thanks! I will send to you the data and the draft of the manuscript
privately in a separate email.</span></p>
<p><span style="caret-color: rgb(33, 33, 33); color: rgb(33, 33, 33); font-family: wf_segoe-ui_normal, "Segoe UI", "Segoe WP", Tahoma, Arial, sans-serif, serif, EmojiFont; font-size: 15px;"><br>
</span></p>
<p><span style="caret-color: rgb(33, 33, 33); color: rgb(33, 33, 33); font-family: wf_segoe-ui_normal, "Segoe UI", "Segoe WP", Tahoma, Arial, sans-serif, serif, EmojiFont; font-size: 15px;">> I have attached the atomic positions for every displacement along
the path in ascii format. The PW parameters are given below:</span><span style="caret-color: rgb(33, 33, 33); color: rgb(33, 33, 33); font-family: wf_segoe-ui_normal, "Segoe UI", "Segoe WP", Tahoma, Arial, sans-serif, serif, EmojiFont; font-size: 15px;"><br>
</span></p>
<p><span style="caret-color: rgb(33, 33, 33); color: rgb(33, 33, 33); font-family: wf_segoe-ui_normal, "Segoe UI", "Segoe WP", Tahoma, Arial, sans-serif, serif, EmojiFont; font-size: 15px;"><br>
</span></p>
<p><span style="caret-color: rgb(33, 33, 33); color: rgb(33, 33, 33); font-family: wf_segoe-ui_normal, "Segoe UI", "Segoe WP", Tahoma, Arial, sans-serif, serif, EmojiFont; font-size: 15px;">Thanks! I will run some </span><font color="#212121" face="wf_segoe-ui_normal, Segoe UI, Segoe WP, Tahoma, Arial, sans-serif, serif, EmojiFont"><span style="caret-color: rgb(33, 33, 33); font-size: 15px;">tests
tomorrow. A few observations:</span></font></p>
<p><span style="caret-color: rgb(33, 33, 33); color: rgb(33, 33, 33); font-family: wf_segoe-ui_normal, "Segoe UI", "Segoe WP", Tahoma, Arial, sans-serif, serif, EmojiFont; font-size: 15px;">> nosym = .true. ,</span><font color="#212121" face="wf_segoe-ui_normal, Segoe UI, Segoe WP, Tahoma, Arial, sans-serif, serif, EmojiFont"><span style="caret-color: rgb(33, 33, 33); font-size: 15px;"><br>
</span></font></p>
<p><font color="#212121" face="wf_segoe-ui_normal, Segoe UI, Segoe WP, Tahoma, Arial, sans-serif, serif, EmojiFont"><span style="caret-color: rgb(33, 33, 33); font-size: 15px;">Is there a reason to disable symmetries? I would keep them (in all my tests I used
symmetries).</span></font></p>
<p><span style="caret-color: rgb(33, 33, 33); color: rgb(33, 33, 33); font-family: wf_segoe-ui_normal, "Segoe UI", "Segoe WP", Tahoma, Arial, sans-serif, serif, EmojiFont; font-size: 15px;">> conv_thr = 1.0d-10 ,</span><font color="#212121" face="wf_segoe-ui_normal, Segoe UI, Segoe WP, Tahoma, Arial, sans-serif, serif, EmojiFont"><span style="caret-color: rgb(33, 33, 33); font-size: 15px;"><br>
</span></font></p>
<p><font color="#212121" face="wf_segoe-ui_normal, Segoe UI, Segoe WP, Tahoma, Arial, sans-serif, serif, EmojiFont"><span style="caret-color: rgb(33, 33, 33); font-size: 15px;">In my tests I used 1.0d-15 to have total energies and forces very well converged.
I guess that in your tests with 500 total energy calculations it is better to use 1.0d-15, because otherwise numerical noise will be accumulated (that's my guess).</span></font></p>
<p><span style="caret-color: rgb(33, 33, 33); color: rgb(33, 33, 33); font-family: wf_segoe-ui_normal, "Segoe UI", "Segoe WP", Tahoma, Arial, sans-serif, serif, EmojiFont; font-size: 15px;"><br>
</span></p>
<p><span style="caret-color: rgb(33, 33, 33); color: rgb(33, 33, 33); font-family: wf_segoe-ui_normal, "Segoe UI", "Segoe WP", Tahoma, Arial, sans-serif, serif, EmojiFont; font-size: 15px;">> I see. Perhaps it would be helpful to include this kind of pathintegral
test to the test set, and I am happy to help implement it in the test suite.</span><font color="#212121" face="wf_segoe-ui_normal, Segoe UI, Segoe WP, Tahoma, Arial, sans-serif, serif, EmojiFont"><span style="caret-color: rgb(33, 33, 33); font-size: 15px;"><br>
</span></font></p>
<p><span style="caret-color: rgb(33, 33, 33); color: rgb(33, 33, 33); font-family: wf_segoe-ui_normal, "Segoe UI", "Segoe WP", Tahoma, Arial, sans-serif, serif, EmojiFont; font-size: 15px;"><br>
</span></p>
<p><span style="caret-color: rgb(33, 33, 33); color: rgb(33, 33, 33); font-family: wf_segoe-ui_normal, "Segoe UI", "Segoe WP", Tahoma, Arial, sans-serif, serif, EmojiFont; font-size: 15px;">Thanks! The only problem is that the path integral test would require
several hundreds of total energy calculations, which is huge. We are trying to keep the test suite as light as possible.</span></p>
<p><span style="caret-color: rgb(33, 33, 33); color: rgb(33, 33, 33); font-family: wf_segoe-ui_normal, "Segoe UI", "Segoe WP", Tahoma, Arial, sans-serif, serif, EmojiFont; font-size: 15px;"><br>
</span></p>
<p><span style="caret-color: rgb(33, 33, 33); color: rgb(33, 33, 33); font-family: wf_segoe-ui_normal, "Segoe UI", "Segoe WP", Tahoma, Arial, sans-serif, serif, EmojiFont; font-size: 15px;">> Thanks again for looking into this issue</span><span style="caret-color: rgb(33, 33, 33); color: rgb(33, 33, 33); font-family: wf_segoe-ui_normal, "Segoe UI", "Segoe WP", Tahoma, Arial, sans-serif, serif, EmojiFont; font-size: 15px;"><br>
</span></p>
<p><br>
</p>
<p>Thanks a lot to you too!</p>
<p><br>
</p>
<p>Best,</p>
<p>Iurii</p>
<p><br>
</p>
<div id="Signature">
<div id="divtagdefaultwrapper" dir="ltr" style="font-size: 12pt; color: rgb(0, 0, 0); font-family: Calibri, Helvetica, sans-serif, Helvetica, EmojiFont, "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols;">
<div name="divtagdefaultwrapper" style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:; margin:0">
<div name="divtagdefaultwrapper" style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:; margin:0">
<font size="3" face="'Times New Roman', Times, serif" color="808080">--<br>
Dr. Iurii TIMROV<br>
Postdoctoral Researcher<br>
<font color="808080"><font face="'Times New Roman', Times, serif"></font></font></font></div>
<font color="808080"></font>
<div name="divtagdefaultwrapper" style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:; margin:0">
<font size="3" face="'Times New Roman', Times, serif" color="808080">STI - IMX <font color="808080">
<font face="'Times New Roman', Times, serif">- THEOS</font></font></font><font size="3" face="'Times New Roman', Times, serif" color="808080"> and NCCR - MARVEL<br>
</font></div>
<div name="divtagdefaultwrapper" style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:; margin:0">
<font size="3" face="'Times New Roman', Times, serif" color="808080"><font size="3" face="'Times New Roman', Times, serif" color="808080">Swiss Federal Institute of Technology Lausanne (EPFL<font color="808080"><font face="'Times New Roman', Times, serif">)</font></font></font><br>
</font></div>
<font color="808080"></font>
<div name="divtagdefaultwrapper" style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:; margin:0">
<font size="3" face="'Times New Roman', Times, serif" color="808080">CH-1015 Lausanne, Switzerland<br>
+41 21 69 34 881</font></div>
<div name="divtagdefaultwrapper" style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:; margin:0">
<a href="http://people.epfl.ch/265334" tabindex="0" id="LPNoLP">http://people.epfl.ch/265334</a><br>
</div>
</div>
</div>
</div>
</div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> developers <developers-bounces@lists.quantum-espresso.org> on behalf of Max Amsler <amsler.max@gmail.com><br>
<b>Sent:</b> Saturday, September 12, 2020 9:36:50 PM<br>
<b>To:</b> General discussion list for Quantum ESPRESSO developers<br>
<b>Subject:</b> Re: [QE-developers] Forces are not exact derivatives of the energy for U_projection_type = 'ortho-atomic'</font>
<div> </div>
</div>
<div>
<div class="" style="word-wrap:break-word; line-break:after-white-space">Dear Iurii,
<div class="">Thanks for your response. Actually, I made a mistake in my previous mail. The energies are in eV, not Ry! But the relative errors are correct.<br class="">
<div><br class="">
<blockquote type="cite" class="">
<div class="">On 12 Sep 2020, at 15:32, Timrov Iurii <<a href="mailto:iurii.timrov@epfl.ch" class="">iurii.timrov@epfl.ch</a>> wrote:</div>
<br class="x_Apple-interchange-newline">
<div class="">
<div id="x_divtagdefaultwrapper" dir="ltr" class="" style="font-style:normal; font-weight:normal; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; font-size:12pt; font-family:Calibri,Helvetica,sans-serif">
<div class="" style="margin-top:0px; margin-bottom:0px">Dear Max,</div>
<div class="" style="margin-top:0px; margin-bottom:0px"><br class="">
</div>
<div class="" style="margin-top:0px; margin-bottom:0px">Thanks for performing these tests!</div>
<div class="" style="margin-top:0px; margin-bottom:0px"><br class="">
</div>
<div class="" style="margin-top:0px; margin-bottom:0px">I implemented Hubbard forces and stress with ortho-atomic orbitals, and I have thoroughly tested the implementation. I compared forces and stress computed using the exact analytical formulas versus finite
differences, and the agreement was up to 10^{-6} Ry/Bohr which validates the implementation. I used the symmetric difference quotient (with the displacement parameter of 5 x 10^{-3} Bohr) to computed derivatives numerically:</div>
<div class="" style="margin-top:0px; margin-bottom:0px"><a href="https://en.wikipedia.org/wiki/Numerical_differentiation" class="x_OWAAutoLink" id="LPlnk565393">https://en.wikipedia.org/wiki/Numerical_differentiation</a><br class="">
</div>
<div class="" style="margin-top:0px; margin-bottom:0px">For example, for NiO I obtained the following results:</div>
<div class="" style="margin-top:0px; margin-bottom:0px">Analytical: F = -0.048891 Ry/Bohr</div>
<div class="" style="margin-top:0px; margin-bottom:0px">Numerical: <span class="" style="font-size:12pt">F = -0.048891 Ry/Bohr</span></div>
<div class="" style="margin-top:0px; margin-bottom:0px">As you can see forces agree up to <span class="" style="font-size:12pt">10^{-6} Ry/Bohr. In a similar way I tested also stress.</span></div>
</div>
</div>
</blockquote>
Is the relative error of the same magnitude as the ones form “atomic” or no U at all?<br class="">
<blockquote type="cite" class="">
<div class="">
<div id="x_divtagdefaultwrapper" dir="ltr" class="" style="font-style:normal; font-weight:normal; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; font-size:12pt; font-family:Calibri,Helvetica,sans-serif">
<div class="" style="margin-top:0px; margin-bottom:0px"><span class="" style="font-size:12pt"><br class="">
</span></div>
<div class="" style="margin-top:0px; margin-bottom:0px"><span class="" style="color:rgb(33,33,33); font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif,serif,EmojiFont; font-size:15px">> It seems that there is a bug in the implementation
of the forces for U_projection_type = 'ortho-atomic’, or that some terms have been neglected when computing the derivatives.</span><span class="" style="font-size:12pt"><br class="">
</span></div>
<div class="" style="margin-top:0px; margin-bottom:0px"><span class="" style="font-size:12pt"><br class="">
</span></div>
<div class="" style="margin-top:0px; margin-bottom:0px"><font size="3" class="">The analytical formulas are<span class="x_Apple-converted-space"> </span><b class="">exact</b>, we did not neglect anything. In fact, it took us a lot of time and effort to derive
the exact formulas. Also I do not think that there is a bug, because my tests give excellent </font>agreement<font size="3" class=""> between analytical and numerical derivatives for NiO and a couple of other systems.</font></div>
<div class="" style="margin-top:0px; margin-bottom:0px"><font size="3" class=""><br class="">
</font></div>
<div class="" style="margin-top:0px; margin-bottom:0px"><font size="3" class="">The path integral method looks to me a bit overkilling. Why not simply to compute the total energy for two atomic configurations and then simply divide the difference of energies by
the difference in atomic positions (I mean only one atom must be slightly displaced at a time), i.e. [ E(x + delta) - E(x - delta) ] / (2*delta)? But in any case, since your method works well for standard DFT forces and DFT+U atomic forces, then we should
try to understand why it gives weird results for the ortho-atomic case. </font></div>
</div>
</div>
</blockquote>
What you are suggesting is the central difference. For a particular structure this might give the correct force, but if you do the integral for a completely arbitrary path (and many of them) you can uncover particular configurations where the forces are wrong
(e.g., when atoms cross the periodic boundaries), or you accumulate small errors in the forces that show up as significant deviations from the energy difference. On several occasions, I have discovered in this way several bugs in my own implementations of
forces that were not easily detectable, and I found that this kind of test is rather robust. <br class="">
<blockquote type="cite" class="">
<div class="">
<div id="x_divtagdefaultwrapper" dir="ltr" class="" style="font-style:normal; font-weight:normal; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; font-size:12pt; font-family:Calibri,Helvetica,sans-serif">
<div class="" style="margin-top:0px; margin-bottom:0px"><font size="3" class=""><br class="">
</font></div>
<div class="" style="margin-top:0px; margin-bottom:0px"><font size="3" class="">Which version of Quantum ESPRESSO did you use? Was it 6.6 without any modifications, or did you apply the patch which I sent to you in the QE developers mailing list shortly after
the release of QE 6.6? Are you running on your workstation or on Piz Daint (should not matter but good to know)? Which compilers and libraries do you use? </font></div>
</div>
</div>
</blockquote>
I am using the new version with your patch. I am running it on daint, compiled with Intel version 19.1.1.217 and 2020.1.217 MKL libraries.<br class="">
<blockquote type="cite" class="">
<div class="">
<div id="x_divtagdefaultwrapper" dir="ltr" class="" style="font-style:normal; font-weight:normal; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; font-size:12pt; font-family:Calibri,Helvetica,sans-serif">
<div class="" style="margin-top:0px; margin-bottom:0px"><font size="3" class="">Perhaps, you can try to increase the kinetic-energy cutoff and see if the agreement for the ortho-atomic case is better. Forces and stress converge slowly with respect to the cutoff
(and maybe ortho-atomic case is even slower, but in my tests I did not observe this though).</font></div>
</div>
</div>
</blockquote>
I can increase the cutoff and rerun the test. But I am already using very tight parameters (100.00 Ry). I could increase the k-point mesh (which is not fully converged), but then again I would expect that I would see larger errors for No-U and “atomic”.<br class="">
<blockquote type="cite" class="">
<div class="">
<div id="x_divtagdefaultwrapper" dir="ltr" class="" style="font-style:normal; font-weight:normal; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; font-size:12pt; font-family:Calibri,Helvetica,sans-serif">
<div class="" style="margin-top:0px; margin-bottom:0px"><font size="3" class="">Also, maybe it would useful to try other compilers and libraries.</font></div>
</div>
</div>
</blockquote>
I can recompile with PGI and see if I see a change in behavior.<br class="">
<blockquote type="cite" class="">
<div class="">
<div id="x_divtagdefaultwrapper" dir="ltr" class="" style="font-style:normal; font-weight:normal; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; font-size:12pt; font-family:Calibri,Helvetica,sans-serif">
<div class="" style="margin-top:0px; margin-bottom:0px"><font size="3" class="">If you want I can send you my input files for NiO which I used for the benchmarking and we can see what do you obtain using the path integral approach. Would you be so kind to perform
these tests? </font></div>
</div>
</div>
</blockquote>
Yes, I will perform the test with NiO. Please send me your input files.<br class="">
<blockquote type="cite" class="">
<div class="">
<div id="x_divtagdefaultwrapper" dir="ltr" class="" style="font-style:normal; font-weight:normal; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; font-size:12pt; font-family:Calibri,Helvetica,sans-serif">
<div class="" style="margin-top:0px; margin-bottom:0px"><font size="3" class="">On my side I can compute forces with finite differences for your system - could you send to me please the input and output files for reference?</font></div>
</div>
</div>
</blockquote>
I have attached the atomic positions for every displacement along the path in ascii format. The PW parameters are given below:</div>
<div><br class="">
</div>
<div> &CONTROL<br class="">
restart_mode = 'from_scratch' ,<br class="">
outdir='./' ,<br class="">
pseudo_dir = './' ,<br class="">
calculation = "scf" ,<br class="">
tstress = .true. ,<br class="">
tprnfor = .true. ,<br class="">
/<br class="">
&SYSTEM<br class="">
U_projection_type = 'ortho-atomic'<br class="">
ibrav= 0, <br class="">
nat= 6, <br class="">
ntyp = 2<br class="">
nosym=.false.<br class="">
ecutwfc = 100.0 ,<br class="">
ecutrho = 1200.0 ,<br class="">
occupations = 'smearing' ,<br class="">
smearing = 'gaussian' ,<br class="">
degauss = 0.01 ,<br class="">
lda_plus_u=.true.<br class="">
lda_plus_u_kind = 0,<br class="">
Hubbard_U(1) = 4.7147<br class="">
nat = 6 ,<br class="">
ntyp = 2 ,<br class="">
nosym = .true. ,<br class="">
/<br class="">
&ELECTRONS<br class="">
conv_thr = 1.0d-10 ,<br class="">
/<br class="">
ATOMIC_SPECIES<br class="">
Ti 2.00000 Ti.PSP<br class="">
O 2.00000 O.PSP<br class="">
K_POINTS automatic<br class="">
4 4 6 0 0 0</div>
<div></div>
</div>
</div>
<div class="" style="word-wrap:break-word; line-break:after-white-space">
<div class="">
<div></div>
<div><br class="">
<blockquote type="cite" class="">
<div class="">
<div id="x_divtagdefaultwrapper" dir="ltr" class="" style="font-style:normal; font-weight:normal; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; font-size:12pt; font-family:Calibri,Helvetica,sans-serif">
<div class="" style="margin-top:0px; margin-bottom:0px"><font size="3" class=""><br class="">
</font></div>
<div class="" style="margin-top:0px; margin-bottom:0px"><span class="" style="color:rgb(33,33,33); font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif,serif,EmojiFont; font-size:15px">> In the long run, it might be helpful to include
such tests routinely as part of the QE development process.</span><font size="3" class=""><br class="">
</font></div>
<div class="" style="margin-top:0px; margin-bottom:0px"><span class="" style="font-size:12pt"><br class="">
</span></div>
<div class="" style="margin-top:0px; margin-bottom:0px"><font size="3" class="">The QE </font>developers<font size="3" class=""> team makes big effort to benchmark various functionalities of QE before the release and during the development process. In particular,
we have a test suite with many examples which are used to benchmark various codes and various functionalities. For the DFT+Hubbard ortho-atomic forces, I tested everything using finite differences (as described above), I was convinced that all is good, and
only then I added tests to the test suite. So we do care a lot about testing and benchmarking, but of course sometimes there maybe be some bugs which were overlooked or which comes for some other reason.</font></div>
</div>
</div>
</blockquote>
I see. Perhaps it would be helpful to include this kind of pathintegral test to the test set, and I am happy to help implement it in the test suite.<br class="">
<blockquote type="cite" class="">
<div class="">
<div id="x_divtagdefaultwrapper" dir="ltr" class="" style="font-style:normal; font-weight:normal; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; font-size:12pt; font-family:Calibri,Helvetica,sans-serif">
<div class="" style="margin-top:0px; margin-bottom:0px"><font size="3" class=""><br class="">
</font></div>
<div class="" style="margin-top:0px; margin-bottom:0px"><font size="3" class="">Greetings,</font></div>
<div class="" style="margin-top:0px; margin-bottom:0px"><font size="3" class="">Iurii</font></div>
<div class="" style="margin-top:0px; margin-bottom:0px"><br class="">
</div>
</div>
</div>
</blockquote>
Thanks again for looking into this issue,</div>
<div>Best</div>
<div>Max</div>
<div>
<blockquote type="cite" class="">
<div class="">
<div id="x_divtagdefaultwrapper" dir="ltr" class="" style="font-style:normal; font-weight:normal; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; font-size:12pt; font-family:Calibri,Helvetica,sans-serif">
<div id="x_Signature" class="">
<div id="x_divtagdefaultwrapper" dir="ltr" class="" style="font-size:12pt; font-family:Calibri,Helvetica,sans-serif,Helvetica,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols">
<div name="x_divtagdefaultwrapper" class="" style="font-family:Calibri,Arial,Helvetica,sans-serif; margin:0px">
<div name="x_divtagdefaultwrapper" class="" style="font-family:Calibri,Arial,Helvetica,sans-serif; margin:0px">
<font size="3" face="'Times New Roman', Times, serif" color="808080" class="">--<br class="">
Dr. Iurii TIMROV<br class="">
Postdoctoral Researcher<br class="">
<font color="808080" class=""><font face="'Times New Roman', Times, serif" class=""></font></font></font></div>
<font color="808080" class=""></font>
<div name="x_divtagdefaultwrapper" class="" style="font-family:Calibri,Arial,Helvetica,sans-serif; margin:0px">
<font size="3" face="'Times New Roman', Times, serif" color="808080" class="">STI - IMX<span class="x_Apple-converted-space"> </span><font color="808080" class=""><font face="'Times New Roman', Times, serif" class="">- THEOS</font></font></font><font size="3" face="'Times New Roman', Times, serif" color="808080" class=""><span class="x_Apple-converted-space"> </span>and
NCCR - MARVEL<br class="">
</font></div>
<div name="x_divtagdefaultwrapper" class="" style="font-family:Calibri,Arial,Helvetica,sans-serif; margin:0px">
<font size="3" face="'Times New Roman', Times, serif" color="808080" class=""><font size="3" face="'Times New Roman', Times, serif" color="808080" class="">Swiss Federal Institute of Technology Lausanne (EPFL<font color="808080" class=""><font face="'Times New Roman', Times, serif" class="">)</font></font></font><br class="">
</font></div>
<font color="808080" class=""></font>
<div name="x_divtagdefaultwrapper" class="" style="font-family:Calibri,Arial,Helvetica,sans-serif; margin:0px">
<font size="3" face="'Times New Roman', Times, serif" color="808080" class="">CH-1015 Lausanne, Switzerland<br class="">
+41 21 69 34 881</font></div>
<div name="x_divtagdefaultwrapper" class="" style="font-family:Calibri,Arial,Helvetica,sans-serif; margin:0px">
<a href="http://people.epfl.ch/265334" tabindex="0" id="LPNoLP" class="">http://people.epfl.ch/265334</a><br class="">
</div>
</div>
</div>
</div>
</div>
<hr tabindex="-1" class="" style="font-family:Helvetica; font-size:12px; font-style:normal; font-weight:normal; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; display:inline-block; width:872.1875px">
<span class="" style="font-family:Helvetica; font-size:12px; font-style:normal; font-weight:normal; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; float:none; display:inline!important"></span>
<div id="x_divRplyFwdMsg" dir="ltr" class="" style="font-family:Helvetica; font-size:12px; font-style:normal; font-weight:normal; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none">
<font face="Calibri, sans-serif" class="" style="font-size:11pt"><b class="">From:</b><span class="x_Apple-converted-space"> </span>developers <<a href="mailto:developers-bounces@lists.quantum-espresso.org" class="">developers-bounces@lists.quantum-espresso.org</a>>
on behalf of Max Amsler <<a href="mailto:amsler.max@gmail.com" class="">amsler.max@gmail.com</a>><br class="">
<b class="">Sent:</b><span class="x_Apple-converted-space"> </span>Saturday, September 12, 2020 12:44:33 PM<br class="">
<b class="">To:</b><span class="x_Apple-converted-space"> </span>General discussion list for Quantum ESPRESSO developers<br class="">
<b class="">Subject:</b><span class="x_Apple-converted-space"> </span>[QE-developers] Forces are not exact derivatives of the energy for U_projection_type = 'ortho-atomic'</font>
<div class=""> </div>
</div>
<div class="" style="font-family:Helvetica; font-size:12px; font-style:normal; font-weight:normal; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none">
<div class="" style="word-wrap:break-word; line-break:after-white-space">
<div class="">Dear all,</div>
After extensively testing the recently implemented forces for U_projection_type = 'ortho-atomic’, I have come across several cases where the geometry optimizations would fail: the energy would fluctuate without convergence using BFGS, and even damped dynamics
would frequently not converge. Such a behavior usually points to a problem with the forces, which are either not exact or noisy.
<div class=""><br class="">
</div>
<div class="">Based on this observation, I decided to perform a routine test: I compute the integral of the forces times displacement along a path in configurational space, and compare it with the energy difference between the initial and final point. If the
forces are exact derivatives of the energy, the path integral must be identical to the energy difference (up to machine precision if the step size of the path integral goes to zero). The method is described in sec 3.3, <a href="https://doi.org/10.1016/j.cpc.2020.107415" class="">https://doi.org/10.1016/j.cpc.2020.107415</a>,
see also the attachment of the relevant section. </div>
<div class=""><br class="">
</div>
<div class=""><br class="">
</div>
<div class=""></div>
</div>
<div class="" style="word-wrap:break-word; line-break:after-white-space">
<div class=""></div>
<div class=""><br class="">
</div>
<div class="">I performed this test for a TiO2 Rutile structure with 6 atoms per cellI, along a path in a random direction with 0.001 Ang step size and with a total of 501 steps. I used 3 different settings: DFT without U, DFT+U with U_projection_type = ‘atomic’
(U=4.7147), and DFT+U with U_projection_type = 'ortho-atomic’ (U=4.7147). In the case of No-U and ‘atomic’, the relative error of the path integral and energy difference is less than1.d-4%, as expected when the forces are correct. But for 'ortho-atomic’ the
relative error is a whopping 8%! This indicates that the forces are not the exact derivatives of the energy for U_projection_type = 'ortho-atomic’ (see also plot below, note that the y scale is logarithmic for the last two subplots).</div>
<div class=""><br class="">
</div>
<div class=""></div>
</div>
<div class="" style="word-wrap:break-word; line-break:after-white-space">
<div class=""></div>
<div class=""><br class="">
</div>
<div class="">It seems that there is a bug in the implementation of the forces for U_projection_type = 'ortho-atomic’, or that some terms have been neglected when computing the derivatives.</div>
<div class=""><br class="">
</div>
<div class="">In the long run, it might be helpful to include such tests routinely as part of the QE development process.</div>
<div class=""><br class="">
</div>
<div class="">Best</div>
<div class="">Max</div>
</div>
</div>
<span class="" style="font-family:Helvetica; font-size:12px; font-style:normal; font-weight:normal; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; float:none; display:inline!important">_______________________________________________</span><br class="" style="font-family:Helvetica; font-size:12px; font-style:normal; font-weight:normal; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none">
<span class="" style="font-family:Helvetica; font-size:12px; font-style:normal; font-weight:normal; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; float:none; display:inline!important">developers
mailing list</span><br class="" style="font-family:Helvetica; font-size:12px; font-style:normal; font-weight:normal; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none">
<a href="mailto:developers@lists.quantum-espresso.org" class="" style="font-family:Helvetica; font-size:12px; font-style:normal; font-weight:normal; letter-spacing:normal; orphans:auto; text-align:start; text-indent:0px; text-transform:none; white-space:normal; widows:auto; word-spacing:0px">developers@lists.quantum-espresso.org</a><br class="" style="font-family:Helvetica; font-size:12px; font-style:normal; font-weight:normal; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none">
<a href="https://lists.quantum-espresso.org/mailman/listinfo/developers" class="" style="font-family:Helvetica; font-size:12px; font-style:normal; font-weight:normal; letter-spacing:normal; orphans:auto; text-align:start; text-indent:0px; text-transform:none; white-space:normal; widows:auto; word-spacing:0px">https://lists.quantum-espresso.org/mailman/listinfo/developers</a></div>
</blockquote>
</div>
<br class="">
</div>
</div>
</div>
</div>
</body>
</html>