@@ -774,18 +774,21 @@ def gw2wannier90(
774
774
corrections_mask = np .zeros_like (corrections_val , dtype = bool )
775
775
idx_b = corrections [:, 0 ].astype (int ) - 1
776
776
777
+ print (idx_b )
777
778
# We may have negative band index:
778
779
779
780
if len (np .where (idx_b < 0 )[0 ])> 2 :
780
781
idx_b = idx_b - np .min (idx_b )
781
782
782
783
# end negative handling.
784
+ print (idx_b )
783
785
784
786
idx_k = corrections [:, 1 ].astype (int ) - 1
785
787
corrections_val [idx_k , idx_b ] = corrections [:, 2 ]
786
788
corrections_mask [idx_k , idx_b ] = True
787
789
# Strip excluded bands
788
- if len (exbands ) > 0 :
790
+ if len (exbands ) > 0 and max (idx_b ) > nbndDFT :
791
+ # The above second condition is imposed in case we do have some QP DB in which we have idx_b larger than the required dft bands.
789
792
corrections_val = np .delete (corrections_val , exbands , axis = 1 )
790
793
corrections_mask = np .delete (corrections_mask , exbands , axis = 1 )
791
794
print ("G0W0 QP corrections read from " , seedname + ".gw.unsorted.eig" )
@@ -796,6 +799,7 @@ def gw2wannier90(
796
799
# if all((ik, ib) in list(corrections.keys()) for ik in range(NKPT))
797
800
# ]
798
801
providedGW = [ib for ib in range (nbndDFT ) if np .all (corrections_mask [:, ib ])]
802
+ print (providedGW )
799
803
# print(providedGW)
800
804
f_raw .write ("------------------------------\n " )
801
805
f_raw .write ("List of provided GW corrections (bands indexes)\n " )
0 commit comments