Page 1 of 1

Induced density

Posted: Wed Jan 14, 2026 3:24 pm
by csk
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

Re: Induced density

Posted: Wed Jan 14, 2026 4:03 pm
by Davide Sangalli
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.

Re: Induced density

Posted: Wed Jan 14, 2026 4:28 pm
by csk
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

Re: Induced density

Posted: Wed Jan 14, 2026 4:55 pm
by Davide Sangalli
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.

Re: Induced density

Posted: Thu Jan 15, 2026 11:56 am
by Daniele Varsano
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

Re: Induced density

Posted: Mon Jan 19, 2026 3:34 pm
by csk
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

Re: Induced density

Posted: Mon Jan 19, 2026 3:43 pm
by Daniele Varsano
Dear Christian,

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

Best,

Daniele

Re: Induced density

Posted: Thu Jan 22, 2026 10:10 pm
by Davide Sangalli
Can you attach also the log and the report of the run?

Re: Induced density

Posted: Fri Jan 23, 2026 12:52 pm
by csk
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

Re: Induced density

Posted: Fri Jan 23, 2026 2:00 pm
by Davide Sangalli
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