<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none"><!--P{margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr" style="font-size:12pt;color:#000000;background-color:#FFFFFF;font-family:Calibri,Arial,Helvetica,sans-serif;">
<p>Dear developers,</p>
<p><br>
</p>
<p>It seems there is a bug in the PHonon code when nspin=2 and tot_magnetization is used in PWscf. The problem is in the routine LR_Modules/setup_nbnd_occ.f90 where the code computes the number of occupied bands nbnd_occ for every k point. So, when tot_magnetization
is used in PWscf, two_fermi_energies=.TRUE., and nbnd_occ is zero for k+q points. It is so because the weights for k+q points are set to zero:</p>
<p><br>
</p>
<p>LR_Modules/setup_nscf.f90 -> PW/src/set_kplusq.f90</p>
<p><br>
</p>
<p>and as a consequence wg_up and wg_dw are also zero for k+q points (because the routine iweights is used), and this in turn leads to the fact that nbnd_occ is also zero for k+q points. The thing is that nbnd_occ(k+q) is used in several places in PHonon, and
so the code gives wrong results:</p>
<p><br>
</p>
<p></p>
<p> Representation # 1 mode # 1<br>
<br>
Self-consistent Calculation<br>
kpoint 2 ibnd 17 solve_linter: root not converged 3.846E+07<br>
kpoint 6 ibnd 17 solve_linter: root not converged 4.992E+07<br>
kpoint 8 ibnd 17 solve_linter: root not converged 1.526E+06<br>
kpoint 12 ibnd 17 solve_linter: root not converged 2.761E+01</p>
<p><br>
</p>
<p>The solution to this problem is simple: to replace the way nbnd_occ is computed when two_fermi_energies=.TRUE. by these lines:</p>
<p><br>
</p>
<p></p>
<p> DO ik = 1, nks<br>
IF (isk(ik)==1) THEN<br>
nbnd_occ(ik) = NINT(nelup)<br>
ELSE<br>
nbnd_occ(ik) = NINT(neldw)<br>
ENDIF<br>
ENDDO</p>
<p><br>
</p>
<p>Please note that setting wk for k+q points different from zero [e.g. equal to the weights of k points (which is actually not true, I think)] is not a good solution, because nonzero weights for k+q points will mess up the occupations in the case of metals
at the NSCF stage of the PHonon calculation.<br>
</p>
<p><br>
</p>
<p>I did tests for NiO and this fix seems to work fine. The test script is attached. Actually this bug is in QE since a very long time. I did my tests with QE 5.1. I also wanted to make tests with the latest version of QE (the SVN version), but it seems there
is yet another problem in the PWscf calculation (2nd SCF calculation in the script which I attached crashes). The error message is:</p>
<p><br>
</p>
<p> </p>
<p>Self-consistent Calculation<br>
<br>
iteration # 1 ecut= 50.00 Ry beta= 0.70<br>
Davidson diagonalization with overlap<br>
<br>
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%<br>
Error in routine cdiaghg (58):<br>
S matrix not positive definite<br>
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%<br>
<br>
stopping ...</p>
<p><br>
</p>
<p>Please let me know if you agree that there is a bug in the calculation of nbnd_occ. And concerning the second problem, it does not appear in QE 5.1, so I guess it may be related to some recent changes in QE.
</p>
<p><br>
</p>
<p>Greetings,</p>
<p>Iurii<br>
</p>
<p><br>
</p>
<p><br>
</p>
<div id="Signature">
<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>
Iurii Timrov<br>
Swiss Federal Institute of Technology Lausanne (EPFL<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">Laboratory of Theory and Simulation of Materials
<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"><br>
</font></div>
<div><font size="3" face="'Times New Roman', Times, serif" color="808080">CH-1015 Lausanne, Switzerland<br>
<br>
</font><br>
</div>
</div>
</div>
<div style="color: rgb(33, 33, 33);">
<div>
<div class="gmail_extra">
<div class="gmail_signature">
<div dir="ltr">
<div>
<div dir="ltr"></div>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>