<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> The input you sent does not produce the error (the pseudos aren't ultrasoft, at least in the internal sense of cp that would otherwise demand that
<span>nr1b</span>, <span>nr2b</span> and <span>nr3b are set). Attached are the inputs that produce the error, although the exact error is machine dependent the matrix of
</span>"constraints contribution to stress" is incorrect. I have just got:<br>
</p>
<p><br>
<span></p>
<div> -0.01479 0.00001 0.00000 <br>
0.00001 -0.01406 0.00000<br>
-0.01319 0.00000 0.00000<br>
<br>
<br>
6.21877 -0.00527 0.00000<br>
-0.00527 5.90848 0.00000<br>
5.54368 0.00000 0.00000<br>
<br>
</div>
</span>but this contribution should of course be diagonal.<br>
<p></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> lundi 14 octobre 2024 11: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">On 10/14/24 10:57, RABONE Jeremy wrote:<br>
<br>
> Any calculation I have run on the 3 clusters I use produced the error - <br>
> a water molecule in vacuum using US pseudos and cg gives impossible <br>
> stresses from the first step.<br>
<br>
there is a recently added test in test-suite/cp_h2o/h2o-mt-blyp-cg.in. I <br>
do not see any difference in the output with and without the change. Is <br>
the output of that test correct, wrong, and if so, what is the correct <br>
output?<br>
<br>
Paolo<br>
<br>
> <br>
> <br>
> iii) Yes, the stress is correct after the changes.<br>
> <br>
> <br>
> i) The thing is there shouldn't be a problem, but it seems that the <br>
> declared array sizes in cg_sub cause the compiler to rearrange the <br>
> arrays anyway. You are correct, changing cg_sub to:<br>
> <br>
> <br>
> 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>
> solved this part of the problem on one of the clusters I use. However, <br>
> the sysadmins of the other 2 clusters I use don't want to make arbitrary <br>
> changes without an official patch since there are other users of QE and, <br>
> as the rest of the world is so apt to point out, I apparently don't have <br>
> a clue. The introduction of random values is probably also solved by <br>
> this since they only get mixed into the matrix by the rearrangement, but <br>
> zeroing the array after allocation would have stopped the other half of <br>
> WTF arising in the stress matrix.<br>
> <br>
> <br>
> ii) It probably isn't that important, but moving the call "if ( tstress <br>
> ) CALL nlfh( stress, bec_bgrp, dbec, lambda, idesc )" to just after dbec <br>
> is calculated "if ( tstress ) CALL caldbec_bgrp( eigr, cm_bgrp, dbec, <br>
> idesc )" about 15 lines below seems like a good idea if only to avoid <br>
> random crap in the stress matrix on the first pass.<br>
> <br>
> <br>
> Kind regards,<br>
> <br>
> <br>
> Jeremy<br>
> <br>
> <br>
> <br>
> ------------------------------------------------------------------------<br>
> *De :* Paolo Giannozzi <paolo.giannozzi@uniud.it><br>
> *Envoyé :* samedi 12 octobre 2024 10:53<br>
> *À :* RABONE Jeremy<br>
> *Cc :* General discussion list for Quantum ESPRESSO developers<br>
> *Objet :* Re: [QE-developers] TR: Bugs in cp.x from QE 7.2 affecting <br>
> stresses calculated with US pseudos and CG<br>
> 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">https://lists.quantum-espresso.org/mailman/listinfo/developers</a>
<br>
> <<a href="https://lists.quantum-espresso.org/mailman/listinfo/developers">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>
<br>
-- <br>
Paolo Giannozzi, Dip. Scienze Matematiche Informatiche e Fisiche,<br>
Univ. Udine, via delle Scienze 206, 33100 Udine Italy, +39-0432-558216</div>
</span></font></div>
</div>
</body>
</html>