Py4vasp Plots
Moderators: Global Moderator, Moderator
-
- Newbie
- Posts: 11
- Joined: Fri Nov 03, 2023 12:09 pm
Py4vasp Plots
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!
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!
-
- Global Moderator
- Posts: 236
- Joined: Mon Apr 26, 2021 7:40 am
Re: Py4vasp Plots
Hello!
Sorry for the late reply!
To change the y-axis limits you can try the following:
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
If you save the image with
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:
returns:
Hope this works for you!
All the best,
Andreas Singraber
Sorry for the late reply!
To change the y-axis limits you can try the following:
Code: Select all
fig = calc.band.to_plotly()
Code: Select all
fig.update_layout(yaxis_range=[-4,4])
Code: Select all
fig.write_image("bands.png")
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"])
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]
...
All the best,
Andreas Singraber
-
- Newbie
- Posts: 11
- Joined: Fri Nov 03, 2023 12:09 pm
Re: Py4vasp Plots
Thank you for your help!
-
- Newbie
- Posts: 23
- Joined: Thu Oct 29, 2020 8:54 am
Re: Py4vasp Plots
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
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
-
- Global Moderator
- Posts: 236
- Joined: Mon Apr 26, 2021 7:40 am
Re: Py4vasp Plots
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:
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
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
All the best,
Andreas Singraber
-
- Newbie
- Posts: 23
- Joined: Thu Oct 29, 2020 8:54 am
Re: Py4vasp Plots
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
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
-
- Global Moderator
- Posts: 236
- Joined: Mon Apr 26, 2021 7:40 am
Re: Py4vasp Plots
Hello!
Just another useful remark: you can get the list of all projections available in your data via
which will return a dictionary where you can find dx2y2 in the orbital entry.
Best,
Andreas Singraber
Just another useful remark: you can get the list of all projections available in your data via
Code: Select all
calc.projector.selections()
Best,
Andreas Singraber
-
- Newbie
- Posts: 23
- Joined: Thu Oct 29, 2020 8:54 am
Re: Py4vasp Plots
Thanks, Andreas!
Regards,
Hongyang
Regards,
Hongyang