elphondb.py 'HEAD_KPT' error!

Post here any question you encounter when running the scripts of the yambo-py suite. Post here problem strictly to the python interface as problem coming from the yambo runs should go in the appropriate subforum.

Moderators: palful, amolina, mbonacci

Post Reply
sitangshu
Posts: 196
Joined: Thu Jan 05, 2017 8:08 am

elphondb.py 'HEAD_KPT' error!

Post by sitangshu » Fri Aug 16, 2024 12:40 pm

Hi yamboers,
I wanted to plot the electron-phonon matrix element over the BZ using yambopy. My python version is 3.10.14. The yambo version used for this calculation was from: https://github.com/attacc/yambo.git yambo-excph.
My SAVE folder contains: ndb.elph_gkkp_expanded* (from 1-324), ndb.PH_Double_Grid, ns.nlcc_pp_pwscf, ns.db1, ndb.gops, ndb.kindx, ns.kb_pp_pwscf*, ns.wf and ns.wf_fragments*
While running the python elph_plot.py, I get this error:

(yambopy) sitangshubhattacharya@Sitangshus-iMac databases_yambopy % python elph_plot.py
37 kpoints expanded to 324
Traceback (most recent call last):
File "/Users/sitangshubhattacharya/yambopy/tutorial/databases_yambopy/elph_plot.py", line 34, in <module>
yelph = YamboElectronPhononDB(ylat,folder_gkkp=save_path+'/SAVE',save=save_path+'/SAVE')
File "/opt/anaconda3/envs/yambopy/lib/python3.10/site-packages/yambopy/dbs/elphondb.py", line 97, in __init__
self.ibz_kpoints_elph = database.variables['HEAD_KPT'][:].T
KeyError: 'HEAD_KPT'

I have tested that the gkkp* files are not bad. I can use them (unexpanded) to obtain all QP energies at variety of temperatures.
I used these parameters in the elph_plot.py script:
i_n, i_m = [25,26] #i_n =25 -> valence band, i_n = 26 -> conduction band
i_nu = 3 # LA phonon mode at K (ZO mode at Gamma); LO, TO modes are i_nu=4,5
i_q = 323 # This is the K-point in the hexagonal BZ
i_k = 323
I tried with the hBN database, but it did not give me this error. Is it related to yambo version? I realized that the hBN database was done on a different version. It does not have ns.nlcc_pp_pwscf file.
A little advise will be very much appreciated.

Regards,
Sitangshu
Sitangshu Bhattacharya
Indian Institute of Information Technology-Allahabad
India
Web-page: http://profile.iiita.ac.in/sitangshu/
Institute: http://www.iiita.ac.in/

User avatar
palful
Posts: 98
Joined: Tue Jan 26, 2016 11:23 am
Location: Modena and Milan

Re: elphondb.py 'HEAD_KPT' error!

Post by palful » Mon Sep 02, 2024 10:55 am

Dear Sitangshu,

This is strange. I have checked with a recent yambo version and the 'HEAD_KPT' variable seems to be there in the expanded databases. Are you reading the expanded "ndb.elph_gkkp_expanded*" files or the unexpanded matrix elements?

If you attach the head database (the one without *_fragment* in the name) and the ns.db1 file from the SAVE directory, I could investigate further. The presence or absence of other databases beyond ns.db1 in the SAVE does not affect this part of yambopy.

Best,
Fulvio
Dr. Fulvio Paleari
S3-CNR Institute of Nanoscience and MaX Center
Modena, Italy

sitangshu
Posts: 196
Joined: Thu Jan 05, 2017 8:08 am

Re: elphondb.py 'HEAD_KPT' error!

Post by sitangshu » Fri Sep 06, 2024 8:04 pm

Thank you Fulvio for your response. I have the I checked this and found that I need to comment gkkp_db in the input. By doing this, I can plot the matrix elements.

Regards,
Sitangshu
Sitangshu Bhattacharya
Indian Institute of Information Technology-Allahabad
India
Web-page: http://profile.iiita.ac.in/sitangshu/
Institute: http://www.iiita.ac.in/

User avatar
csk
Posts: 15
Joined: Wed Aug 28, 2024 9:54 pm

Re: elphondb.py 'HEAD_KPT' error!

Post by csk » Wed Jun 11, 2025 10:54 am

Hi!

I am facing the same problem and commenting out 'gkkp_db' in the ypp_ph input file does not work for me. Do you have any suggestions?

The yambo version I use is 5.2.3 as compiled on the Leonardo cluster. I also attach the db files 'ndb.elph_gkkp_expanded', as well as the input, output and report files from ypp_ph (remove '.txt' which I added for the forum upload).

What I find strange is that in the output file of ypp_ph, 77 k-points are detected, while there are 27 in the report file (which is correct for the IBZ)...

Thanks for your help!
Christian
You do not have the required permissions to view the files attached to this post.
Christian Kern, University of Graz, Austria

User avatar
csk
Posts: 15
Joined: Wed Aug 28, 2024 9:54 pm

Re: elphondb.py 'HEAD_KPT' error!

Post by csk » Wed Jun 11, 2025 2:42 pm

Update: the error can also be reproduced with the electron-phonon tutorial on bulk Si (https://wiki.yambo-code.eu/wiki/index.p ... n_coupling).

If I un-comment #GkkpExpand in the last step and try to read the DB with the following python code (in the folder dvscf/si.save), I get the same error.

Code: Select all

from yambopy import *

ylat = YamboLatticeDB.from_db_file(filename="SAVE/ns.db1")
yelph = YamboElectronPhononDB(ylat,folder_gkkp='SAVE',save='SAVE')
Greetings,
Christian
Christian Kern, University of Graz, Austria

User avatar
palful
Posts: 98
Joined: Tue Jan 26, 2016 11:23 am
Location: Modena and Milan

Re: elphondb.py 'HEAD_KPT' error!

Post by palful » Mon Jun 16, 2025 6:06 pm

Dear Christian and Sitangshu,

You are right. Somehow, the variable "HEAD_KPT" (containing the k-point coordinates in the irreducible BZ in yambo units) stopped being printed in the el-ph database, but only in the expanded case.

I assume this was a "sneaky" change introduced at some point in the new yambo versions, as indeed that variable was not very useful.

I have patched yambopy to handle this, you can find the updated version on the github repository.

Thank you for spotting this.

Let me also mention that we are completely revamping the way electron-phonon coupling matrix elements are calculated, by making use of the new auxiliary "LetzElPhC" code (you can find it on the yambo github page as well). There has not been any "official" release -- and no update in the wiki so far, it will come at a certain point -- but it can be used. This makes a large part of what you see in the current wiki tutorial obsolete.

Best,
Fulvio
Dr. Fulvio Paleari
S3-CNR Institute of Nanoscience and MaX Center
Modena, Italy

Post Reply