<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
span.DefaultFontHxMailStyle
{mso-style-name:"Default Font HxMail Style";
font-family:"Calibri",sans-serif;
color:windowtext;
font-weight:normal;
font-style:normal;
text-decoration:none none;}
span.contentpasted2
{mso-style-name:contentpasted2;}
.MsoChpDefault
{mso-style-type:export-only;}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
{page:WordSection1;}
--></style>
</head>
<body lang="EN-US" link="blue" vlink="#954F72" style="word-wrap:break-word">
<div class="WordSection1">
<p class="MsoNormal"><span class="DefaultFontHxMailStyle"><span style="font-size:12.0pt">Dear Lingyuan
<o:p></o:p></span></span></p>
<p class="MsoNormal"><span class="DefaultFontHxMailStyle"><span style="font-size:12.0pt"><o:p> </o:p></span></span></p>
<p class="MsoNormal"><span class="DefaultFontHxMailStyle"><span style="font-size:12.0pt">The saw-tooth function ( see PW/src/extfield.f90 ) has a unitary slope, so the operations performed for ion_dipole and e_dipole are equivalent to what you are expecting.
The only difference is that the center with respect to which we compute the dipole is the point at which the saw-tooth function –and the saw-tooth potential as well— have their 0 value.
<o:p></o:p></span></span></p>
<p class="MsoNormal"><span class="DefaultFontHxMailStyle"><span style="font-size:12.0pt">Best regards
<o:p></o:p></span></span></p>
<p class="MsoNormal"><span class="DefaultFontHxMailStyle"><span style="font-size:12.0pt">Pietro<o:p></o:p></span></span></p>
<p class="MsoNormal"><span class="DefaultFontHxMailStyle"><span style="font-size:12.0pt"><o:p> </o:p></span></span></p>
<p class="MsoNormal">Sent from <a href="https://go.microsoft.com/fwlink/?LinkId=550986">
Mail</a> for Windows</p>
<p class="MsoNormal"><span class="DefaultFontHxMailStyle"><span style="font-size:12.0pt"><o:p> </o:p></span></span></p>
<div style="mso-element:para-border-div;border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal" style="border:none;padding:0in"><b>From: </b><a href="mailto:lg041@uark.edu">Lingyuan Gao</a><br>
<b>Sent: </b>Saturday, April 1, 2023 9:04 PM<br>
<b>To: </b><a href="mailto:developers@lists.quantum-espresso.org">developers@lists.quantum-espresso.org</a><br>
<b>Subject: </b>[QE-developers] Potential bug in dipole correction of quantum espresso</p>
</div>
<p class="MsoNormal"><span class="DefaultFontHxMailStyle"><span style="font-size:12.0pt"><o:p> </o:p></span></span></p>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:12.0pt;color:black">Dear developers of quantum espresso,<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:12.0pt;color:black">My name is Lingyuan Gao and I am a postdoc at the University of Arkansas. I am recently looking at the code relevant to dipole correction. The code about computing electron
or ionic dipole written in "compute_dip.f90" drew my attention and I am wondering whether they are correct. Please look at Line 69 and Line 164:<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:12.0pt;color:black">"<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:12.0pt;color:black"> ion_dipole = ion_dipole + zvia* saw(emaxpos,eopreg, tvectb ) &<br>
* (alat/bmod) * (fpi/omega)<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:12.0pt;color:black"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:12.0pt;color:black"> e_dipole = e_dipole + rhoir * saw(emaxpos,eopreg, sawarg) &<br>
* (alat/bmod) * (fpi/(dfftp%nr1*dfftp%nr2*dfftp%nr3))<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:12.0pt;color:black">"<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:12.0pt;color:black">As I understand, these two lines of codes are to compute the dipole of ionic part and electronic part, so they are the product of charges and distance times a constant.
Nevertheless, I didn't see the reason why the sawtooth function (saw(x)) should be used here for recalculating position, which should be a function for correcting potential. In my opinion, here it should straightly use 'tvectb' and 'sawarg'.<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:12.0pt;color:black"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:12.0pt;color:black">Thanks for your time, and l<span class="contentpasted2"><span style="background:white">et me know if my concern is correct.</span></span><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:12.0pt;color:black"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:12.0pt;color:black"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:12.0pt;color:black">Best<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:12.0pt;color:black">Lingyuan<o:p></o:p></span></p>
</div>
<p class="MsoNormal" style="background:white"><span style="font-size:12.0pt;color:black"><o:p> </o:p></span></p>
<p class="MsoNormal"><span class="DefaultFontHxMailStyle"><span style="font-size:12.0pt"><o:p> </o:p></span></span></p>
</div>
</body>
</html>