Skip to content

Commit

Permalink
Use reference bands to count num valence
Browse files Browse the repository at this point in the history
  • Loading branch information
qiaojunfeng committed Dec 6, 2024
1 parent 0778644 commit 2332bb8
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/aiida_wannier90_workflows/workflows/split.py
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,12 @@ def inspect_valcond(self): # pylint: disable=inconsistent-return-statements
fermi_energy = get_workchain_fermi_energy(workchain)
self.ctx.fermi_energy = fermi_energy

bands: orm.BandsData = workchain.outputs.band_structure
# Prioritize reference bands, since Wannier-interpolated bands might have
# interpolation error
if self.ctx.ref_bands is None:
bands: orm.BandsData = workchain.outputs.band_structure
else:
bands: orm.BandsData = self.ctx.ref_bands
bands_arr = bands.get_bands()
try:
homo, lumo = get_homo_lumo(bands_arr, fermi_energy)
Expand All @@ -408,7 +413,7 @@ def inspect_valcond(self): # pylint: disable=inconsistent-return-statements
if band_gap < gap_threshold:
self.report(f"{homo=}, {lumo=}, {band_gap=}, seems metal?")

num_wann = bands.creator.inputs.parameters.get_dict()["num_wann"]
num_wann = workchain.inputs.wannier90.wannier90.parameters["num_wann"]
num_val = np.count_nonzero(np.all(bands_arr <= fermi_energy, axis=0))
self.ctx.num_val = num_val
self.ctx.num_cond = num_wann - num_val
Expand Down

0 comments on commit 2332bb8

Please sign in to comment.