I have calculated the band structure for the 2D material MoSe2. I can plot the band structure without problem using the BSDosPlotter, but when I tried to use the BSPlotterProjected, a broken plot with only one of the elements (Se) is returned. I have attached the code to generate the plot below as well as the graphics (in PDF form) that are produced. Am I doing something incorrectly or is the code broken?
Python 3.11.5 | packaged by conda-forge | (main, Aug 27 2023, 03:34:09) [GCC 12.3.0]
Type ‘copyright’, ‘credits’ or ‘license’ for more information
IPython 8.15.0 – An enhanced Interactive Python. Type ‘?’ for help.
In [1]: bsrun = Vasprun(“vasprun.xml”,parse_projected_eigen=True)
In [2]: bs = bsrun.get_band_structure(line_mode=True)
In [3]: frompymatgen.electronic_structure.plotterimport BSPlotterProjected
Certainly, here is the vasprun.xml file. This was created running Vasp 6.4.2 and pymatgen 2023.10.11. The uncompressed version of the vasprun.xml file is quite large so here is a bzip2 compressed version. This gives the same result for the plot. vasprun.xml.bz2 (1.7 MB)
`
I’m a little late here.
I confirm that function is broken. To make it work you need to replace: plt.subplot(220 + count)
with ax = plt.subplot(220 + count)
It is not a polished function over all: it will produce always 4 plots indipendently of the number of elements, for example.
I suggest you to have a look at the other two functions: plotter.get_elt_projected_plots_color()
and plotter.get_projected_plots_dots({"Mo":['s','p','d'],"Te":['s','p','d']})
I’ll submit an issue into pymatgen, or you can do it if you like.
In case, please, cite this discussion.