Yambopy tutorial: electron-phonon coupling: Difference between revisions

From The Yambo Project
Jump to navigation Jump to search
No edit summary
No edit summary
Line 26: Line 26:
* Electron-phonon matrix elements (Yambo databases: <code>ndb.elph_gkkp*</code>, Yambopy class: <code>YamboElectronPhononDB</code>).
* Electron-phonon matrix elements (Yambo databases: <code>ndb.elph_gkkp*</code>, Yambopy class: <code>YamboElectronPhononDB</code>).


=== Loading electron-phonon matrix elements: LetzElPhC ===
=== Electron-phonon intro: plots of el-ph matrix elements on k-BZ and q-BZ ===
 


=== Loading electron-phonon matrix elements: Yambo ===
=== Loading electron-phonon matrix elements: Yambo ===
Line 52: Line 53:
This should generate a yambo SAVE folder which contains the <code>ndb.elph_gkkp_expanded*</code> databases.
This should generate a yambo SAVE folder which contains the <code>ndb.elph_gkkp_expanded*</code> databases.


=== Electron-phonon intro: plots of el-ph matrix elements on k-BZ and q-BZ ===
=== Electron-phonon intro old: plots of el-ph matrix elements on k-BZ and q-BZ ===
In this section we will use the script <code>elph_plot.py</code> and read the electron-phonon databases that you generated in the previous section.
In this section we will use the script <code>elph_plot.py</code> and read the electron-phonon databases that you generated in the previous section.



Revision as of 09:56, 10 March 2026

In this tutorial we will cover the handling of electron-phonon coupling matrix elements by Yambopy. The electron-phonon calculation follows two steps:

  1. Quantum Espresso calculation of phonon energies, eigenmodes and variations of the self-consistent potential via ph.x.
  2. Electron-phonon matrix element calculation, symmetry expansion and conversion by the LetzElPhC.

For more information on the LetzElPhC code and how you should run step 1., please see the related documentation here.

We can use Yambopy to:

  • Run LetzElPhC (both preprocessing and main run) without explicitly writing an input file.
  • Convert the resulting databases into Yambo format.
  • Analyse the electron-phonon coupling both in LetzElPhC or Yambo format.

The scripts of the tutorial, but not the databases, can be found in the yambopy directory:

$cd tutorial/electron_phonon

The full tutorial, including the LetzElPhC and Yambo databases that we will read, can be downloaded and extracted from the yambo website:

$wget https://media.yambo-code.eu/educational/tutorials/files/electron_phonon.tar.gz
$tar -xvzf electron_phonon.tar.gz
$cd electron_phonon

We will work with monolayer molybdenum disulfide electron-phonon data obtained on a 6x6x1 kpoint grid. Beware that these are most certainly not converged.

Command line: electron-phonon calculation and databases

Note: you can run this step only if you have compiled LetzElPhC on your machine. If not, please skip to the following sections of the tutorial, as the electron-phonon coupling databases are already provided in the .tar.gz file.

  • Electron-phonon matrix elements (Yambo databases: ndb.elph_gkkp*, Yambopy class: YamboElectronPhononDB).

Electron-phonon intro: plots of el-ph matrix elements on k-BZ and q-BZ

Loading electron-phonon matrix elements: Yambo

You may have seen how to calculate and import electron-phonon matrix elements in yambo in the electron-phonon tutorial.

With Yambopy, we can generate a yambo SAVE folder and import the matrix elements with a single command. Typing

$yambopy gkkp

will print the necessary documentation:

Produce a SAVE folder including elph_gkkp databases

Arguments are:
  -nscf, --nscf_dir  -> <Optional> Path to nscf save folder
  -elph, --elph_dir  -> Path to elph_dir folder
  -y, --yambo_dir    -> <Optional> Path to yambo executables
  -e, --expand       -> <Optional> Expand gkkp databases

The necessary quantum espresso databases are stored in ELPH_SAVES/QE_SAVES/hBN.save (nscf calculation) and ELPH_SAVES/QE_SAVES/elph_dir (matrix elements from the dfpt calculation). For this tutorial we also need to expand the electron-phonon matrix elements to the full Brillouin zone. Since this is a different calculation with respect to the previous section, please generate this SAVE in a different directory than the one you used for the previous SAVE, which should be the current directory. For example:

$mkdir yambo-with-elph
$cd yambo-with-elph

Now we can run yambopy as in the instructions:

$yambopy gkkp -nscf ../ELPH_saves/QE_saves/hBN.save -elph ../ELPH_saves/QE_saves/elph_dir --expand

This should generate a yambo SAVE folder which contains the ndb.elph_gkkp_expanded* databases.

Electron-phonon intro old: plots of el-ph matrix elements on k-BZ and q-BZ

In this section we will use the script elph_plot.py and read the electron-phonon databases that you generated in the previous section.

In order to read the ndb.elph_gkkp_expanded* databases in python we use the Yambopy class YamboElectronPhononDB, which can be instanced like this:

yelph = YamboElectronPhononDB(ylat,folder_gkkp='path/to/elph/folder',save='path/to/SAVE')

(notice that it requires a previous instance of YamboLatticeDB).

Now, the yelph object contains phonon frequencies, phonon eigenvectors, qpoint information and, of course, the electron-phonon matrix elements g_{nm\nu}(k,q) where n, m are electron band states, \nu is a phonon branch, and k and q are the electronic and transfer momenta.

We can print the docstring of the YamboElectronPhononDB class with

print(yelph.__doc__)

to get an idea of the information stored and of its capabilities.

Now check the elph_plot.py script. You will see that it performs two plots:

  • Plot of |g(k)| in the k-BZ for selected n,m,\nu and q [Kspace_Plot=True].
  • Plot of |g(q)| in the q-BZ for selected n,m,\nu and k [Qspace_Plot=True].

You can change the electronic, phononic and momentum indices to see what happens.

YamboElectronPhononDB plot from yambopy tutorial