Hello!
I'm interested on the optical matrix elements and I've read here on the forum that is possible to extract this info from the dipoles database. I'm trying to do that using a script provided by Claudio in another post here on the forum but so far its not working(script1.py) so I suppose I must be using it wrong, just executing it as "python3 script1.py" is giving me the following error:
print "Dipole element <n{0:}|{3:}|n{1:}> at k{2:}: {4:}, module: {5:}".format(args.B1,args.B2,args.K,args.xyz,Dipole,abs(Dipole))
^
SyntaxError: invalid syntax
Also I tried using another script provided by Daniele and also no luck(script2.py), for this one I changed the "path" as instructed by I'm receiving the following error:
Traceback (most recent call last):
File "script.py", line 20, in <module>
dip_file = Dataset(path+"ndb.dipoles_fragment_1","r")
File "netCDF4/_netCDF4.pyx", line 2015, in netCDF4._netCDF4.Dataset.__init__
File "netCDF4/_netCDF4.pyx", line 1636, in netCDF4._netCDF4._ensure_nc_success
FileNotFoundError: [Errno 2] No such file or directory: b'/ccc/scratch/cont003/gen7682/cuccobru/final/SAVE/ndb.dipoles_fragment_1'
And in fact I don't have fragments of the nbd.dipoles on the Save folder, just the ndb.dipoles file. Any solutions for any of the scripts are very welcome! Thank you. (I'm using the Yambo 5.0.0)
Regards,
Optical matrix elements
Moderators: andrea marini, Daniele Varsano, myrta gruning, Conor Hogan
-
- Posts: 48
- Joined: Tue Dec 08, 2020 11:16 am
Optical matrix elements
You do not have the required permissions to view the files attached to this post.
MSc. Bruno Cucco
PhD Candidate
CNRS Institut des Sciences Chimiques de Rennes, France
Université de Rennes 1
https://iscr.univ-rennes1.fr
PhD Candidate
CNRS Institut des Sciences Chimiques de Rennes, France
Université de Rennes 1
https://iscr.univ-rennes1.fr
- palful
- Posts: 10
- Joined: Tue Jan 26, 2016 11:23 am
- Location: Rome and Milan
Re: Optical matrix elements
Ciao Bruno,
You can actually read the optical matrix elements ("dipoles") using yambopy, the python suite to manage advanced pre/postprocessing of yambo.
Below an example (also attached), followed by some explanation.
In order to read the dipoles your python script will be like (commented version attached):
First we import yambopy, then read the general lattice information (such as kpoint coordinates and symmetries) with YamboLatticeDB, for which you only need the ns.db1 file inside the yambo SAVE folder.
After that, we instance the class YamboDipolesDB where the argument 'save' is the path to the databases and 'filename' the database name.
Now, the numpy array contains the dipole values. Its axes are as follows: [ kpoint in full Brillouin zone, cartesian direction, band 1, band 2 ]. Keep in mind that since the indexing starts from 0, ydip.dipoles[0,2,4,3] in the example contains the values at Gamma, with component along the z-axis, between the third and second bands of the system.
Using yambopy
- Follow the installation instructions here: http://www.yambo-code.org/wiki/index.ph ... in_Yambopy.
- If you have questions or run into problems, you can post about it in this subtopic on the yambo forum: viewforum.php?f=35
Let us know if it worked!
Hope this helps,
Fulvio
You can actually read the optical matrix elements ("dipoles") using yambopy, the python suite to manage advanced pre/postprocessing of yambo.
Below an example (also attached), followed by some explanation.
In order to read the dipoles your python script will be like (commented version attached):
Code: Select all
from yambopy import *
ylat = YamboLatticeDB.from_db(filename='./SAVE/ns.db1')
ydip = YamboDipolesDB(ylat,save='./dbs',filename='./ndb.dipoles')
print(ydip.dipoles[0,2,4,3])
print(ydip.dipoles[0,2,3,4])
After that, we instance the class YamboDipolesDB where the argument 'save' is the path to the databases and 'filename' the database name.
Now, the numpy array
Code: Select all
ydip.dipoles
Using yambopy
- Follow the installation instructions here: http://www.yambo-code.org/wiki/index.ph ... in_Yambopy.
- If you have questions or run into problems, you can post about it in this subtopic on the yambo forum: viewforum.php?f=35
Let us know if it worked!
Hope this helps,
Fulvio
You do not have the required permissions to view the files attached to this post.
Fulvio Paleari
Istituto di Struttura della Materia (CNR)
Area della Ricerca Roma 1
Istituto di Struttura della Materia (CNR)
Area della Ricerca Roma 1
-
- Posts: 48
- Joined: Tue Dec 08, 2020 11:16 am
Re: Optical matrix elements
Hello!
I think thats indeed what I'm looking for! Can you tell me what are the output units?
Regards,
I think thats indeed what I'm looking for! Can you tell me what are the output units?
Regards,
MSc. Bruno Cucco
PhD Candidate
CNRS Institut des Sciences Chimiques de Rennes, France
Université de Rennes 1
https://iscr.univ-rennes1.fr
PhD Candidate
CNRS Institut des Sciences Chimiques de Rennes, France
Université de Rennes 1
https://iscr.univ-rennes1.fr
- palful
- Posts: 10
- Joined: Tue Jan 26, 2016 11:23 am
- Location: Rome and Milan
Re: Optical matrix elements
Hi,
The quantity saved in ndb.dipoles should be: i*R_nmk = i*<n k| r | m k> , with R_nmk in atomic units of length (bohr).
Fulvio
The quantity saved in ndb.dipoles should be: i*R_nmk = i*<n k| r | m k> , with R_nmk in atomic units of length (bohr).
Fulvio
Fulvio Paleari
Istituto di Struttura della Materia (CNR)
Area della Ricerca Roma 1
Istituto di Struttura della Materia (CNR)
Area della Ricerca Roma 1