pymatgen icon indicating copy to clipboard operation
pymatgen copied to clipboard

Lacking features in CompleteDos class.

Open sreeharshab opened this issue 7 months ago • 4 comments

Feature Requested

Hello,

I was using the CompleteDos class from pymatgen.electronic_structure.dos module to parse Dos values and I found some features to be lacking.

  1. Why is there no provision to get CompleteDos from a DOSCAR (at least to my knowledge, let me know otherwise)?
  2. Why are a lot of methods in the class strictly orbital projected, for example, get_band_center(band: OrbitalType = OrbitalType.d)?

Thank you, Harsha

Proposed Solution

  1. In pymatgen.io.vasp, implement a read method for DOSCAR.
  2. I feel it is intuitive to get the band center for total Dos when the method is called with no parameters (like CompleteDos. get_band_center()), and then provide an optional band parameter to get orbital projected band center (like CompleteDos.get_band_center(band=OrbitalType.d)).

Relevant Information

No response

sreeharshab avatar Jun 15 '25 01:06 sreeharshab

Anything you can get from DOSCAR you can get by reading the vasprun.xml. Is there a reason where this is needed?

shyuep avatar Jun 15 '25 16:06 shyuep

Thank you for the reply, Prof. Shyue Ping Ong. I can get the same information from vasprun.xml. However, it would be great as a supplementary feature. I'm coming from an ASE background; I always save OUTCAR and DOSCAR (and never save vasprun.xml, which I realized is a bad idea). It will always be helpful to have additional file parsers. Let me know if I can help write a DOSCAR parser (I already have some code, and I can adapt it to pymatgen). Furthermore, please review the methods of the CompleteDos object. Please let me know if there is a specific reason for the default to be OrbitalType.d.

sreeharshab avatar Jun 15 '25 22:06 sreeharshab

Yes an implementation of a Doscar object would be welcome. It is mostly numbers so should be easy to parse.

That's just a default because that's one of the most commonly analyzed orbitals. You can specify any orbital of course.

shyuep avatar Jun 16 '25 00:06 shyuep

I will implement Doscar object as soon as I can and send a pull request.

Let's say I want the band center of the total DOS. Currently, I need to do the following: Code 1: dos = vasprun.complete_dos energies = dos.energies - dos.efermi tdos = dos.densities[Spin.up]+dos.densities[Spin.down] band_center = np.average(energies, weights=tdos)

What if I can get it as: Code 2: dos = vasprun.complete_dos band_center = dos.get_band_center()

Currently, code 2 provides the band_center of d projection of total DOS, which I feel is not intuitive because of the band=OrbitalType.d default parameter. I could also not figure out how to implement code 1 in a simpler fashion.

sreeharshab avatar Jun 16 '25 00:06 sreeharshab