From f7f0a2b1f27cc1a676e78b5f40b226c6317ff8cb Mon Sep 17 00:00:00 2001 From: Matteo Giantomassi Date: Wed, 4 Dec 2024 17:18:14 +0100 Subject: [PATCH] Add band optional argument to read_qplist_sk --- abipy/abio/robots.py | 1 + abipy/electrons/gw.py | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/abipy/abio/robots.py b/abipy/abio/robots.py index 673e114bc..e8cdee48e 100644 --- a/abipy/abio/robots.py +++ b/abipy/abio/robots.py @@ -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() diff --git a/abipy/electrons/gw.py b/abipy/electrons/gw.py index d09e46db8..e8e730e2a 100644 --- a/abipy/electrons/gw.py +++ b/abipy/electrons/gw.py @@ -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. @@ -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[:, :, :]