Skip to content

Commit

Permalink
Add band optional argument to read_qplist_sk
Browse files Browse the repository at this point in the history
  • Loading branch information
gmatteo committed Dec 4, 2024
1 parent e4388d9 commit f7f0a2b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions abipy/abio/robots.py
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,7 @@ def add_file(self, label, abifile, filter_abifile=None) -> None:
"""
if is_string(abifile):
from abipy.abilab import abiopen
print(f"{abifile=}")
abifile = abiopen(abifile)
if filter_abifile is not None and not filter_abifile(abifile):
abifile.close()
Expand Down
7 changes: 5 additions & 2 deletions abipy/electrons/gw.py
Original file line number Diff line number Diff line change
Expand Up @@ -1798,7 +1798,7 @@ def read_allqps(self, ignore_imag=False) -> tuple:

return tuple(qps_spin)

def read_qplist_sk(self, spin, kpoint, ignore_imag=False) -> QPList:
def read_qplist_sk(self, spin, kpoint, band=None, ignore_imag=False) -> QPList:
"""
Read and return QPList object for the given spin, kpoint.
Expand All @@ -1808,8 +1808,11 @@ def read_qplist_sk(self, spin, kpoint, ignore_imag=False) -> QPList:
ikcalc = self.kpt2ikcalc(kpoint)
bstart, bstop = self.bstart_sk[spin, ikcalc], self.bstop_sk[spin, ikcalc]

band_list = list(range(bstart, bstop)) if band is None else \
[b for b in range(bstart, bstop) if b != band]

return QPList([self.read_qp(spin, kpoint, band, ignore_imag=ignore_imag)
for band in range(bstart, bstop)])
for band in band_list])

def read_qpenes(self):
return self._egw[:, :, :]
Expand Down

0 comments on commit f7f0a2b

Please sign in to comment.