Page 1 of 1
Assistance in Expanding GW Eigenvalues to Full BZ for EPW
Posted: Sat Mar 01, 2025 8:18 am
by Zimmi
Dear Developers and Community,
I am computing electron mobility for a 2D material using EPW with GW eigenvalues. For EPW to work, I need to provide the eigenvalues in the entire BZ (324 kpoints) but Yambo generates the eigenvalues only in the IBZ (37 kpoints). I used the YamboPy utility (bz_plot.py) to generates k-point coordinates in BZ, see the attached image.
Can you assist us with how to generate the eigenvalues for all 324 kpoints (green symbols) using the information available for 37 kpoints (IBZ-yellow symbols). We prefer not to perform calculations on the entire BZ (without using symmetry) for this purpose (although its an easy solution), due to heavy requirement of computational resources.
Re: Assistance in Expanding GW Eigenvalues to Full BZ for EPW
Posted: Sat Mar 01, 2025 9:23 am
by rreho
Dear Zimmi,
Have you tried to create an instance of the `YamboElectronsDB` class?
Like this
```
yel = YamboElectronsDB(ylat,save=save_path+'/SAVE')
```
If you do so, `yel.eigenvalues_ibz` will contain the eigenvalues in the IBZ, while `yel.eigenvalues` will contain the eigenvalues in the full BZ.
You can also try to have a look at the `expand_eigenvalues` method of `yambopy`, it's defined in different classes?
Hope this helps,
Riccardo
Re: Assistance in Expanding GW Eigenvalues to Full BZ for EPW
Posted: Sat Mar 01, 2025 4:03 pm
by Zimmi
Dear Dr. Riccardo,
Thank you for your prompt response.
I attempted to expand the ndb.QP (GW eigenvalues) to the full BZ, however, I was unable to extend the IBZ eigenvalues to the full BZ.
I have provided a Drive link (
https://drive.google.com/drive/folders/ ... drive_link) containing the gw.out/ndb.QP and SAVE/ns.db1 files, along with the Python script (qp4.py). Kindly review my code, as I may have made an error due to my limited experience with YamboPy.
Additionally, I request you to share a script for expanding the GW eigenvalues from the IBZ to the full BZ for a spin-polarized system, if possible.
Thank you for your kind support.
Re: Assistance in Expanding GW Eigenvalues to Full BZ for EPW
Posted: Mon Mar 03, 2025 5:51 pm
by palful
Dear Zimmi,
The functions `expand_eigenvalues` in YamboQPDB or `expandEigenvalues` in YamboElectronsDB can be conveniently copy-pasted in your scripts to achieve what you need with minimal modifications.
In any case, spin-polarized expansion was not supported in `expand_eigenvalues` as coded in yambopy. I have made a small patch in order to address this and allow to also expand DFT eigenvalues in one go. If you want to use the patched version, you should download the updated version from the yambopy git repository, and your script would then look like something like this:
Code: Select all
from yambopy import YamboLatticeDB,YamboQPDB
ylat = YamboLatticeDB.from_db_file(filename=f'SAVE/ns.db1')
yqp = YamboQPDB.from_db(filename='ndb.QP',folder=f'gw.out')
print(ylat)
print(yqp)
eqp_expand = yqp.expand_eigenvalues(ylat)
edft_expand = yqp.expand_eigenvalues(ylat,data=yqp.eigenvalues_dft)
print(eqp_expand.shape)
print(edft_expand.shape)
Please check if this works and gives the results you expect.
Cheers,
Fulvio
Re: Assistance in Expanding GW Eigenvalues to Full BZ for EPW
Posted: Fri Mar 07, 2025 4:09 pm
by Zimmi
Dear Dr. Fulvio,
I can not thank you enough for your continued support and help.
I have installed the recent patched version of yambopy. And used it as per your suggestion, however the code crashed, showing the following error.
Code: Select all
Traceback (most recent call last):
File "/scratch/21mt91r29/tmdc/yambo_gw/vs2/pp_stringent/gw_bands/share/p.py", line 8, in <module>
eqp_expand = yqp.expand_eigenvalues(ylat)
File "/home/21mt91r29/.conda/envs/phonopy/lib/python3.10/site-packages/yambopy/dbs/qpdb.py", line 405, in expand_eigenvalues
for ikbz in range(nkbz): eigenvalues_qp_expanded[ikbz,:] = self.eigenvalues_qp[bz2ibz[ikbz],:]
ValueError: could not broadcast input array from shape (9,2) into shape (9,)
Kindly take a look and suggest any modification that may help to solve this issue.
Re: Assistance in Expanding GW Eigenvalues to Full BZ for EPW
Posted: Mon Mar 10, 2025 10:46 am
by palful
Dear Zimmi,
It looks like there was a problem with the installation and you are still running the older version. To be safe, I would first type `pip uninstall yambopy`, and then follow these steps:
https://wiki.yambo-code.eu/wiki/index.p ... test_patch
Best,
Fulvio
Re: Assistance in Expanding GW Eigenvalues to Full BZ for EPW
Posted: Sat Mar 22, 2025 7:27 pm
by Zimmi
Dear Dr. Fulvio,
Apologies for the delayed response; I was away.
I have reinstalled the code, and it is now working. I made some adjustments to save the expanded GW eigenvalues, which are now stored in the attached file (gw_eigenvalues_spin.zip).
Code: Select all
import numpy as np
from yambopy import YamboLatticeDB, YamboQPDB
ylat = YamboLatticeDB.from_db_file(filename='SAVE/ns.db1')
yqp = YamboQPDB.from_db(filename='ndb.QP', folder='gw.out')
eqp_expand = yqp.expand_eigenvalues(ylat)
edft_expand = yqp.expand_eigenvalues(ylat, data=yqp.eigenvalues_dft)
print("Shape of expanded GW eigenvalues:", eqp_expand.shape)
print("Shape of expanded DFT eigenvalues:", edft_expand.shape)
# Save each spin channel separately
np.savetxt('expanded_gw_eigenvalues_spin1.txt', eqp_expand[:, :, 0], fmt='%.6f')
np.savetxt('expanded_gw_eigenvalues_spin2.txt', eqp_expand[:, :, 1], fmt='%.6f')
np.savetxt('expanded_dft_eigenvalues_spin1.txt', edft_expand[:, :, 0], fmt='%.6f')
np.savetxt('expanded_dft_eigenvalues_spin2.txt', edft_expand[:, :, 1], fmt='%.6f')
print("Eigenvalues saved to text files for both spin channels.")
I attempted to plot the data with respect to the k-points, as shown below (in the gw_band_structure_spin_up_dow.zip file). I would be grateful if you could take a look and advise on how I can verify whether the expansion was performed correctly. Is there any specific method or check you would recommend, sir?
Looking forward to your guidance.