<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">
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Helvetica,sans-serif;" dir="ltr">
<p>Hello,</p>
<p><br>
</p>
<p>Any calculation I have run on the 3 clusters I use produced the error - a water molecule in vacuum using US pseudos and cg gives impossible stresses from the first step.
<br>
</p>
<p><br>
</p>
<p> iii) Yes, the stress is correct after the changes. <br>
</p>
<p><br>
</p>
<p>i) The thing is there shouldn't be a problem, but it seems that the declared array sizes in cg_sub cause the compiler to rearrange the arrays anyway. You are correct, changing cg_sub to:</p>
<p><br>
</p>
<p></p>
<div> CHARACTER(LEN=80) :: uname<br>
CHARACTER(LEN=6), EXTERNAL :: int_to_char<br>
integer :: nfi, nlam<br>
logical :: tfirst, tlast<br>
complex(dp) :: eigr(:, :)<br>
real(dp) :: bec(:, :)<br>
real(dp) :: becdr(:, :, :)<br>
integer :: irb(:, :)<br>
complex(dp) :: eigrb(:, :)<br>
real(dp) :: rhor(:, :)<br>
real(dp) :: vpot(:, :)<br>
complex(dp) :: rhog(:, :)<br>
real(dp) :: rhos(:, :)<br>
real(dp) :: rhoc(:)<br>
complex(dp) :: ei1(:, :)<br>
complex(dp) :: ei2(:, :)<br>
complex(dp) :: ei3(:, :)<br>
complex(dp) :: sfac(:, :)<br>
real(dp) :: fion(:, :)<br>
real(dp) :: ema0bg(:)<br>
real(dp) :: lambdap(:, :, :)<br>
real(dp) :: lambda(:, :, :)<br>
complex(dp) :: c0(:, :)<br>
complex(dp) :: c0_d(:, :)<br>
complex(dp) :: cm(:, :)<br>
complex(dp) :: phi(:, :)<br>
complex(dp) :: phi_tmp(ngw, nbspx)<br>
real(dp) :: dbec(:, :, :, :)<br>
<br>
</div>
<p></p>
<p>solved this part of the problem on one of the clusters I use. However, the sysadmins of the other 2 clusters I use don't want to make arbitrary changes without an official patch since there are other users of QE and, as the rest of the world is so apt to
point out, I apparently don't have a clue. The introduction of random values is probably also solved by this since they only get mixed into the matrix by the rearrangement, but zeroing the array after allocation would have stopped the other half of WTF arising
in the stress matrix.</p>
<p><br>
</p>
<p>ii) It probably isn't that important, but moving the call "<span>if ( tstress ) CALL nlfh( stress, bec_bgrp, dbec, lambda, idesc )</span>" to just after dbec is calculated
<span>"if ( tstress ) CALL caldbec_bgrp( eigr, cm_bgrp, dbec, idesc )</span>" about 15 lines below seems like a good idea if only to avoid random crap in the stress matrix on the first pass.</p>
<p><br>
</p>
<p>Kind regards,</p>
<p><br>
</p>
<p>Jeremy<br>
</p>
<br>
<br>
<div style="color: rgb(0, 0, 0);">
<div>
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="x_divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>De :</b> Paolo Giannozzi <paolo.giannozzi@uniud.it><br>
<b>Envoyé :</b> samedi 12 octobre 2024 10:53<br>
<b>À :</b> RABONE Jeremy<br>
<b>Cc :</b> General discussion list for Quantum ESPRESSO developers<br>
<b>Objet :</b> Re: [QE-developers] TR: Bugs in cp.x from QE 7.2 affecting stresses calculated with US pseudos and CG</font>
<div> </div>
</div>
</div>
<font size="2"><span style="font-size:10pt;">
<div class="PlainText">Thank you for reporting.<br>
<br>
i) nkb and nhsa are actually the same variable. Not sure what "nrcx" is, <br>
but in any case, the called routine is in a module so one can just write<br>
real(dp) :: dbec(:,:,:,:)<br>
and stop worrying about the correctness of the<br>
<br>
ii) almost no code is executed for CG calculations (tcg=.true.) in <br>
from_scra.f90; for tcg=.false., the needed call is present, it seems to <br>
me. What did you change exactly?<br>
<br>
iii) Is stress working after your changes? can you provide a simple example?<br>
<br>
Paolo<br>
<br>
On 04/10/2024 09:41, RABONE Jeremy wrote:<br>
> <br>
> ------------------------------------------------------------------------<br>
> *De :* RABONE Jeremy<br>
> *Envoyé :* jeudi 3 octobre 2024 13:04<br>
> *À :* users@lists.quantum-espresso.org<br>
> *Objet :* Bugs in cp.x from QE 7.2 affecting stresses calculated with US <br>
> pseudos and CG<br>
> <br>
> Hello,<br>
> <br>
> I have been getting some weird stress values in MD calculations using <br>
> cp.x from QE 7.2 with ultrasoft pseudopotentials and after some <br>
> rummaging I have found a couple of bugs:<br>
> <br>
> i) The dbec array gets inadvertantly altered through the call to <br>
> cg_sub.f90 where is is assigned a different size "real(dp) :: dbec(nkb, <br>
> nbspx, 3, 3)" than initially allocated in mainvar.f90 <br>
> "ALLOCATE( dbec( nhsa, 2*nrcx, 3, 3 ), STAT=ierr )". The upshot of this <br>
> is that the values of dbec get jumbled and the resulting stress tensor <br>
> is messed up (and physically nonsensical). Also, since dbec is not <br>
> zeroed and the initially allocated size does not seem to correspond to <br>
> the used size, this also has the effect of introducing random values <br>
> into the stress tensor, although zeroing dbec after the allocation in <br>
> mainvar.f90 fixes this.<br>
> <br>
> ii) In fromscra.f90 the constraints contribution to the stress is <br>
> calculated "if ( tstress ) CALL nlfh( stress, bec_bgrp, dbec, lambda, <br>
> idesc )" before the dbec array has been calculated "if ( tstress ) CALL <br>
> caldbec_bgrp( eigr, cm_bgrp, dbec, idesc )".<br>
> <br>
> <br>
> Kind regards,<br>
> <br>
> Jeremy<br>
> <br>
> <br>
> ________________________________________________<br>
> The Quantum ESPRESSO community stands by the Ukrainian people<br>
> and expresses its concerns about the devastating effects that<br>
> the Russian military offensive has on their country and on the<br>
> free and peaceful scientific, cultural, and economic cooperation<br>
> amongst peoples.<br>
> _______________________________________________<br>
> developers mailing list<br>
> developers@lists.quantum-espresso.org<br>
> <a href="https://lists.quantum-espresso.org/mailman/listinfo/developers" id="LPlnk114740" previewremoved="true">
https://lists.quantum-espresso.org/mailman/listinfo/developers</a><br>
<br>
-- <br>
Paolo Giannozzi, Dip. Scienze Matematiche Informatiche e Fisiche,<br>
Univ. Udine, via delle Scienze 206, 33100 Udine Italy, +39-0432-558216<br>
<br>
</div>
</span></font></div>
</div>
</body>
</html>