<!DOCTYPE html>
<html data-lt-installed="true">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body style="padding-bottom: 1px;">
    <p>Dear Barry,</p>
    <p>you could have a look to the utility "pw2bgw.f90" which is used
      to interface with a different code, but does also input/output of
      the wavefunctions, which you could recycle.</p>
    <p><span style="font-family:monospace"><span
          style="color:#1818b2;background-color:#ffffff;">! pw2bgw
          subroutines:</span><span
          style="color:#000000;background-color:#ffffff;">
        </span><br>
        <span style="color:#1818b2;background-color:#ffffff;">!</span><span
          style="color:#000000;background-color:#ffffff;">
        </span><br>
        <span style="color:#1818b2;background-color:#ffffff;">!
          write_wfng  - generates complex wavefunctions in G-space
          (normalized to 1)</span><span
          style="color:#000000;background-color:#ffffff;">
        </span><br>
        <span style="color:#1818b2;background-color:#ffffff;">!
          real_wfng   - constructs real wavefunctions by applying the
          Gram-Schmidt</span><span
          style="color:#000000;background-color:#ffffff;">
        </span><br>
        <span style="color:#1818b2;background-color:#ffffff;">!
                        process (called from write_wfng)</span><span
          style="color:#000000;background-color:#ffffff;">
        </span><br>
        <span style="color:#1818b2;background-color:#ffffff;">!
          write_rhog  - generates real/complex charge density in G-space</span><span
          style="color:#000000;background-color:#ffffff;">
        </span><br>
        <span style="color:#1818b2;background-color:#ffffff;">!
                        (units of the number of electronic states per
          unit cell)</span><span
          style="color:#000000;background-color:#ffffff;">
        </span><br>
        <span style="color:#1818b2;background-color:#ffffff;">!
          calc_rhog   - computes charge density by summing over a subset
          of occupied</span><span
          style="color:#000000;background-color:#ffffff;">
        </span><br>
        <span style="color:#1818b2;background-color:#ffffff;">!
                        bands (called from write_rhog), destroys charge
          density</span><br>
        <span style="color:#000000;background-color:#ffffff;">
        </span>...</span></p>
    <p><span style="font-family:monospace"><br>
      </span></p>
    <p>Be careful, that if you use any ultrasoft or paw
      pseudopotentials, the wavefunctions are not normalized.<br>
    </p>
    <p><br>
    </p>
    <div class="moz-cite-prefix">On 26/08/2024 03:58, Barry (Yangtao) Li
      wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:CAJTsyHdC9dJiRpOfVjt6cijdzaUdRT_5RoydtQ1u45QPhSnzwQ@mail.gmail.com">
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
      <div dir="ltr">I am writing to seek your guidance on generating
        and properly gridding complex-valued wavefunctions. Our goal is
        to obtain 3D complex wavefunctions, fully gridded on their
        defined FFT grid, which we intend to use for advanced
        spectroscopy simulations as an added feature to Quantum
        Espresso.<br>
        <br>
        For instance, with a system defined by 2×2×2 k-points and no
        symmetry, we expect to have 8 k-vectors (and therefore, we will
        obtain 8 wavefunctions binaries stored in .save after SCF). If
        we desire 40 bands and an FFT grid of (20, 20, 20), our
        expectation is that 8 wavefunction files (binaries or texts)
        would be written, each with the same size of 16×20×20×20×40 =
        5,120.000 bytes as we are aiming for each wavefunction to be
        stored as complex*16 data, separated by bands looping from 1 to
        40, and in each band block its (1:20, 1:20, 1:20) a row of 3D
        complex wavefunction data.<br>
        <br>
        We would greatly appreciate any advice or documentation you can
        provide on how to achieve this, especially how to ensure the
        wavefunctions are accurately gridded on their FFT grid in the
        desired complex format, we tried to count the bytes of the
        QE-generated .dat files, the bytes are far away from the
        expected, so we don't know how to grid them. We also tried pp.x
        postprocessing, however, since it is mainly designed for orbital
        visualization, the phase information, i.e., the complex nature
        of wavefunction is not stored after the post-processing. For
        Gamma-only, we can do a square-root transformation, however, for
        non-Gamma cases, the square-root won't work anymore.
        <div>
          <div><br>
            We believe this capability could be highly beneficial for
            users interested in extending QE's functionality into
            advanced spectroscopy, and we would be more than happy to
            contribute to its development.<br>
            <br>
            Thank you for your support and any assistance you can offer.<br>
          </div>
        </div>
        <div><br>
        </div>
        <div>Sincerely</div>
        <div>Barry</div>
      </div>
      <br>
      <fieldset class="moz-mime-attachment-header"></fieldset>
      <pre class="moz-quote-pre" wrap="">_______________________________________________
The Quantum ESPRESSO community stands by the Ukrainian
people and expresses its concerns about the devastating
effects that the Russian military offensive has on their
country and on the free and peaceful scientific, cultural,
and economic cooperation amongst peoples
_______________________________________________
Quantum ESPRESSO is supported by MaX (<a class="moz-txt-link-abbreviated" href="http://www.max-centre.eu">www.max-centre.eu</a>)
users mailing list <a class="moz-txt-link-abbreviated" href="mailto:users@lists.quantum-espresso.org">users@lists.quantum-espresso.org</a>
<a class="moz-txt-link-freetext" href="https://lists.quantum-espresso.org/mailman/listinfo/users">https://lists.quantum-espresso.org/mailman/listinfo/users</a></pre>
    </blockquote>
    <div class="moz-signature">-- <br>
      <small>Dr. Lorenzo Paulatto<br>
        IdR @ IMPMC - CNRS UMR 7590 & Sorbonne Université<br>
        phone: +33 (0)1 442 79822 / skype: paulatz<br>
        <a href="http://www.impmc.upmc.fr/~paulatto/"
          class="moz-txt-link-freetext">http://www.impmc.upmc.fr/~paulatto/</a>
        - <a href="https://anharmonic.github.io/"
          class="moz-txt-link-freetext">https://anharmonic.github.io/</a><br>
        23-24/423 B115, 4 place Jussieu 75252 Paris CX 05<small></small></small></div>
  </body>
  <lt-container></lt-container>
</html>