Page 1 of 1

How to add fermi level as vertical line in the density of state plot

Posted: Thu Nov 09, 2023 5:04 pm
by marco_infantino
Hello dear VASP users !
I used p4v (py for vasp) to plot density of states and projected density of states.
Now, is there a way to add the fermi level in the DOS plot ? (as vertical line, I mean)
I would need it especially in the projected DOS... so, if it is possible to do it with the p4v, that would be the best.
If not, I would like to know how can I do atom projection of density of states manually, so that I can create my own script to work with the DOSCAR, and plot the final result with gnuplot or matplotlib, for instance.
Thanks and best,
Marco

Re: How to add fermi level as vertical line in the density of state plot

Posted: Tue Nov 14, 2023 8:27 am
by henrique_miranda
I will assume you are using a code similar to

Code: Select all

import py4vasp
calc = py4vasp.Calculation.from_path('.')
fig = calc.band.plot()
where 'fig' is an instance of the Graph class from which you can obtain a plotly instance using

Code: Select all

plotly_fig = fig.to_plotly()
Then you can add a vertical line to this plotly figure (see for example: https://stackoverflow.com/questions/658 ... lotly-plot)

If you want to use another plotting library of your choice you can replace the last line with

Code: Select all

data = calc.band.to_dict()
and then use the data dictionary to build the plot.

Hope this helps

Re: How to add fermi level as vertical line in the density of state plot

Posted: Tue Nov 14, 2023 1:08 pm
by marco_infantino
Hello dear Henrique, thank you.
The point is that I do not have py4vasp as a module...
Is there a way to do the same with the p4v gui ?
Best,
Marco

Re: How to add fermi level as vertical line in the density of state plot

Posted: Tue Nov 14, 2023 1:38 pm
by henrique_miranda
Ok, I am confused.
You asked about p4v (py for vasp).
I assumed you were asking about py4vasp which is a python package.
That is not to be confused with p4vasp which is an application with a GUI.
If your question was about p4vasp I fear I am not able to help you since it's outside my expertise and not maintained by the VASP team.