Skip to content

Commit 96114da

Browse files
committed
add option to plot only total DOS
1 parent 2dd38d2 commit 96114da

File tree

1 file changed

+19
-13
lines changed

1 file changed

+19
-13
lines changed

crystal_toolkit/components/bandstructure.py

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -541,11 +541,10 @@ def get_dos_traces(dos, dos_select, energy_window=(-6.0, 10.0)):
541541

542542
dostraces.append(trace_tdos)
543543

544-
ele_dos = dos.get_element_dos()
545-
elements = [str(entry) for entry in ele_dos.keys()]
546-
547-
if dos_select == "ap":
548-
proj_data = ele_dos
544+
if dos_select == "tot":
545+
proj_data = {}
546+
elif dos_select == "ap":
547+
proj_data = dos.get_element_dos()
549548
elif dos_select == "op":
550549
proj_data = dos.get_spd_dos()
551550
elif "orb" in dos_select:
@@ -670,14 +669,21 @@ def get_figure(
670669
)
671670
traces += dostraces
672671

673-
rmax = max(
674-
[
675-
max(dostraces[0]["x"]),
676-
abs(min(dostraces[0]["x"])),
677-
max(dostraces[1]["x"]),
678-
abs(min(dostraces[1]["x"])),
679-
]
680-
)
672+
list_max = [
673+
max(dostraces[0]["x"]),
674+
abs(min(dostraces[0]["x"])),
675+
]
676+
677+
# check the max of the second dos trace only if spin polarized
678+
spin_polarized = len(dos.densities.keys()) == 2
679+
if spin_polarized:
680+
list_max.extend(
681+
[
682+
max(dostraces[1]["x"]),
683+
abs(min(dostraces[1]["x"])),
684+
]
685+
)
686+
rmax = max(list_max)
681687

682688
xaxis_style_dos = dict(
683689
title=dict(text="Density of States", font=dict(size=16)),

0 commit comments

Comments
 (0)