<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<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 style="margin-top:0;margin-bottom:0">Hello,</p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0">I tried to write some code that <span>orthonormalize</span>s the wave function and it doesn't work. The code is shown below:</p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0"></p>
<div><span style="font-family: DaunPenh, "Leelawadee UI", "Khmer MN", sans-serif; color: rgb(0, 111, 201);"></span></div>
<div><span style="font-family: "Leelawadee UI", Thonburi, sans-serif; color: rgb(0, 111, 201);"> ! othornormalize</span><br>
<span style="font-family: "Leelawadee UI", Thonburi, sans-serif;"> do ibnd = 1, nbnd</span><br>
<br>
<span style="font-family: "Leelawadee UI", Thonburi, sans-serif; color: rgb(0, 111, 201);"> ! orthogonalize |psi_i> to all |psi_j> for j<i</span><br>
<span style="font-family: "Leelawadee UI", Thonburi, sans-serif;"> call s_1psi ( npwx , npw , tddft_psi(1,ibnd,1) , spsi )</span><br>
<br>
<span style="font-family: "Leelawadee UI", Thonburi, sans-serif;"> do jbnd = 1, ibnd-1
</span><br>
<span style="font-family: "Leelawadee UI", Thonburi, sans-serif; color: rgb(0, 111, 201);"> ! calculate |psi_i> - |psi_j><psi_j| S |psi_i></span><br>
<span style="font-family: "Leelawadee UI", Thonburi, sans-serif;"> do ipw = 1, npw</span><br>
<span style="font-family: "Leelawadee UI", Thonburi, sans-serif;"> tddft_psi(ipw,ibnd,1) = tddft_psi(ipw,ibnd,1) - tddft_psi(ipw,jbnd,1) * conjg( tddft_psi(ipw,jbnd,1) ) * spsi(ipw)</span><br>
<span style="font-family: "Leelawadee UI", Thonburi, sans-serif;"> enddo</span><br>
<span style="font-family: "Leelawadee UI", Thonburi, sans-serif;"> enddo</span><br>
<br>
<span style="font-family: "Leelawadee UI", Thonburi, sans-serif; color: rgb(0, 111, 201);"> ! normalize
<span style="font-family: "Leelawadee UI", Thonburi, sans-serif; color: rgb(0, 111, 201);">
|psi_i></span></span><br>
<span style="font-family: "Leelawadee UI", Thonburi, sans-serif;"> norm = 0</span><br>
<span style="font-family: "Leelawadee UI", Thonburi, sans-serif;"> call s_1psi ( npwx , npw , tddft_psi(1,ibnd,1) , spsi )</span><br>
<br>
<span style="font-family: "Leelawadee UI", Thonburi, sans-serif; color: rgb(0, 111, 201);"> ! calculate <psi_i| S |psi_i></span><br>
<span style="font-family: "Leelawadee UI", Thonburi, sans-serif;"> do ipw = 1, npw</span><br>
<span style="font-family: "Leelawadee UI", Thonburi, sans-serif;"> norm = norm + conjg( tddft_psi(ipw,ibnd,1) ) * spsi(ipw)</span><br>
<span style="font-family: "Leelawadee UI", Thonburi, sans-serif;"> enddo</span><br>
<span style="font-family: "Leelawadee UI", Thonburi, sans-serif;"> tddft_psi(:,ibnd,1) = tddft_psi(:,ibnd,1) / norm</span><br>
<span style="font-family: "Leelawadee UI", Thonburi, sans-serif;"> </span><br>
<span style="font-family: "Leelawadee UI", Thonburi, sans-serif;"> enddo</span></div>
<div><span style="font-family: DaunPenh, "Leelawadee UI", "Khmer MN", sans-serif;"></span></div>
<p><br>
</p>
<p><br>
</p>
<p style="margin-top:0;margin-bottom:0">Is there a subroutine that can calculate <span style="font-family: DaunPenh, "Leelawadee UI", "Khmer MN", sans-serif; color: rgb(0, 0, 0);">
<psi_i| S |psi_j> </span>?</p>
<p style="margin-top:0;margin-bottom:0">Also, what is the difference between npw and npwx ?</p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0">John<br>
</p>
<p></p>
</div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> users <users-bounces@lists.quantum-espresso.org> on behalf of Paolo Giannozzi <p.giannozzi@gmail.com><br>
<b>Sent:</b> Wednesday, December 12, 2018 7:18:09 AM<br>
<b>To:</b> Quantum Espresso users Forum<br>
<b>Subject:</b> Re: [QE-users] How is the wavefunction supposed to be normalized?</font>
<div> </div>
</div>
<div>
<div dir="ltr">On Tue, Dec 11, 2018 at 7:09 PM John McFarland <<a href="mailto:jm18ec@my.fsu.edu">jm18ec@my.fsu.edu</a>> wrote:<br>
<div class="x_gmail_quote">
<blockquote class="x_gmail_quote" style="margin:0px 0px 0px 0.8ex; border-left:1px solid rgb(204,204,204); padding-left:1ex">
<div dir="ltr">
<div id="x_gmail-m_-3419704346064079553divtagdefaultwrapper" dir="ltr" style="font-size:12pt; color:rgb(0,0,0); font-family:Calibri,Helvetica,sans-serif">
<br>
<p style="margin-top:0px; margin-bottom:0px">I forgot to ask if different bands are orthogonal for the contraction over the S matrix.
<br>
</p>
</div>
</div>
</blockquote>
<div><br>
</div>
<div>yes, they are <br>
</div>
<div><br>
</div>
<div>Paolo<br>
</div>
<blockquote class="x_gmail_quote" style="margin:0px 0px 0px 0.8ex; border-left:1px solid rgb(204,204,204); padding-left:1ex">
<div dir="ltr">
<div id="x_gmail-m_-3419704346064079553divtagdefaultwrapper" dir="ltr" style="font-size:12pt; color:rgb(0,0,0); font-family:Calibri,Helvetica,sans-serif">
<p style="margin-top:0px; margin-bottom:0px"></p>
<p style="margin-top:0px; margin-bottom:0px"><br>
</p>
<p style="margin-top:0px; margin-bottom:0px">John<br>
</p>
</div>
<hr style="display:inline-block; width:98%">
<div id="x_gmail-m_-3419704346064079553divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>From:</b> users <<a href="mailto:users-bounces@lists.quantum-espresso.org" target="_blank">users-bounces@lists.quantum-espresso.org</a>>
on behalf of Stefano de Gironcoli <<a href="mailto:degironc@sissa.it" target="_blank">degironc@sissa.it</a>><br>
<b>Sent:</b> Tuesday, December 11, 2018 10:26:15 AM<br>
<b>To:</b> <a href="mailto:users@lists.quantum-espresso.org" target="_blank">users@lists.quantum-espresso.org</a><br>
<b>Subject:</b> Re: [QE-users] How is the wavefunction supposed to be normalized?</font>
<div> </div>
</div>
<div style="background-color:rgb(255,255,255)">
<p><tt>yes, except the S matrix is never stored anywhere but is applied to the wfc by the s_1psi routine,</tt></p>
<p><tt>so more something like <br>
</tt></p>
<p><tt><br>
</tt></p>
<p><tt> sum = 0.d0</tt></p>
<p><tt> call s_1psi( npwx, npw, evc(1,b), spsi )</tt></p>
<p><tt> DO i = 1,npw</tt></p>
<p><tt> sum = sum + conjg(evc(i,b)) * spsi(i)<br>
END DO</tt></p>
<p><tt> <br>
</tt></p>
<p><br>
</p>
<p>stefano</p>
<p><br>
</p>
<div class="x_gmail-m_-3419704346064079553x_moz-cite-prefix">On 11/12/18 15:36, John McFarland wrote:<br>
</div>
<blockquote type="cite">
<div id="x_gmail-m_-3419704346064079553x_divtagdefaultwrapper" dir="ltr" style="font-size:12pt; color:rgb(0,0,0); font-family:Calibri,Helvetica,sans-serif">
<p style="margin-top:0px; margin-bottom:0px">Dear all,</p>
<p style="margin-top:0px; margin-bottom:0px"><br>
</p>
<p style="margin-top:0px; margin-bottom:0px">As I understand it, the wavefunction for each k-point is given by ecv(:,:), with the first index representing a single particle basis and the second index representing each band. I'm guessing that when a normalized
wavefunction is contracted over the S matrix, the result should equal one for each band. What I think this would look like in code is:<br>
</p>
<p style="margin-top:0px; margin-bottom:0px"><br>
</p>
<p style="margin-top:0px; margin-bottom:0px"><span style="font-family:"Arial Black",Arial,sans-serif"> sum = 0</span><br>
</p>
<p style="margin-top:0px; margin-bottom:0px"><span style="font-family:"Arial Black",Arial,sans-serif"> DO i = 1,npwx</span></p>
<p style="margin-top:0px; margin-bottom:0px"><span style="font-family:"Arial Black",Arial,sans-serif"> DO j = 1,npwx</span></p>
<p style="margin-top:0px; margin-bottom:0px"><span style="font-family:"Arial Black",Arial,sans-serif"> sum = sum + evc(i,b) * S(i,j) *
</span><span style="font-family:"Arial Black",Arial,sans-serif">evc(j,b)</span></p>
<p style="margin-top:0px; margin-bottom:0px"><span style="font-family:"Arial Black",Arial,sans-serif"> END DO</span></p>
<p style="margin-top:0px; margin-bottom:0px"><span style="font-family:"Arial Black",Arial,sans-serif"> END DO</span></p>
<p style="margin-top:0px; margin-bottom:0px"><span><br>
</span></p>
<p style="margin-top:0px; margin-bottom:0px"><span>and sum should equal 1 for any band b. Is my understanding correct?</span></p>
<p style="margin-top:0px; margin-bottom:0px"><span><br>
</span></p>
<p style="margin-top:0px; margin-bottom:0px"><span>Best regards,<br>
</span></p>
<p style="margin-top:0px; margin-bottom:0px"><span>John McFarland<br>
</span></p>
</div>
<br>
<fieldset class="x_gmail-m_-3419704346064079553x_mimeAttachmentHeader"></fieldset>
<pre class="x_gmail-m_-3419704346064079553x_moz-quote-pre">_______________________________________________
users mailing list
<a class="x_gmail-m_-3419704346064079553x_moz-txt-link-abbreviated" href="mailto:users@lists.quantum-espresso.org" target="_blank">users@lists.quantum-espresso.org</a>
<a class="x_gmail-m_-3419704346064079553x_moz-txt-link-freetext" href="https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.quantum-2Despresso.org_mailman_listinfo_users&d=DwMD-g&c=MNHwOqQ8N1u91SoMLfIblwuGXKgp50OPUXjl8uRAbak&r=aBqxGb3Z1QZuWuPQzYblq8v7-w7hDZgkvgBYwm8sq8Y&m=0_ldi_kPdbF9G-LbLtc8g1MiFx1QDdFx9WUZmApxI8M&s=dRaIjvkziJzsYp5az0bdiOPHS0PsijOxraxkUi-8mkk&e=" target="_blank">https://lists.quantum-espresso.org/mailman/listinfo/users</a></pre>
</blockquote>
</div>
</div>
_______________________________________________<br>
users mailing list<br>
<a href="mailto:users@lists.quantum-espresso.org" target="_blank">users@lists.quantum-espresso.org</a><br>
<a href="https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.quantum-2Despresso.org_mailman_listinfo_users&d=DwMFaQ&c=MNHwOqQ8N1u91SoMLfIblwuGXKgp50OPUXjl8uRAbak&r=aBqxGb3Z1QZuWuPQzYblq8v7-w7hDZgkvgBYwm8sq8Y&m=5F3TEhvdYp54Q0laoJShocEPobv6Fdwa8cVmK8bEpb4&s=dzgK3h4h1iiuyVnbojpCMP4RVyEqu9foD8UmwxkxEmo&e=" rel="noreferrer" target="_blank">https://lists.quantum-espresso.org/mailman/listinfo/users</a></blockquote>
</div>
<br clear="all">
<br>
-- <br>
<div dir="ltr" class="x_gmail_signature">
<div dir="ltr">
<div>
<div dir="ltr">
<div>Paolo Giannozzi, Dip. Scienze Matematiche Informatiche e Fisiche,<br>
Univ. Udine, via delle Scienze 208, 33100 Udine, Italy<br>
Phone +39-0432-558216, fax +39-0432-558222<br>
<br>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>