Optical matrix elements
Moderators: Davide Sangalli, andrea.ferretti, myrta gruning, andrea marini, Daniele Varsano, Conor Hogan
- amolina
- Posts: 135
- Joined: Fri Jul 15, 2011 11:23 am
- Location: Valencia, Spain
- Contact:
Optical matrix elements
Hi everybody,
I would like to know if we can get the optical matrix elements, <j|ep|i>, calculated (internally, I guess) by Yambo to obtain the dielectric function, where |j> is the unoccuppied state, |i> the occuppied state, and e the polarization of the electric field.
Thanks,
Alejandro.
I would like to know if we can get the optical matrix elements, <j|ep|i>, calculated (internally, I guess) by Yambo to obtain the dielectric function, where |j> is the unoccuppied state, |i> the occuppied state, and e the polarization of the electric field.
Thanks,
Alejandro.
Alejandro Molina-Sánchez
Institute of Materials Science (ICMUV)
University of Valencia, Spain
Institute of Materials Science (ICMUV)
University of Valencia, Spain
- claudio
- Posts: 528
- Joined: Tue Mar 31, 2009 11:33 pm
- Location: Marseille
- Contact:
Re: Optical matrix elements
Dear Alejandro
the optical matrix elements <i | p | j> and < i | r | j > are calculated in the subroutine
src/pol_function/Dipole_transverse.F
check the comments in the subroutine.
Notice that yambo does not recalculate the dipoles matrix elements every time,
if you want to force it to recalculate them remove the dipole database
SAVE/ndb.dipoles or SAVE/db.dipoles
best regards
Claudio
PS
inside the code everything is in atomic units, also the dipoles
the optical matrix elements <i | p | j> and < i | r | j > are calculated in the subroutine
src/pol_function/Dipole_transverse.F
check the comments in the subroutine.
Notice that yambo does not recalculate the dipoles matrix elements every time,
if you want to force it to recalculate them remove the dipole database
SAVE/ndb.dipoles or SAVE/db.dipoles
best regards
Claudio
PS

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
[CNRS/ Aix-Marseille Université/ CINaM laborarory / TSN department
Campus de Luminy – Case 913
13288 MARSEILLE Cedex 09
web site: http://www.attaccalite.com
- amolina
- Posts: 135
- Joined: Fri Jul 15, 2011 11:23 am
- Location: Valencia, Spain
- Contact:
Re: Optical matrix elements
Dear Claudio,
I have read the subroutine. It prints the dipole matrix elements or I need to modify the code to write them?
Regards,
Alejandro.
I have read the subroutine. It prints the dipole matrix elements or I need to modify the code to write them?
Regards,
Alejandro.
Alejandro Molina-Sánchez
Institute of Materials Science (ICMUV)
University of Valencia, Spain
Institute of Materials Science (ICMUV)
University of Valencia, Spain
- claudio
- Posts: 528
- Joined: Tue Mar 31, 2009 11:33 pm
- Location: Marseille
- Contact:
Re: Optical matrix elements
Dear Alejandro
the subroutine just calculated the dipoles, in order to read them
you can add a line like this in the subroutine
write(100,'(3i4,6f16.8)') iv,ic,ik,rho(1:3)
and write them on a text file,
or you can use the python script in attachment (you need to compile yambo with netcdf)
Cla
the subroutine just calculated the dipoles, in order to read them
you can add a line like this in the subroutine
write(100,'(3i4,6f16.8)') iv,ic,ik,rho(1:3)
and write them on a text file,
or you can use the python script in attachment (you need to compile yambo with netcdf)
Cla
You do not have the required permissions to view the files attached to this post.
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
[CNRS/ Aix-Marseille Université/ CINaM laborarory / TSN department
Campus de Luminy – Case 913
13288 MARSEILLE Cedex 09
web site: http://www.attaccalite.com
-
- Posts: 26
- Joined: Thu Apr 18, 2013 4:50 pm
Re: Optical matrix elements
Dear Claudio,
Thanks,
Longhua
I have tested your suggestion. It can work under serial calculation, but it failed under parallel calculations. it seems every cpu open and write this file. It is not easy to use the "of_close_open" and "msg" subroutine to handle a file. How can I write out this file use only one cpu in parallel model?claudio wrote:Dear Alejandro
the subroutine just calculated the dipoles, in order to read them
you can add a line like this in the subroutine
write(100,'(3i4,6f16.8)') iv,ic,ik,rho(1:3)
Thanks,
Longhua
arlonne
Department of Physics and Astronomy
Northwestern University, IL 60208
Department of Physics and Astronomy
Northwestern University, IL 60208
- claudio
- Posts: 528
- Joined: Tue Mar 31, 2009 11:33 pm
- Location: Marseille
- Contact:
Re: Optical matrix elements
Dear Longhua
when you run yambo in parallel each processor calculate only a part of the dipoles,
then at the end of the subroutine you will find an instruction
call PP_redux_wait(DIP_iR(:,:,:,ik,i_spin))
can redistribute all the dipole among the different preocessors.
After this instruction you can make one processor writes all of them doing:
load the preocessor number
make the preocessor number 0 writes all the dipoles
anyway I advise you to use the python script and read the dipole database at the end of the run:
http://www.yambo-code.org/doc/scripts.php
regards
Claudio
when you run yambo in parallel each processor calculate only a part of the dipoles,
then at the end of the subroutine you will find an instruction
call PP_redux_wait(DIP_iR(:,:,:,ik,i_spin))
can redistribute all the dipole among the different preocessors.
After this instruction you can make one processor writes all of them doing:
load the preocessor number
Code: Select all
use parallel_m, ONLY : myid
Code: Select all
if (myid==0) then
do i_spin=1,n_spin
do ik=1,Xk%nibz
do ic=ic_min,X%ib(2)
do iv=X%ib(1),iv_max
write(100,'(3i4,6f16.8)') iv,ic,ik,DIP_iR(:,iv,ic,ik,i_spin)
enddo
enddo
enddo
enddo
endif
http://www.yambo-code.org/doc/scripts.php
regards
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
[CNRS/ Aix-Marseille Université/ CINaM laborarory / TSN department
Campus de Luminy – Case 913
13288 MARSEILLE Cedex 09
web site: http://www.attaccalite.com
-
- Posts: 26
- Joined: Thu Apr 18, 2013 4:50 pm
Re: Optical matrix elements
Dear Claudio,
Thanks for your reply. I, actually, tried this method before. it didn't work. This is what I am confusing.
May be I should use the python script.
Best,
Longhua
Thanks for your reply. I, actually, tried this method before. it didn't work. This is what I am confusing.
May be I should use the python script.
Best,
Longhua
arlonne
Department of Physics and Astronomy
Northwestern University, IL 60208
Department of Physics and Astronomy
Northwestern University, IL 60208
-
- Posts: 23
- Joined: Mon Aug 17, 2015 5:56 am
Re: Optical matrix elements
Hello Claudio,
I have a question regarding the extraction of the oscillators matrix elements.
I tried to use the script provided in "http://www.yambo-code.org/doc/scripts.p ... dipoles.py" to read the dipole elements, however, it asks for "ndb.dipoles" which I do not have among my outputs.
Currently, I am using Yambo 4.1.3 version. Are "ndb.dip_iR_and_P" files the same as "ndb.dipoles" file. Could you please help me find out how to save the oscillators matrix elements as txt file.
Zahra Taghipour
Researcher
The Ohio State University
I have a question regarding the extraction of the oscillators matrix elements.
I tried to use the script provided in "http://www.yambo-code.org/doc/scripts.p ... dipoles.py" to read the dipole elements, however, it asks for "ndb.dipoles" which I do not have among my outputs.
Currently, I am using Yambo 4.1.3 version. Are "ndb.dip_iR_and_P" files the same as "ndb.dipoles" file. Could you please help me find out how to save the oscillators matrix elements as txt file.
Zahra Taghipour
Researcher
The Ohio State University
- Daniele Varsano
- Posts: 4209
- Joined: Tue Mar 17, 2009 2:23 pm
- Contact:
Re: Optical matrix elements
Dear Zahar,
I strongly advise you to switch to a more recent release of Yambo, you are using a quite old version and many things chanced since then, and also many bugs have been fixed.
a) "ndb.dip_iR_and_P, yes they contains the dipoles.
b) probably you can use the yambo-py interface for reading the databases, but I'm not familiar with that, you may ask in the yambopy subforum.,
otherwise, you can just print the matrix elements when they are calculated (note that if they have been calculated once they are not recalculated).
You can use the piece of the code indicated in the post above by Claudio.
They are calculated in the subroutine Dipole_transverse, that is found in ./src/pol_function/DIPOLE_transverse.F and you can
add the writing lines in ./src/pol_function/DIPOLE_driver.F after the call:
Best,
Daniele
I strongly advise you to switch to a more recent release of Yambo, you are using a quite old version and many things chanced since then, and also many bugs have been fixed.
a) "ndb.dip_iR_and_P, yes they contains the dipoles.
b) probably you can use the yambo-py interface for reading the databases, but I'm not familiar with that, you may ask in the yambopy subforum.,
otherwise, you can just print the matrix elements when they are calculated (note that if they have been calculated once they are not recalculated).
You can use the piece of the code indicated in the post above by Claudio.
They are calculated in the subroutine Dipole_transverse, that is found in ./src/pol_function/DIPOLE_transverse.F and you can
add the writing lines in ./src/pol_function/DIPOLE_driver.F after the call:
Code: Select all
call DIPOLES_ppredux_and_symmetrize()
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/
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/
-
- Posts: 23
- Joined: Mon Aug 17, 2015 5:56 am
Re: Optical matrix elements
Dear Daniele,
Thank you for your recommendation. Unfortunately, this version was the only version I could install and run without the problem.
I still do not understand why the code does not output "ndb.dipoles"!
I added the following lines in ./src/pol_function/DIPOLE_driver.F after the call
open(unit=1,file="dipoles_out")
write(100,'(3i4,6f16.8)') iv,ic,ik,rho(1:3)
close(1)
But, the code does not write the matrix elements. I wonder what am I missing?
I should mention I tried the above code without line #1 and #3, as well, with no difference.
In the meanwhile, I will look into Yambopy to see if they have this included in their code to extract the dipole matrix.
Thanks, and Regards
Zahra T.
Thank you for your recommendation. Unfortunately, this version was the only version I could install and run without the problem.
I still do not understand why the code does not output "ndb.dipoles"!
I added the following lines in ./src/pol_function/DIPOLE_driver.F after the call
open(unit=1,file="dipoles_out")
write(100,'(3i4,6f16.8)') iv,ic,ik,rho(1:3)
close(1)
But, the code does not write the matrix elements. I wonder what am I missing?
I should mention I tried the above code without line #1 and #3, as well, with no difference.
In the meanwhile, I will look into Yambopy to see if they have this included in their code to extract the dipole matrix.
Thanks, and Regards
Zahra T.