Py4vasp Plots

Queries about input and output files, running specific calculations, etc.


Moderators: Global Moderator, Moderator

Locked
Message
Author
alexander_duong
Newbie
Newbie
Posts: 11
Joined: Fri Nov 03, 2023 12:09 pm

Py4vasp Plots

#1 Post by alexander_duong » Mon Mar 11, 2024 6:38 pm

Hello,

Is there a way using py4vasp to change the y-axis (energy) limits when plotting the band structure and exporting it to a file? I know that I can zoom in to the range I want to look at, but is there a way so that it only outputs a plot within that range?

Thanks!

andreas.singraber
Global Moderator
Global Moderator
Posts: 236
Joined: Mon Apr 26, 2021 7:40 am

Re: Py4vasp Plots

#2 Post by andreas.singraber » Mon Mar 18, 2024 9:10 am

Hello!

Sorry for the late reply!
To change the y-axis limits you can try the following:

Code: Select all

fig = calc.band.to_plotly()
This will take the band structure data and convert it into a plotly figure given the name fig. Then you can use plotly commands to modify the looks of the graph, e.g., in your case

Code: Select all

fig.update_layout(yaxis_range=[-4,4])
If you save the image with

Code: Select all

fig.write_image("bands.png")
the y-axis should be within the given limits also in the file output.

If you prefer to extract the band structure data directly and create your own graph then use the to_dict() method:

Code: Select all

data = calc.band.to_dict()
print(data.keys())
print(data["bands"])
returns:

Code: Select all

dict_keys(['kpoint_distances', 'kpoint_labels', 'fermi_energy', 'bands', 'occupations', 'projections'])
[[-12.37398323  -0.13705124  -0.13698808  -0.13698805   2.71211925
    2.71230009   2.7123001    3.59369258   8.12772068   8.12772071
    8.3210912   11.76821744  11.76826679  11.76826679  15.79650954
   24.22109415]
 [-12.16506281  -1.73013217  -0.42311383  -0.42301317   2.66585147
    3.1402435    3.14033932   4.92773258   7.62707016   7.62710245
    9.11779172  11.16938987  12.97571267  12.97575359  17.09479657
   22.02225903]
...
Hope this works for you!

All the best,
Andreas Singraber

alexander_duong
Newbie
Newbie
Posts: 11
Joined: Fri Nov 03, 2023 12:09 pm

Re: Py4vasp Plots

#3 Post by alexander_duong » Fri Mar 22, 2024 3:48 pm

Thank you for your help!

hongyang_ma
Newbie
Newbie
Posts: 23
Joined: Thu Oct 29, 2020 8:54 am

Re: Py4vasp Plots

#4 Post by hongyang_ma » Tue Mar 26, 2024 3:45 am

Hi Andreas,

I'm curious about how to project the x2-y2 orbital using py4vasp. Could you please let me know the name used in py4vasp for the x2-y2 orbital?

Regards,
Hongyang

andreas.singraber
Global Moderator
Global Moderator
Posts: 236
Joined: Mon Apr 26, 2021 7:40 am

Re: Py4vasp Plots

#5 Post by andreas.singraber » Tue Mar 26, 2024 10:28 pm

Hello Hongyang,

as far as I know the labels should be identical to the short ones found in the PROCAR file. There is only one exception: the hyphen in x2-y2 would conflict with the selection syntax in py4vasp and hence is renamed dx2y2. Here is the full list:

Code: Select all

s
py, pz, px
dxy, dyz, dz2, dxz, dx2y2,
fy3x2, fxyz, fyz2, fz3, fxz2, fzx2, fx3 
Unfortunately, I cannot find this small change anywhere in the documentation... sorry for this inconvenience, I will suggest this to my colleagues.

All the best,
Andreas Singraber

hongyang_ma
Newbie
Newbie
Posts: 23
Joined: Thu Oct 29, 2020 8:54 am

Re: Py4vasp Plots

#6 Post by hongyang_ma » Wed Mar 27, 2024 4:56 am

Dear Andreas,

Exactly! I've noticed that all the orbital labels work except for dx2-y2. It would be helpful to have an update in the document. Thank you very much!

Regards,
Hongyang

andreas.singraber
Global Moderator
Global Moderator
Posts: 236
Joined: Mon Apr 26, 2021 7:40 am

Re: Py4vasp Plots

#7 Post by andreas.singraber » Wed Mar 27, 2024 8:34 am

Hello!

Just another useful remark: you can get the list of all projections available in your data via

Code: Select all

calc.projector.selections()
which will return a dictionary where you can find dx2y2 in the orbital entry.

Best,
Andreas Singraber

hongyang_ma
Newbie
Newbie
Posts: 23
Joined: Thu Oct 29, 2020 8:54 am

Re: Py4vasp Plots

#8 Post by hongyang_ma » Wed Mar 27, 2024 10:56 pm

Thanks, Andreas!

Regards,
Hongyang

Locked