how to implement a new TDDFT kernel

Run-time issues concerning Yambo that are not covered in the above forums.

Moderators: myrta gruning, andrea marini, Daniele Varsano, Conor Hogan

hongtang2023
Posts: 45
Joined: Thu Mar 16, 2023 7:02 am

how to implement a new TDDFT kernel

Post by hongtang2023 » Thu Mar 16, 2023 7:32 am

Dear yambo masters,

I am kind of new to the Yambo code. However, we want to use Yambo to do TDDFT calculations.
We also want to implement a new TDDFT kernel to the code and test it.

I just found that the tddft_alda_g_space.F file in the new version 5.1.1 yambo is very different from the one in the old version (like 3.4.1 some thing).

Please let me know which file or subroutine I should look and put our kernel in.

Appreciate your help very much!


Best,
Hong
Dr. Hong Tang
Tulane University
New Orleans, LA
70118, USA

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

Re: how to implement a new TDDFT kernel

Post by Daniele Varsano » Thu Mar 16, 2023 10:27 am

Dear Hong,
please sign your post with your full name and affiliation, this is a rule of the forum!
You can fill your signature once for all in your user profile.

About implementing new TDDFT kernel, it depends on if you need to insert it in configuration space (Casida-like), or in Dyson like form:
e.g. X=Xo+Xo(v+fxc)X

Also, it makes difference if the kernel you want to code is supported by the libxc library.

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/

hongtang2023
Posts: 45
Joined: Thu Mar 16, 2023 7:02 am

Re: how to implement a new TDDFT kernel

Post by hongtang2023 » Thu Mar 16, 2023 8:28 pm

Dear Daniele,

Thank you so much for helping!
I did the signature thing.

I am not sure Casida-like, or Dyson like. I hope we do both.
However, the first step is to do Dyson like, I think. The thing is that we need non-collinear SOC enabled. I think the Yambo_5.1.1 can do this. We will use quantum ESPRESSO to do the DFT calculation. I think QE supports libxc libs.

Could you please inform me how to process for the implementation?
Many thanks!

Best,
Hong
Dr. Hong Tang
Tulane University
New Orleans, LA
70118, USA

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

Re: how to implement a new TDDFT kernel

Post by Daniele Varsano » Fri Mar 17, 2023 2:19 pm

Dear Hong,

1. Yes, yambo support non-collinear spin
2. About libxc, regardless of how QE deal with the Vxc, what kind of Fxc you aim to implement?

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/

hongtang2023
Posts: 45
Joined: Thu Mar 16, 2023 7:02 am

Re: how to implement a new TDDFT kernel

Post by hongtang2023 » Sat Mar 18, 2023 1:20 am

Dear Daniele,

Thank you so much for helping!

Regarding the TDDFT kernel, we are doing MCP07 ( PHYSICAL REVIEW B 101, 245135 (2020) ).
Although our previous group member did the implementation in old version_3.4.2, it is not good for SOC, so we need to implement it into the newest version_5.1.1 of Yambo. But I found that the tddft_alda_g_space.F file in the new version 5.1.1 yambo is very different from the one in the old version_3.4.2.

Please advise the keys for the implementation.

Best,
Hong
Dr. Hong Tang
Tulane University
New Orleans, LA
70118, USA

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

Re: how to implement a new TDDFT kernel

Post by Daniele Varsano » Mon Mar 20, 2023 10:18 am

Dear Hong,

the LDA fxc subroutine in 3.4 and 5.1 are very similar, what has changed is just the allocation procedure and some renaming of variable, but they do the same stuff.
If I correctly understand, the MCP07 xc kernel is not present in the libxc library and the paper you indicate provides a parametrization, so you can implement it in a new subroutine.
The density is calculated in:
./src/xc_functionals/el_density_and_current.F

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/

hongtang2023
Posts: 45
Joined: Thu Mar 16, 2023 7:02 am

Re: how to implement a new TDDFT kernel

Post by hongtang2023 » Fri Mar 24, 2023 3:48 am

Dear Daniele,

Thank you so much for helping!

I have questions need your helps.

1. About how Yambo know the pseudopotentials that used in the quantum espresso calculations. Does Yambo know this when Yambo converts the wavefunction files from QE to Yambo or during the Yambo initialization step?

2. Usually, when we use QE for DFT calculations, the energy XC functional is determined by the pseudopotentials we used, for example, if we use ONCVPSP (Optimized Norm-Conservinng Vanderbilt PSeudopotential) fully-relativistic version PPs, does yambo extract this information automatically and correctly?

3. If the answer for the above 2. is yes, then if we call TDDFT_ALDA_G_space, and the following XC_potential_driver, XC_libxc_driver, etc. we can get the correct spin density spin_rho_DP, and other quantities: v1rho, v2rho2, magn for the noncollinear SOC case. right?

4. Does yambo not care how the thing in the SAVE folder is calculated? I mean yambo only need the wavefunctions from DFT calculations, right? Then in TDDFT calculation in yambo, yambo just recalculates the electron density, its gradient, and then, the tddft kernel fxc. Is this correct?

I appreciate your help very much.

Best
Hong
Dr. Hong Tang
Tulane University
New Orleans, LA
70118, USA

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

Re: how to implement a new TDDFT kernel

Post by Daniele Varsano » Wed Mar 29, 2023 7:17 am

Dear Hong,

1. Yes, when running p2y yambo stores in the SAVE directory wfs and pseudo info (ns.kb_pp). The psp info is then used to evaluate dipole elements which contain the commutator of the non-local part of the psp
i <v|r|c>= i <v|i p|c>/(Ec-Ev) + i<v|[x,Vnl]|c>/(Ec-Ev) see DIPOLE_transverse.F.
2. Yes, the xc kind and spin info are also reported in any report file (e.g. r_setup).
3. Yes
4. Yes

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/

hongtang2023
Posts: 45
Joined: Thu Mar 16, 2023 7:02 am

Re: how to implement a new TDDFT kernel

Post by hongtang2023 » Wed Mar 29, 2023 8:43 pm

Dear Daniele,

Thanks so much!

I did a coding to try to write our old implementation of Yambo3.4.2 into the newer Yambo5.1.1. However, I got errors when I compile the code in NERSC cluster. Please see the detailed full screen running messages that I got when doing the compilation, see the attched file "error_runing.txt". You can check there are some warnings and errors.

The main implementation is in file "tddft_alda_g_space.F " in src/tddft/ , I also changed somethings in files "mod_xc_functionals.F " in src/modules, " XC_libxc_driver.F " and " XC_potential_driver.F " in src/xc_functionals. Those are for the interfaces and call for calculations of spin electron density.

For file "error_runing.txt", it looks that the last three files seem ok since the compilation passed the src/modules and src/xc_functionals. However, it seems got wrong for file "tddft_alda_g_space.F ", as you can see in the end of the file "error_runing.txt". Is the error related to some modules or the differences between Yambo3.4.2 and the newer Yambo5.1.1? especially, is the p attribute in the variable wv (type w_samp) a pointer, as it is in yambo 3.4? We need it to get the value of the frequency at a frequency point.

Please help.

Best,
Hong
You do not have the required permissions to view the files attached to this post.
Dr. Hong Tang
Tulane University
New Orleans, LA
70118, USA

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

Re: how to implement a new TDDFT kernel

Post by Daniele Varsano » Thu Mar 30, 2023 9:59 am

Dear Hong,

Yambo3.4.2 is a very old version which is not maintained anymore, and sure there have been many changes since then.
It seems that the compilation is broken by offending IMPLICIT statements and rank mismatch of some arrays you may check and fix.

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/

Post Reply