<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 10pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);" class="elementToProof">
Dear Jacob,</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 10pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);" class="elementToProof">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 10pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);" class="elementToProof">
 Thanks for reporting this. It's a (known) bug. It will be fixed in the next official release of KCW.
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 10pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);" class="elementToProof">
 In the meanwhile, please try the following patch:</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 10pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);" class="elementToProof">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 10pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);" class="elementToProof ContentPasted0">
diff --git a/KCW/src/kcw_io_new.f90 b/KCW/src/kcw_io_new.f90
<div class="ContentPasted0">index 379114d30..da248ec23 100644</div>
<div class="ContentPasted0">--- a/KCW/src/kcw_io_new.f90</div>
<div class="ContentPasted0">+++ b/KCW/src/kcw_io_new.f90</div>
<div class="ContentPasted0">@@ -516,7 +516,7 @@ MODULE io_kcw</div>
<div class="ContentPasted0">         !</div>
<div class="ContentPasted0">         IF ( my_bgrp_id == root_bgrp_id ) CALL write_wfc( iunpun, &</div>
<div class="ContentPasted0">              filename, root_bgrp, intra_bgrp_comm, ik_g, tpiba*xk(:,ik), &</div>
<div class="ContentPasted0">-             ispin, nspin, evc0, npw_g, gamma_only, nbnd, &</div>
<div class="ContentPasted0">+             ispin, nspin, evc0, npw_g, gamma_only, num_wann, &</div>
<div class="ContentPasted0">              igk_l2g_kdip(:), ngk(ik), tpiba*bg(:,1), tpiba*bg(:,2), &</div>
<div class="ContentPasted0">              tpiba*bg(:,3), mill_k, 1.D0 )</div>
<div class="ContentPasted0">         !</div>
<div class="ContentPasted0">@@ -633,6 +633,7 @@ MODULE io_kcw</div>
<div class="ContentPasted0">      USE mp,                   ONLY : mp_sum, mp_max</div>
<div class="ContentPasted0">      USE io_base,              ONLY : read_wfc</div>
<div class="ContentPasted0">      USE lsda_mod,             ONLY : nspin, isk, nspin</div>
<div class="ContentPasted0">+     USE control_kcw,          ONLY : num_wann</div>
<div class="ContentPasted0">      !</div>
<div class="ContentPasted0">      IMPLICIT NONE</div>
<div class="ContentPasted0">      !</div>
<div class="ContentPasted0">@@ -722,7 +723,7 @@ MODULE io_kcw</div>
<div class="ContentPasted0">      ! ... here one should check for consistency between what is read</div>
<div class="ContentPasted0">      ! ... and what is expected</div>
<div class="ContentPasted0">      !</div>
<div class="ContentPasted0">-     IF ( nbnd_ < nbnd ) THEN</div>
<div class="ContentPasted0">+     IF ( nbnd_ < num_wann ) THEN</div>
<div class="ContentPasted0">         WRITE (msg,'("The number of bands for this run is",I6,", but only",&</div>
<div class="ContentPasted0">              & I6," bands were read from file")')  nbnd, nbnd_  </div>
<div class="ContentPasted0">         CALL errore ('pw_restart - read_collected_wfc', msg, 1 )</div>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 10pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);" class="elementToProof ContentPasted0">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 10pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);" class="elementToProof ContentPasted0">
Please let me know if this fixes the issue.<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 10pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);" class="elementToProof ContentPasted0">
Best REgards,</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 10pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);" class="elementToProof ContentPasted0">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 10pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);" class="elementToProof ContentPasted0">
Nicola Colonna <br>
</div>
<div class="elementToProof">
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 10pt; color: rgb(0, 0, 0);">
<br>
</div>
<div id="Signature">
<div>
<div style="font-family:Tahoma; font-size:13px">
<div style="font-family:Tahoma; font-size:13px">
<div style="font-family:Tahoma; font-size:13px">
<div style="font-family:Tahoma; font-size:13px">
<div style="font-family:Tahoma; font-size:13px">
<div><font face="Helvetica"><span dir="ltr" id="divtagdefaultwrapper" style="font-size:12pt"><span style="font-size:13px"><span style="font-size:13px"><span style="font-size:13px">-----------------------------------------------------</span></span></span></span></font></div>
<font face="Helvetica"></font>
<div><font face="Helvetica"><span dir="ltr" id="divtagdefaultwrapper" style="font-size:12pt"><span style="font-size:13px"><span style="font-size:13px"><span style="font-size:13px"><font color="black"><span style="text-transform:none"><font color="black"><font color="black"><span style="font-weight:normal">PAUL
 SCHERRER INSTITUT</span></font></font></span></font></span></span></span></span></font></div>
<font face="Helvetica"></font>
<div><font face="Helvetica"><span dir="ltr" id="divtagdefaultwrapper" style="font-size:12pt"><span style="font-size:13px"><span style="font-size:13px"><span style="font-size:13px"></span></span></span></span></font></div>
<font face="Helvetica"><span dir="ltr" id="divtagdefaultwrapper" style="font-size:12pt"><span style="font-size:13px"><span style="font-size:13px"><span style="font-size:13px">Nicola S. Colonna</span></span></span></span><br>
</font><font style="font-family:Calibri,Helvetica,sans-serif,serif,"EmojiFont"" size="3" face="Calibri,Helvetica,sans-serif" color="black"><span dir="ltr" id="divtagdefaultwrapper" style="font-size:12pt"><font style="font-family:Tahoma,serif,"EmojiFont"" size="1" face="Tahoma"><span style="font-size:13px"><font style="font-family:Tahoma,serif,"EmojiFont"" size="1" face="Tahoma"><span style="font-size:13px"><font style="font-family:Tahoma,serif,"EmojiFont"" size="1" face="Tahoma"><span style="font-size:13px"><font face="Helvetica"><span style="text-transform:none"><font color="black"><font color="black"><font style="font-family:Helvetica,serif,"EmojiFont"" face="Helvetica" color="black"><span style="font-weight:normal"><font face="Helvetica"></font>
<div style="text-indent:0"><font face="Helvetica">WHGA/150<br>
CH-5232 Villigen-PSI</font></div>
</span></font></font></font></span></font></span></font></span></font></span></font></span></font></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div id="appendonsend"></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> developers <developers-bounces@lists.quantum-espresso.org> on behalf of Jacob Williams <jacob.z.williams@duke.edu><br>
<b>Sent:</b> Wednesday, 23 November 2022 15:20<br>
<b>To:</b> developers@lists.quantum-espresso.org <developers@lists.quantum-espresso.org><br>
<b>Subject:</b> [QE-developers] Segmentation fault in wann2kcw</font>
<div> </div>
</div>
<style>
<!--
@font-face
        {font-family:"Cambria Math"}
@font-face
        {font-family:Calibri}
@font-face
        {font-family:"CMU Bright Roman"}
@font-face
        {}
@font-face
        {font-family:Menlo}
p.x_MsoNormal, li.x_MsoNormal, div.x_MsoNormal
        {margin:0in;
        font-size:12.0pt;
        font-family:"Calibri",sans-serif}
p.x_p1, li.x_p1, div.x_p1
        {margin:0in;
        font-size:10.5pt;
        font-family:Menlo;
        color:black}
span.x_s1
        {}
span.x_apple-converted-space
        {}
.x_MsoChpDefault
        {font-size:12.0pt;
        font-family:"Calibri",sans-serif}
@page WordSection1
        {margin:1.0in 1.0in 1.0in 1.0in}
div.x_WordSection1
        {}
-->
</style>
<div lang="EN-US" link="#0563C1" vlink="#954F72" style="word-wrap:break-word">
<div class="x_WordSection1">
<p class="x_MsoNormal"><span style="font-size:11.0pt; font-family:"CMU Bright Roman"">Dear all,</span></p>
<p class="x_MsoNormal"><span style="font-size:11.0pt; font-family:"CMU Bright Roman""> </span></p>
<p class="x_MsoNormal"><span style="font-size:11.0pt; font-family:"CMU Bright Roman"">I’ve run into a problem with segfaults in the part of KCW::wann2kcw that writes the rotated wavefunction for molecules in a supercell. The problem seems to occur when the
 cell size is big enough.</span></p>
<p class="x_MsoNormal"><span style="font-size:11.0pt; font-family:"CMU Bright Roman""> </span></p>
<p class="x_MsoNormal"><span style="font-size:11.0pt; font-family:"CMU Bright Roman"">Here I ran water with 4 occupied and 3 empty bands (disentangled from 14 nscf bands), in PBE with optimized norm-conserving Vanderbilt pseudopotentials (sr correction). The
 ecutwfc = 100 Ry, and unit cell size is 15 angstroms (ibrav = 1).</span></p>
<p class="x_MsoNormal"><span style="font-size:11.0pt; font-family:"CMU Bright Roman""> </span></p>
<p class="x_MsoNormal"><span style="font-size:11.0pt; font-family:"CMU Bright Roman"">Any help in understanding the origin of this segfault would be appreciated! Thank you in advance.</span></p>
<p class="x_MsoNormal"><span style="font-size:11.0pt; font-family:"CMU Bright Roman""> </span></p>
<p class="x_MsoNormal"><span style="font-size:11.0pt; font-family:"CMU Bright Roman"">Here is the stack trace (Intel compiler and MKL, MPI but no OpenMP, Linux machine):</span></p>
<p class="x_p1"><span class="x_s1">forrtl: severe (174): SIGSEGV, segmentation fault occurred</span></p>
<p class="x_p1"><span class="x_s1">Image</span><span class="x_apple-converted-space">             
</span><span class="x_s1">PC</span><span class="x_apple-converted-space">               
</span><span class="x_s1">Routine</span><span class="x_apple-converted-space">           
</span><span class="x_s1">Line</span><span class="x_apple-converted-space">       
</span><span class="x_s1">Source</span><span class="x_apple-converted-space">             </span></p>
<p class="x_p1"><span class="x_s1">kcw.x</span><span class="x_apple-converted-space">             
</span><span class="x_s1">0000000000F5FE9A</span><span class="x_apple-converted-space"> 
</span><span class="x_s1">Unknown </span><span class="x_apple-converted-space">             
</span><span class="x_s1">Unknown</span><span class="x_apple-converted-space">  </span>
<span class="x_s1">Unknown</span></p>
<p class="x_p1"><span class="x_s1">libpthread-2.28.s</span><span class="x_apple-converted-space"> 
</span><span class="x_s1">00007FCEC88E0730</span><span class="x_apple-converted-space"> 
</span><span class="x_s1">Unknown </span><span class="x_apple-converted-space">             
</span><span class="x_s1">Unknown</span><span class="x_apple-converted-space">  </span>
<span class="x_s1">Unknown</span></p>
<p class="x_p1"><span class="x_s1">kcw.x</span><span class="x_apple-converted-space">             
</span><span class="x_s1">00000000009E46CD</span><span class="x_apple-converted-space"> 
</span><span class="x_s1">mp_wave_mp_mergew </span><span class="x_apple-converted-space">       
</span><span class="x_s1">102</span><span class="x_apple-converted-space">  </span>
<span class="x_s1">mp_wave.f90</span></p>
<p class="x_p1"><span class="x_s1">kcw.x</span><span class="x_apple-converted-space">             
</span><span class="x_s1">00000000008F4B96</span><span class="x_apple-converted-space"> 
</span><span class="x_s1">io_base_mp_write_ </span><span class="x_apple-converted-space">       
</span><span class="x_s1">176</span><span class="x_apple-converted-space">  </span>
<span class="x_s1">io_base.f90</span></p>
<p class="x_p1"><span class="x_s1">kcw.x</span><span class="x_apple-converted-space">             
</span><span class="x_s1">00000000004329CB</span><span class="x_apple-converted-space"> 
</span><span class="x_s1">io_kcw_mp_write_m </span><span class="x_apple-converted-space">       
</span><span class="x_s1">517</span><span class="x_apple-converted-space">  </span>
<span class="x_s1">kcw_io_new.f90</span></p>
<p class="x_p1"><span class="x_s1">kcw.x</span><span class="x_apple-converted-space">             
</span><span class="x_s1">00000000004072D0</span><span class="x_apple-converted-space"> 
</span><span class="x_s1">wann2kcw_</span><span class="x_apple-converted-space">                 
</span><span class="x_s1">30</span><span class="x_apple-converted-space">  </span>
<span class="x_s1">wann2kcw.f90</span></p>
<p class="x_p1"><span class="x_s1">kcw.x</span><span class="x_apple-converted-space">             
</span><span class="x_s1">000000000040721B</span><span class="x_apple-converted-space"> 
</span><span class="x_s1">MAIN__ </span><span class="x_apple-converted-space">                   
</span><span class="x_s1">49</span><span class="x_apple-converted-space">  </span>
<span class="x_s1">kcw.f90</span></p>
<p class="x_p1"><span class="x_s1">kcw.x</span><span class="x_apple-converted-space">             
</span><span class="x_s1">0000000000407162</span><span class="x_apple-converted-space"> 
</span><span class="x_s1">Unknown </span><span class="x_apple-converted-space">             
</span><span class="x_s1">Unknown</span><span class="x_apple-converted-space">  </span>
<span class="x_s1">Unknown</span></p>
<p class="x_p1"><span class="x_s1">libc-2.28.so </span><span class="x_apple-converted-space">     
</span><span class="x_s1">00007FCEC85AD09B</span><span class="x_apple-converted-space"> 
</span><span class="x_s1">__libc_start_main </span><span class="x_apple-converted-space">   
</span><span class="x_s1">Unknown</span><span class="x_apple-converted-space">  </span>
<span class="x_s1">Unknown</span></p>
<p class="x_p1"><span class="x_s1">kcw.x</span><span class="x_apple-converted-space">             
</span><span class="x_s1">000000000040706A</span><span class="x_apple-converted-space"> 
</span><span class="x_s1">Unknown </span><span class="x_apple-converted-space">             
</span><span class="x_s1">Unknown</span><span class="x_apple-converted-space">  </span>
<span class="x_s1">Unknown</span></p>
<p class="x_MsoNormal"><span style="font-size:11.0pt; font-family:"CMU Bright Roman""> </span></p>
<p class="x_MsoNormal"><span style="font-size:11.0pt; font-family:"CMU Bright Roman""> </span></p>
<p class="x_MsoNormal"><span style="font-size:11.0pt; font-family:"CMU Bright Roman"; color:black">Sincerely yours,</span></p>
<p class="x_MsoNormal"><span style="font-size:11.0pt; font-family:"CMU Bright Roman"; color:black"> </span></p>
<p class="x_MsoNormal"><span style="font-size:11.0pt; font-family:"CMU Bright Roman"; color:black">Jacob Williams</span></p>
<p class="x_MsoNormal"><span style="font-size:11.0pt; font-family:"CMU Bright Roman"; color:black">Ph.D. candidate, Yang group</span></p>
<p class="x_MsoNormal"><span style="font-size:11.0pt; font-family:"CMU Bright Roman"; color:black">Duke University Department of Chemistry
</span></p>
</div>
</div>
</body>
</html>