a question for cofactor in function ip_eps2

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
ZHuang
Posts: 13
Joined: Sat Jul 08, 2023 3:32 pm

a question for cofactor in function ip_eps2

Post by ZHuang » Sat Sep 14, 2024 2:14 am

Dear developer,

I am confused about the cofactor used in the function ip_eps2 in dipolesdb.py in yambopy : https://github.com/yambo-code/yambopy/b ... polesdb.py

In line 381 the cofactor was defined as

Code: Select all

cofactor = spin_deg*8.*np.pi/(self.lattice.rlat_vol)
I am curious about why the volume used here is the Recip. lattice volume.
In the equation used to calculate the epsilon or absorption coefficient, it seems that the volume of the lattice cell (with the unit of m^3 or other cubic length) but not that of recip lattice was used.
For example, equation 10 in [PWSCF s epsilon.x users manual] https://web.mit.edu/espresso_v6.1/amd64 ... ps_man.pdf

I have this question because the values of the imaginary part of epsilon calculated by ip_eps2 in yambopy is much larger than that given by "yambo -o c", although they have the same shape.

However, if I used the Direct lattice volume in the cofactor (i.e., spin_deg*8.*np.pi/(self.lattice.lat_vol)), I got valueS much smaller than those calculated by "yambo -o c".

I found that the values of the imaginary part of epsilon calculated by a cofactor of spin_deg*8.*np.pi/(self.lattice.rlat_vol*self.lattice.lat_vol) matched well with that given by "yambo -o c" in both the sample and values. But this definition of cofactor causes more confusion.

Thank you very much for your kind help!
Zhipeng
Tongji University, Shanghai, China

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

Re: a question for cofactor in function ip_eps2

Post by palful » Mon Oct 07, 2024 3:03 pm

Dear Zhipeng,

Indeed, for the independent-particles response function, there is an intensity mismatch between the yambopy and yambo results. However, the definition of cofactor used in yambopy - the one that you pointed out - is the same one used in Yambo.

Recently, I have found a bug related to the incorrect accounting of the weight of the k-points in the yambopy k-sum, which I patched:

Code: Select all

412                 # rescale weight factors because we are in the expanded BZ
413                 wa    = weights[na,:]*self.nk_ibz/nkpoints
In this way, for 3D systems the IP spectrum from yambopy matches exactly that of yambo (at least in my testing). There is still some factor missing in the case of 2D systems though. In order to download the latest patched version, which is not yet available as a release on pip, I suggest to follow these steps: https://wiki.yambo-code.eu/wiki/index.p ... test_patch

Please, don't hesitate to let me know if this fixes it for you or not. Note also that in case of BSE exciton spectra the results from yambopy should match those of yambo.

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

Post Reply