TD-aGW shg oscillation

Description of your first forum.
Post Reply
Sunxl
Posts: 12
Joined: Mon Dec 29, 2025 2:59 am
Location: China

TD-aGW shg oscillation

Post by Sunxl »

Dear developers,

I calculated the shg components xxx and yxx of TD-aGW according to this tutorialhttps://www.lumen-code.org/wiki/index.php?title ... or_TD-BSE). Finally, I obtained a shg spectrum with intense oscillations. Did I make a mistake in any of my settings? The attachment contains all my input and output files.

Best,
sunxl
Attachments
shg.zip
(131.03 KiB) Downloaded 909 times
Dr. sunxl
Beijing Computing Science Research Center, China.
Davide
Posts: 22
Joined: Mon Dec 29, 2025 8:50 am

Re: TD-aGW shg oscillation

Post by Davide »

Dear sunxl,
I'm not sure what you are asking.

You followed the tutorial, and you got results for X2_yyy in hBN monolayer different from the ones reported in the wiki ?

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
Sunxl
Posts: 12
Joined: Mon Dec 29, 2025 2:59 am
Location: China

Re: TD-aGW shg oscillation

Post by Sunxl »

Dear Davide,

Sorry, perhaps I didn't express myself clearly. My problem is that after I calculated the yxx and xxx components of SHG according to the tutorial, when I squared the real and imaginary parts and then took the modulus value, the resulting spectral line oscillated wildly, as shown in the following figure.
shg.png
shg.png (53.6 KiB) Viewed 27302 times
Best,
sunxl
Dr. sunxl
Beijing Computing Science Research Center, China.
User avatar
claudio
Posts: 25
Joined: Sat Oct 25, 2025 11:27 am

Re: TD-aGW shg oscillation

Post by claudio »

Dear sunxl

your input seems correct to me, please try to:

1) use the last version of Lumen 2.1

2) use YamboPy to postprocess the results

and let us know if the problem is still present

best
Claudio
Claudio Attaccalite
[CNRS/ Aix-Marseille Université/ CINaM laborarory / TSN department
Campus de Luminy – Case 913
13288 MARSEILLE Cedex 09
web site: http://www.attaccalite.com
User avatar
claudio
Posts: 25
Joined: Sat Oct 25, 2025 11:27 am

Re: TD-aGW shg oscillation

Post by claudio »

Dear sunxl

I run all the tutorial again with the bug-fixes version of Lumen
and it worked for me.
I fixed a couple of typos in the wiki, let know if it is clearer now

best
Claudio
Claudio Attaccalite
[CNRS/ Aix-Marseille Université/ CINaM laborarory / TSN department
Campus de Luminy – Case 913
13288 MARSEILLE Cedex 09
web site: http://www.attaccalite.com
User avatar
claudio
Posts: 25
Joined: Sat Oct 25, 2025 11:27 am

Re: TD-aGW shg oscillation

Post by claudio »

Dear sunxl

we fixed a bug in the lumen and now should work.
Please download the last bug-fixes version here:

https://gitlab.com/lumen-code/lumen/-/a ... type=heads

then let me give you some advise:

1) first of all try before to calculate the independent particle spectrum and see if works

2) second use parallizzation on frequencies is super efficent, I mean in the non-linear response input add
parallelization variables, for example if you have 8 core you can set

NL_CPU= "8 1" # [PARALLEL] CPUs for each role
NL_ROLEs= "w k" # [PARALLEL] CPUs roles (w,k)

NLEnSteps= 80 # [NL] Energy steps for the loop on frequencies

Where "w" is parallelization on frequencies and "k" on k-points.
The best combination if that the number of cores you use in frequencies to be a divisor of NLEnSteps.

Let us know
best
Claudio
Claudio Attaccalite
[CNRS/ Aix-Marseille Université/ CINaM laborarory / TSN department
Campus de Luminy – Case 913
13288 MARSEILLE Cedex 09
web site: http://www.attaccalite.com
Sunxl
Posts: 12
Joined: Mon Dec 29, 2025 2:59 am
Location: China

Re: TD-aGW shg oscillation

Post by Sunxl »

Dear Claudio,

Thank you for your response. I will test the fix version of Lumen and inform you of the results after the test. I have another question. For systems that are non-magnetic and do not contain SOC, was the original Lumen 2.1 version correct?

Best,
sunxl
Dr. sunxl
Beijing Computing Science Research Center, China.
Davide
Posts: 22
Joined: Mon Dec 29, 2025 8:50 am

Re: TD-aGW shg oscillation

Post by Davide »

Dear sunxl,
the issue should affect both systems with SOC and magnetic systems without SOC.

In short, the code was defining in a non correct way the dephasing. From the dephasing, the optimal time propagating window is defined. Unfortunately, there was a factor 2 (which is related to occupations), and which was correct only for the case of non-magnetic materials without SOC.

As a result, the final spectrum was done with a too short time propagation, leading to oscillations in the signal, as the one you experience. The fix is rather simple. We will soon release an updated patch of 2.1.0 including it.

Check here the needed changes in NL_damping: https://gitlab.com/lumen-code/lumen/-/c ... ff512a94a5

For the case of magnetic systems without SOC, there was also another fix. See changes in NL_build_dG_lesser here: https://gitlab.com/lumen-code/lumen/-/c ... 216f38b9d0

Best,
D

P.S.: please Claudio correct me if needed
Davide Sangalli, PhD
Piazza Leonardo Da Vinci, 32, 20133 – Milano
CNR, Istituto di Struttura della Materia (ISM)
https://sites.google.com/view/davidesangalli
Sunxl
Posts: 12
Joined: Mon Dec 29, 2025 2:59 am
Location: China

Re: TD-aGW shg oscillation

Post by Sunxl »

Dear Davide,

In my calculation, the NLtime I used was the default time. The time was very short, causing oscillations. Therefore, I manually set NLtime to 100fs, and in the post-processing, I selected the time period after the signal became stable, such as 60fs later. From then on, this oscillation problem no longer occurred. However, I encountered a new problem in my calculation. The obtained spectrum oscillates positively and negatively between adjacent frequency points. Moreover, for the magnetic systems containing soc, some results are normal while others are incorrect. This has left me very confused and frustrated. The problem description can be found in another post.viewtopic.php?p=117#p117

Best,
sunxl
Dr. sunxl
Beijing Computing Science Research Center, China.
Post Reply