Skip to content

Commit e5ea14b

Browse files
committed
Add support for isolated system's enegy level plot in Bandplot
1 parent 5835a1a commit e5ea14b

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

dftio/plot/plot_eigs.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,17 @@ def plot(self, bmin:int=0, bmax:int=None):
7777
bmax = min(bmax, nbands)
7878
assert bmax>bmin, "max should be larger than min!"
7979

80-
ax.plot(self.eigs[:,bmin:bmax], 'b-', lw=1)
80+
if self.kpoints.shape[0] > 1:
81+
ax.plot(self.eigs[:,bmin:bmax], 'b-', lw=1)
82+
ax.set_xlabel("k-point")
83+
ax.set_title("Band Structure")
84+
else:
85+
for e in self.eigs[0, bmin:bmax]:
86+
ax.hlines(e, xmin=-0.5, xmax=0.5, color='b', linewidth=1)
87+
ax.set_xticks([])
88+
ax.set_title("Energy levels")
8189
ax.text(0.5, 0.5, f"band windown: {bmin} - {bmax}", ha='center', va='center', transform=ax.transAxes)
82-
ax.set_xlabel("k-point")
8390
ax.set_ylabel("Energy (eV)")
84-
ax.set_title("Band Structure")
8591
plt.savefig(os.path.join(self.path, "band_structure.png"), dpi=300)
8692
plt.tight_layout()
8793
# if has gui? then plot show

0 commit comments

Comments
 (0)