Skip to content

Commit

Permalink
Added kdirect option back to bandsplot
Browse files Browse the repository at this point in the history
  • Loading branch information
lllangWV committed Nov 14, 2023
1 parent a6c5b8d commit 995e91a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
10 changes: 8 additions & 2 deletions pyprocar/plotter/ebs_plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ def __init__(self,
ebs:ElectronicBandStructure,
kpath:KPath=None,
ax:mpl.axes.Axes=None,
spins:List[int]=None,
spins:List[int]=None,
kdirect:bool=True,
**kwargs):
config_manager=ConfigManager(os.path.join(ROOT,'pyprocar','cfg','band_structure.yml'))
config_manager.update_config(kwargs)
Expand All @@ -53,6 +54,7 @@ def __init__(self,
self.ebs = ebs
self.kpath = kpath
self.spins = spins
self.kdirect=kdirect
if self.spins is None:
self.spins = range(self.ebs.nspins)
self.nspins = len(self.spins)
Expand Down Expand Up @@ -96,8 +98,12 @@ def _get_x(self):
"""
pos = 0
if self.kpath is not None and self.kpath.nsegments == len(self.kpath.ngrids):

for isegment in range(self.kpath.nsegments):
kstart, kend = self.kpath.special_kpoints[isegment]
if self.kdirect is False:
kstart=np.dot(self.ebs.reciprocal_lattice,kstart)
kend=np.dot(self.ebs.reciprocal_lattice,kend)

distance = np.linalg.norm(kend - kstart)
if isegment == 0:
Expand Down Expand Up @@ -305,7 +311,7 @@ def plot_parameteric(
if vmax is None:
vmax = color_weights[:,:,spins].max()
norm = mpl.colors.Normalize(vmin, vmax)
# print(self.ebs.nbands)
for ispin in spins:
for iband in range(self.ebs.nbands):
if len(self.spins)==1:
Expand Down
3 changes: 2 additions & 1 deletion pyprocar/scripts/scriptBandsplot.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ def bandsplot(
projection_mask:np.ndarray=None,
kticks=None,
knames=None,
kdirect:bool=True,
elimit: List[float]=None,
ax:plt.Axes=None,
show:bool=True,
Expand Down Expand Up @@ -112,7 +113,7 @@ def bandsplot(
else:
fermi_level = 0

ebs_plot = EBSPlot(ebs, kpath, ax, spins ,**kwargs)
ebs_plot = EBSPlot(ebs, kpath, ax, spins, kdirect=kdirect ,**kwargs)


labels = []
Expand Down

0 comments on commit 995e91a

Please sign in to comment.