WIP: ENH: usability tweaks for PDOS
Some wishes for ase.dft.pdos
were encountered while working on !1614 (merged)
-
Allow legend labels to be "pre-cooked" by looking for dos.info[i]['label']
when plotting and using this as the label. This allows a PDOS with useful groups to be pre-prepared by a method returning a DOS object. -
Pass on the arguments of DOS.plot() so that they affect the plotting output (at the moment they get reset to None
. I think that was a mistake?) -
Provide a convenient method for grouping contributions by a common info tag. So something like .group_by('symbol')
from an atom-and-orbital-resolved PDOS would return an element-resolved PDOS. -
Provide a way for the user to specify their preferred units and automatically get a sensible x-axis label -
Flesh out the docstrings and add type hints
This last point has more potential for trouble. We could attach a unit
attribute to the DOS but this detracts from its simplicity. I think the best way forward would be to add an option to the plot()
method, which
- assumes the data is currently in eV (i.e. ase standard, and recommended for methods that produce a DOS object)
- creates a new scaled DOS and xlabel, then calls
plot()
on them immediately.
What we do not want to do at any point is give the user a DOS with already-scaled x-coordinates, which they can rescale again by 'fixing' the units. We would need some process for identifying energy units and looking up a) an x-axis label and b) a conversion factor. I can easily knock together a dict for the purpose, but this seems like a useful re-usable operation that might already exist somewhere in ASE?
Pinging @AlTy
Edited by Adam Jackson