Induced density

Deals with issues related to computation of optical spectra in reciprocal space: RPA, TDDFT, local field effects.

Moderators: Davide Sangalli, andrea.ferretti, myrta gruning, andrea marini, Daniele Varsano, Conor Hogan

Post Reply
User avatar
csk
Posts: 19
Joined: Wed Aug 28, 2024 9:54 pm

Induced density

Post by csk » Wed Jan 14, 2026 3:24 pm

Dear all!

I am trying to compute the induced density in a metal slab, which I ultimately want in the direction perpendicular to the slab, i.e. integrated over the two periodic directions. To this end, I compute the RPA response function and get the real- and imaginary part of alpha. Now, the induced density (in linear order) should be the integral over the ground state density and the density-density response function. Is there a possibility how I can get the latter in real-space from Yambo?

Many thanks,
Christian
Christian Kern, University of Graz, Austria

User avatar
Davide Sangalli
Posts: 664
Joined: Tue May 29, 2012 4:49 pm
Location: Via Salaria Km 29.3, CP 10, 00016, Monterotondo Stazione, Italy
Contact:

Re: Induced density

Post by Davide Sangalli » Wed Jan 14, 2026 4:03 pm

Dear Christian,
yambo can give you the response function in G-space. X_{G,G'}(q,\omega)
Page 7 here: https://wiki.yambo-code.eu/wiki/index.p ... heatsheets --> https://wiki.yambo-code.eu/wiki/index.p ... 5.0_P7.png

What you probably (?) want is the induced density
rho_G(q,\omega) = sum_G' X_{G,G'}(q,\omega) V^{ext}_{G'}(q,\omega)

If you are fine with the q=0 and \omega=0 the info you need is printed in the database of the screening ndb.em1s_fragment_1.
Probably with yambopy you can try to code the above equation by reading the ndb.em1s_fragment_1 or similar.

Best,
D.
Davide Sangalli, PhD
Piazza Leonardo Da Vinci, 32, 20133 – Milano
CNR, Istituto di Struttura della Materia (ISM)
https://sites.google.com/view/davidesangalli
http://www.max-centre.eu/

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

Re: Induced density

Post by csk » Wed Jan 14, 2026 4:28 pm

Dear Davide!

Many thanks for your reply!

1) What runlevel would I need such that ndb.em1s* are stored? With "yambo -o c -k Hartree -r" only the dipoles and RIM/cutoff are stored.

2) Can I also access the X_{G,G'}(q,\omega) elements for \omega > 0? If I understand correctly, those are controlled by "ETStpsXd" and "EnRngeXd"?

Cheers,
Christian
Christian Kern, University of Graz, Austria

User avatar
Davide Sangalli
Posts: 664
Joined: Tue May 29, 2012 4:49 pm
Location: Via Salaria Km 29.3, CP 10, 00016, Monterotondo Stazione, Italy
Contact:

Re: Induced density

Post by Davide Sangalli » Wed Jan 14, 2026 4:55 pm

For the static screening:

Code: Select all

yambo -X b
https://wiki.yambo-code.eu/wiki/index.p ... _screening

If you want the frequency dependent screening use either multi-plasmon pole (MPA) or full freqeuncy (FF)

Code: Select all

yambo -X d / PA
https://wiki.yambo-code.eu/wiki/index.p ... tion_(MPA)

Pleas notice that, however it is not directly the reponse function which is written in the databases, but v(G)*X_{G,G'} (if I'm not wrong), both in the static and in the dynamical case

There is in principle also the option

Code: Select all

yambo -X X
which directly prints the response function, but it is not very much tested.

Best,
D.
Davide Sangalli, PhD
Piazza Leonardo Da Vinci, 32, 20133 – Milano
CNR, Istituto di Struttura della Materia (ISM)
https://sites.google.com/view/davidesangalli
http://www.max-centre.eu/

User avatar
Daniele Varsano
Posts: 4308
Joined: Tue Mar 17, 2009 2:23 pm
Contact:

Re: Induced density

Post by Daniele Varsano » Thu Jan 15, 2026 11:56 am

Dear Christian,

just a small warning. In metals, in the long range limit q->0 intraband contribution to the response functions are not taken into account, while they are for finite q. What you can do is to extrapolate the q->0 limit from the calculated values at finite q.

Best,
Daniele
Dr. Daniele Varsano
S3-CNR Institute of Nanoscience and MaX Center, Italy
MaX - Materials design at the Exascale
http://www.nano.cnr.it
http://www.max-centre.eu/

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

Re: Induced density

Post by csk » Mon Jan 19, 2026 3:34 pm

Thanks for both of your suggestions!

@ Davide: I tried the "-X X" option and get the error

Code: Select all

[ERROR] STOP signal received while in[07] Optics
[ERROR] [DIP] Header not correct or missing while reading dipoles
I also attach my input file, maybe you spot any obvious mistakes there? In the meantime I will try the option with calculating the dynamic response function...

@ Daniele: thanks for reminding me of this. If I manage to get that far, I will try to look at non-zero q and test how smooth the limit is approached and try to extrapolate...

Best regards,
Christian
You do not have the required permissions to view the files attached to this post.
Christian Kern, University of Graz, Austria

User avatar
Daniele Varsano
Posts: 4308
Joined: Tue Mar 17, 2009 2:23 pm
Contact:

Re: Induced density

Post by Daniele Varsano » Mon Jan 19, 2026 3:43 pm

Dear Christian,

I'm unable to spot anything wrong in your input.
Can you also post the report file?

Best,

Daniele
Dr. Daniele Varsano
S3-CNR Institute of Nanoscience and MaX Center, Italy
MaX - Materials design at the Exascale
http://www.nano.cnr.it
http://www.max-centre.eu/

User avatar
Davide Sangalli
Posts: 664
Joined: Tue May 29, 2012 4:49 pm
Location: Via Salaria Km 29.3, CP 10, 00016, Monterotondo Stazione, Italy
Contact:

Re: Induced density

Post by Davide Sangalli » Thu Jan 22, 2026 10:10 pm

Can you attach also the log and the report of the run?
Davide Sangalli, PhD
Piazza Leonardo Da Vinci, 32, 20133 – Milano
CNR, Istituto di Struttura della Materia (ISM)
https://sites.google.com/view/davidesangalli
http://www.max-centre.eu/

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

Re: Induced density

Post by csk » Fri Jan 23, 2026 12:52 pm

Hi!

Please find attached the report- and log files. I should say that the output of the report is butchered, which is always the case for me when a job is not properly finishing on this GPU cluster, maybe something to do with I/O buffering...?

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

User avatar
Davide Sangalli
Posts: 664
Joined: Tue May 29, 2012 4:49 pm
Location: Via Salaria Km 29.3, CP 10, 00016, Monterotondo Stazione, Italy
Contact:

Re: Induced density

Post by Davide Sangalli » Fri Jan 23, 2026 2:00 pm

This might be a cluster with asynchronous I/O

We have experienced this issue in the past, and we have a workaround in the code which might not be enough.

If you can edit and recompile the code, you can try to edit the subroutine

Code: Select all

src/dipoles/DIPOLE_IO.F
and change

Code: Select all

max_count=120
with

Code: Select all

max_count=1200
An alternative is to pre-compute the dipoles (it should be quick) with this input

Code: Select all

dipoles                          # [R] Oscillator strenghts (or dipoles)
FFTGvecs=  45253           RL    # [FFT] Plane-waves
NonPDirs= "none"                 # [X/BSS] Non periodic chartesian directions (X,Y,Z,XY...)
% DipBands
    1 |  800 |                       # [DIP] Bands range for dipoles
%
#DipBandsALL                   # [DIP] Compute all bands range, not only valence and conduction
DipApproach= "G-space v"         # [DIP] [G-space v/R-space x/Covariant/Shifted grids]
Gauge= "length"                  # [BSE/X] Gauge (length|velocity)
runnning

Code: Select all

yambo -F dipoles.in -J dipoles -C dipoles
and later run

Code: Select all

yambo -F response.in -J "response,dipoles" -C response
Davide Sangalli, PhD
Piazza Leonardo Da Vinci, 32, 20133 – Milano
CNR, Istituto di Struttura della Materia (ISM)
https://sites.google.com/view/davidesangalli
http://www.max-centre.eu/

Post Reply