<!DOCTYPE html><html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body>
    <p>not sure I understand what you need.</p>
    <p><br>
    </p>
    <p>calbec computes the dot product  <\beta_{R,l}|\psi_{ps}>
      and I don't think in the paw formalism there is any use for the
      individual Fourier
      components.<br>
    </p>
    <p></p>
    <p><br>
    </p>
    <p>if you want the shape of a pw, say |k+G>,  "dressed" with paw
      terms (like one would have, conceptually, in the augmented plane
      waves method, where pw in the interstitial region are matched to
      atomic solutions inside the atomic sphere) you need to call calbec
      with a fake psi where the |k+G> component is set to 1 and all
      the rest is set to 0. and then apply the formula that you wrote...
      except that one does not know where to represent that
      expression...  certainly not on the fft grid because the atomic
      partial waves (especially the AE ones) have Fourier components
      that exceed the cutoff of the fft grid, and in fact are kept on
      the radial logarithmic grid and never used anywhere else.</p>
    <p><br>
    </p>
    <p>The matrix elements of a physical quantities of interest (if the
      operator is local like the potential or the kinetic energy) are
      computed exploiting the (assumed) completeness of the partial wave
      expansion in the atomic sphere <br>
    </p>
    <p> I_\Omega_{R} x \sum_I  |\phi_{R,l}^{ps}> <\beta_{R,l}|  
         \approx     I_ \Omega_{R} <br>
    </p>
    <p> where I_\Omega_{R} is the identity inside the atomic sphere of
      atom R and zero outside.</p>
    <p><br>
    </p>
    <p> One can then write </p>
    <p><\psi_{ae}_i|OP|\psi_{ae}_j> =
      <\psi_{ps}_i|OP|\psi_{ps}_j> + </p>
    <p>   \sum_{R,l,J}   [ <\phi_{R,l}^{ae}|OP|\phis_{R,J}^{ae}> 
      - <\phi_{R,l}^{ps}|OP|\phi_{R,J}^{ps}> ]  x</p>
    <p>                          
      <\psi_{ps}_i|\beta_{R,I}><\beta_{R,J}|\psi_{ps}_j></p>
    <p> </p>
    <p>where the first row is computed on the FFT grid, the second on
      the atomic radial grids and the third row terms by calbec (and
      accumulated if needed in sumbec)<br>
    </p>
    <p> <br>
    </p>
    <p>electrostatics is a bit more complicated <br>
    </p>
    <p><br>
    </p>
    <p>stefano<br>
    </p>
    <p><br>
    </p>
    <div class="moz-cite-prefix">On 08/02/25 18:22, Marin Luca wrote:<br>
    </div>
    <blockquote type="cite" cite="mid:ZR1P278MB1325557E9786A98986C76511C6F02@ZR1P278MB1325.CHEP278.PROD.OUTLOOK.COM">
      
      <style type="text/css" style="display:none;">P {margin-top:0;margin-bottom:0;}</style>
      <div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
        Dear Stefano,  <br>
      </div>
      <div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
        <br>
      </div>
      <div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
        Thanks a lot for the kind and fast reply! This is a good
        question, I also wondered that maybe the storage part was
        useless. I need this term because it enters the PAW equation for
        the "all-electron reconstruction" of the pseudopotential
        KS-states: </div>
      <div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
        <br>
      </div>
      <div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
        \psi_{ae} = \psi_{ps} + \sum_{R,l} [\phi_{R,l}^{ae} -
        \phi_{R,l}^{ps}] x <\beta_{R,l}|\psi_{ps}></div>
      <div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
        <br>
      </div>
      <div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
        where R and l are the atomic species and projectors indices,
        \phi the "atomic-like" states from the PP calculation and \psi
        the KS state (there might be slight mistake in the formula).</div>
      <div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
        <br>
      </div>
      <div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
        If I now want to apply this correction to each of the u_{k+G} pw
        coefficients that contributes to \psi_{ps}, I think I also need
        the <\beta_{R,l}|\psi_{ps}> in a "G-wise" fashion, as I
        was naming it in the question. </div>
      <div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
        <br>
      </div>
      <div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
        I was therefore implementing this routine inside "gipaw", which
        already has precious stuff written for this PAW reconstruction. <br>
        <br>
        I hope this gives you more information, and please let me know
        if you think there is already a good place either in pw or gipaw
        where to perform this! </div>
      <div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
        <br>
      </div>
      <div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
        Best,</div>
      <div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
        Luca </div>
      <div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
        ETH Zurich, PhD student</div>
      <hr style="display:inline-block;width:98%" tabindex="-1">
      <div id="divRplyFwdMsg" dir="ltr"><font style="font-size:11pt" face="Calibri, sans-serif" color="#000000"><b>Da:</b>
          developers
          <a class="moz-txt-link-rfc2396E" href="mailto:developers-bounces@lists.quantum-espresso.org"><developers-bounces@lists.quantum-espresso.org></a> per
          conto di Stefano de Gironcoli <a class="moz-txt-link-rfc2396E" href="mailto:degironc@sissa.it"><degironc@sissa.it></a><br>
          <b>Inviato:</b> sabato 8 febbraio 2025 15:55<br>
          <b>A:</b> <a class="moz-txt-link-abbreviated" href="mailto:developers@lists.quantum-espresso.org">developers@lists.quantum-espresso.org</a>
          <a class="moz-txt-link-rfc2396E" href="mailto:developers@lists.quantum-espresso.org"><developers@lists.quantum-espresso.org></a><br>
          <b>Oggetto:</b> Re: [QE-developers] Parallelization question
          for G-wise projector-wavefunctions product computation</font>
        <div> </div>
      </div>
      <div>
        <p>Dear Luca,</p>
        <p>   the array betapsi_g(1:npw,1:nkb,1:nbnd) looks very big to
          me, unless the system is very small</p>
        <p>   what do you need it for ? maybe one can compute the target
          quantity on the fly rather than storing this intermediate
          result</p>
        <p><br>
        </p>
        <p>stefano</p>
        <p><br>
        </p>
        <div class="x_moz-cite-prefix">On 08/02/25 15:31, Marin Luca
          wrote:<br>
        </div>
        <blockquote type="cite">
          <style type="text/css" style="display:none">p
        {margin-top:0;
        margin-bottom:0}</style>
          <div class="x_elementToProof" style="line-height:100%; margin-top:1em; margin-bottom:0in; font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
            Dear QE developers, <br>
          </div>
          <div class="x_elementToProof" style="line-height:100%; margin-top:1em; margin-bottom:0in; font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
            I had a conceptual question of how I should correctly modify
            a subroutine in order to avoid parallelization and memory’s
            absurdities. Specifically, my idea is to slightly modify one
            of the subroutines in the “calbec” (becmod.f90) interface
            that is computing <\Beta|\psi> products, and I am
            using QE v.6.4 because I’m working on a specific code
            repository using this version. By calling such or similar
            line:<br>
          </div>
          <div style="line-height:100%; margin-top:1em; margin-bottom:0in; font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
            CALL ZGEMV( 'C', npw, nkb, (1.0_DP,0.0_DP), beta, npwx, psi,
            1, &</div>
          <div class="x_elementToProof" style="line-height:100%; margin-top:1em; margin-bottom:0in; font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
            (0.0_DP, 0.0_DP), betapsi, 1 )<br>
          </div>
          <div class="x_elementToProof" style="line-height:100%; margin-top:1em; margin-bottom:0in; font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
            and subsequently summing through bands:<br>
          </div>
          <div class="x_elementToProof" style="line-height:100%; margin-top:1em; margin-bottom:0in; font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
            CALL mp_sum( betapsi( :, 1:m ), intra_bgrp_comm )<br>
          </div>
          <div class="x_elementToProof" style="line-height:100%; margin-top:1em; margin-bottom:0in; font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
            “calbec_k” computes the betapsi product as a 2D matrix with
            dimension (number of projectors, number of bands). My goal
            is to compute the same product but accessing the elements at
            each G vectors, i.e. without summing over the G vectors
            themselves. To this end, my (very basic, probably terrible)
            idea was to define another subroutine with an extra variable
            like this (without breaking the requirement of having
            unambiguous interface procedures in “calbec”):<br>
          </div>
          <div style="line-height:100%; margin-top:1em; margin-bottom:0in; font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
            calbec_k_modified ( npw, beta, psi, betapsi, betapsi_g, nbnd
            )</div>
          <div class="x_elementToProof" style="line-height:100%; margin-top:1em; margin-bottom:0in; font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
            COMPLEX (DP), INTENT (out) :: betapsi_g(:,:,:) <br>
          </div>
          <div class="x_elementToProof" style="line-height:100%; margin-top:1em; margin-bottom:0in; font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
            and explicitly computing betapsi_g with nested do loops: <br>
          </div>
          <div style="line-height:100%; margin-top:1em; margin-bottom:0in; font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
            DO k = 1, npw</div>
          <div style="line-height:100%; margin-top:1em; margin-bottom:0in; font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
            DO i = 1, nkb</div>
          <div style="line-height:100%; margin-top:1em; margin-bottom:0in; font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
            DO j = 1, m</div>
          <div style="line-height:100%; margin-top:1em; margin-bottom:0in; font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
            betapsi_g(k, i, j) = CONJG(beta(k, i)) * psi(k, j)</div>
          <div style="line-height:100%; margin-top:1em; margin-bottom:0in; font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
            ENDDO</div>
          <div style="line-height:100%; margin-top:1em; margin-bottom:0in; font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
            ENDDO</div>
          <div class="x_elementToProof" style="line-height:100%; margin-top:1em; margin-bottom:0in; font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
            ENDDO<br>
          </div>
          <div class="x_elementToProof" style="line-height:100%; margin-top:1em; margin-bottom:0in; font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
            I am very unsure of whether this is a feasible approach and
            how I should handle the MPI parallelization in this case (I
            have little experience in QE development). I read the
            parallelization section of the developer’s manual, but I’m
            still quite confused. Any suggestions, critics or
            explanations will be very appreciated. </div>
          <div class="x_elementToProof" style="line-height:100%; margin-top:1em; margin-bottom:0in; font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
            Best regards,</div>
          <div class="x_elementToProof" style="line-height:100%; margin-top:1em; margin-bottom:0in; font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
            Luca Marin</div>
          <div class="x_elementToProof" style="line-height:100%; margin-top:1em; margin-bottom:0in; font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
            ETH Zurich, PhD student </div>
          <div class="x_elementToProof" style="font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
            <br>
          </div>
          <div style="font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
            <br>
          </div>
          <br>
          <fieldset class="x_moz-mime-attachment-header"></fieldset>
          <pre class="x_moz-quote-pre">________________________________________________
The Quantum ESPRESSO Foundation stands in solidarity with all civilians worldwide who are victims of terrorism, military aggression, and indiscriminate warfare.
_______________________________________________
developers mailing list
<a class="x_moz-txt-link-abbreviated moz-txt-link-freetext" href="mailto:developers@lists.quantum-espresso.org" moz-do-not-send="true">developers@lists.quantum-espresso.org</a>
<a class="x_moz-txt-link-freetext moz-txt-link-freetext" href="https://lists.quantum-espresso.org/mailman/listinfo/developers" moz-do-not-send="true">https://lists.quantum-espresso.org/mailman/listinfo/developers</a>
</pre>
        </blockquote>
      </div>
      <br>
      <fieldset class="moz-mime-attachment-header"></fieldset>
      <pre class="moz-quote-pre" wrap="">________________________________________________
The Quantum ESPRESSO Foundation stands in solidarity with all civilians worldwide who are victims of terrorism, military aggression, and indiscriminate warfare.
_______________________________________________
developers mailing list
<a class="moz-txt-link-abbreviated" href="mailto:developers@lists.quantum-espresso.org">developers@lists.quantum-espresso.org</a>
<a class="moz-txt-link-freetext" href="https://lists.quantum-espresso.org/mailman/listinfo/developers">https://lists.quantum-espresso.org/mailman/listinfo/developers</a>
</pre>
    </blockquote>
  </body>
</html>