Skip to content

Commit 74ddcde

Browse files
author
Miki Bonacci
committed
fixing gw2wannier90.py to work with exclude bands.
1 parent 696c6c2 commit 74ddcde

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

examples/example_complete_Cu.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -195,9 +195,9 @@ def submit(group: orm.Group = None, run: bool = False, projections="atomic_proje
195195
# SKIP the yambo QP step:
196196
# this will skip yambo_qp, but be sure to provide QP_DB and parent_folder to ypp inputs.
197197
# In general, you can do this if you have already the yambo results.
198-
#builder.pop('yambo_qp')
199-
#builder.ypp.ypp.QP_DB = orm.load_node(13233)
200-
#builder.ypp.parent_folder = orm.load_node(13069).outputs.remote_folder
198+
builder.pop('yambo_qp')
199+
builder.ypp.ypp.QP_DB = orm.load_node(15785)
200+
builder.ypp.parent_folder = orm.load_node(15693).outputs.remote_folder
201201

202202
# SET custom K-MESH:
203203
kpoints = orm.KpointsData() # to skip the convergence

utils/gw2wannier90.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -774,18 +774,21 @@ def gw2wannier90(
774774
corrections_mask = np.zeros_like(corrections_val, dtype=bool)
775775
idx_b = corrections[:, 0].astype(int) - 1
776776

777+
print(idx_b)
777778
# We may have negative band index:
778779

779780
if len(np.where(idx_b<0)[0])>2:
780781
idx_b = idx_b - np.min(idx_b)
781782

782783
# end negative handling.
784+
print(idx_b)
783785

784786
idx_k = corrections[:, 1].astype(int) - 1
785787
corrections_val[idx_k, idx_b] = corrections[:, 2]
786788
corrections_mask[idx_k, idx_b] = True
787789
# 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.
789792
corrections_val = np.delete(corrections_val, exbands, axis=1)
790793
corrections_mask = np.delete(corrections_mask, exbands, axis=1)
791794
print("G0W0 QP corrections read from ", seedname + ".gw.unsorted.eig")
@@ -796,6 +799,7 @@ def gw2wannier90(
796799
# if all((ik, ib) in list(corrections.keys()) for ik in range(NKPT))
797800
# ]
798801
providedGW = [ib for ib in range(nbndDFT) if np.all(corrections_mask[:, ib])]
802+
print(providedGW)
799803
# print(providedGW)
800804
f_raw.write("------------------------------\n")
801805
f_raw.write("List of provided GW corrections (bands indexes)\n")

0 commit comments

Comments
 (0)