SMTG-Bham / sumo

Heavyweight plotting tools for ab initio calculations
https://smtg-bham.github.io/sumo/
MIT License
192 stars 77 forks source link

DOS plot from DOSCAR(.lobster) #237

Open joerivan opened 6 months ago

joerivan commented 6 months ago

The projections built into VASP are not always ideal, there can be significant charge spilling. Codes like lobster (cohp.de) are known to have less spilling because of more specialized projections.

My feature suggestion is thus for sumo to be able to read DOSCAR (or DOSCAR.lobster) files for the sumo-dosplot.

Currently, sumo can only read in vasprun.xml(.gz) but the DOSCAR file should contain the same information needed for the DOS plot.

With lobster you can specify a larger set of atomic orbital basis functions meaning that the projection is not just s,p,d but also has principle quantum numbers. This would mean that the dosplot would need to account for this.

The compatibility with lobster is not that important but having the ability to read DOSCAR files would in my opinion improve sumo.

ajjackson commented 6 months ago

I'm not sure I follow what information is in DOSCAR but not in the vasprun.xml? If the reason is to support import of non-standard DOSCAR files then it is difficult to support/test it reliably. In custom cases users may as well write a few lines of python to load the data with np.genfromtxt and plot with Matplotlib. Sumo-compatible styling can be managed by stealing the Sumo style sheets (see below!)

In the specific case of LOBSTER functionality, I would prefer that people use the Lobsterpy package which is intended for this, and raise Issues there if something is not working nicely https://github.com/JaGeo/LobsterPy

It uses the same matplotlib style sheet system as Sumo, so for consistent-looking results you can use the --style argument and point it at some of the Sumo style files. (They are found in the Sumo package under sumo/plotting, or you could directly download the mplstyle files from https://github.com/SMTG-Bham/sumo/tree/master/sumo/plotting.)

https://jageo.github.io/LobsterPy/reference/cli_subcommands/plot.html

joerivan commented 6 months ago

I was not aware of the Lobsterpy package, thanks for help.

My main reason for suggesting it was that reading the DOSCAR file makes sumo more versatile and gives the user more choice.

Additionally (but I didn't state that before) the DOSCAR files are way smaller than vasprun.xml. When running a lot of jobs one can then save the smaller DOSCAR files and free up some space.

Regardless, because of your answer for me it has been cleared up and this issue can be closed.

ajjackson commented 6 months ago

The trade-off between user choice and maintainability can be a difficult one! A couple of useful principles are to avoid redundancy and make use of existing tools where appropriate. But it is not always so clear-cut...

Re: disk space, I think it is possible to read gzipped files (e.g. vasprun.xml.gz) which may help.

utf commented 6 months ago

I might reopen this. There is tight integration with lobsterpy and pymatgen, so it might be easier to add lobster support than we think.

I'll have a play around with this if I get some time.

ajjackson commented 6 months ago

I don't see what Sumo would bring to the table: lobsterpy already does the orbital analysis and has a styleable CLI for plotting. If there are some tweaks to make it prettier or more user-friendly I'd rather see them go there.

(Additional context: I implemented the sumo-like styled plotting for lobsterpy, and tested it with Sumo stylesheets...)

If we would like to have a generic "plot whatever columns are in the DOSCAR" feature, I propose that it is not sumo-dosplot, but some separate sumo-generic-plot that has a simple interface, and basically plots anything that can be read with np.genfromtxt with minimal intelligence. That could be a handy general tool.