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

To share experience including discussions about scientific questions.


Moderators: Global Moderator, Moderator

Post Reply
Message
Author
marco_infantino
Newbie
Newbie
Posts: 11
Joined: Tue Apr 19, 2022 10:50 am

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

#1 Post by marco_infantino » Thu Nov 09, 2023 5:04 pm

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

henrique_miranda
Global Moderator
Global Moderator
Posts: 503
Joined: Mon Nov 04, 2019 12:41 pm
Contact:

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

#2 Post by henrique_miranda » Tue Nov 14, 2023 8:27 am

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

marco_infantino
Newbie
Newbie
Posts: 11
Joined: Tue Apr 19, 2022 10:50 am

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

#3 Post by marco_infantino » Tue Nov 14, 2023 1:08 pm

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

henrique_miranda
Global Moderator
Global Moderator
Posts: 503
Joined: Mon Nov 04, 2019 12:41 pm
Contact:

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

#4 Post by henrique_miranda » Tue Nov 14, 2023 1:38 pm

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.

Post Reply