Difference between revisions of "Tutorials:Wannier90"

From OctopusWiki
Jump to navigation Jump to search
 
Line 1: Line 1:
Starting from Octopus Selene (10.x), Octopus supports Wannier90 as an external library.
+
Starting from Octopus Selene (10.x), {{octopus}} provides an interface for Wannier90. In order to perform this tutorial, you need first to compile Wannier90. Detailed information can be found on the [http://www.wannier.org/ Wannier90 website].
In order to perfom this tutorial, you need to compile Wannier90 on you own. Detailled information can be found on [http://www.wannier.org/ Wannier90 website].
 
  
In this tutorial, we follow the second example of Wannier90, which consists in computing the Fermi surface of lead using Octopus + Wannier90.
+
In this tutorial, we follow the second example from the Wannier90 tutorials, which consists in computing the Fermi surface of lead. This requires several steps, which are explained in detail bellow.
  
  
== Input ==
+
== Ground-state ==
Here we start with the input file for Octopus. There is, at this moment, nothing special to specify in order to run Wannier90, and Octopus here does not need to know that Wannier90 will be called later.
 
  
 +
=== Input ===
 +
We start with the input file for {{octopus}}. At this point there is nothing special to specify as {{octopus}} does not need to know that Wannier90 will be called later.
  
 
  {{variable|CalculationMode|Calculation_Modes}} = gs
 
  {{variable|CalculationMode|Calculation_Modes}} = gs
Line 38: Line 38:
 
  {{variable|ExtraStates|States}} = 4
 
  {{variable|ExtraStates|States}} = 4
  
Most of these variables are already used in other tutorials, so the interested read could refer for instance to [[Tutorial:Periodic_systems]] for a detailed description.
+
The use of most of these variables is already explained in detail in other tutorials. See, for example, the [[Tutorial:Periodic_systems|Periodic Systems]] tutorial. Nevertheless, some options deserve a more detailed explanation:
As we are interesting in lead, which is a metal, we need to use a smearing of the occupations, in order to get a converged ground-state. For this, we use the variable {{variable|Smearing|States}}, which defines the effective temperature of the smearing function. This latter is chosen here to be the Fermi-Dirac distribution (<tt>{{variable|SmearingFunction|States}} = fermi_dirac</tt>).
+
* <tt>{{variable|SmearingFunction|States}} = fermi_dirac</tt>: as we are interested in lead, which is a metal, we need to use a smearing of the occupations in order to get a converged ground-state. Here we have chosen the smearing function to be a Fermi-Dirac distribution.
 +
* <tt>{{variable|Smearing|States}} = 0.1*eV</tt>: this defines the effective temperature of the smearing function.
 +
* <tt>{{variable|PseudopotentialSet|System::Species}} = hgh_lda</tt>: since lead is not provided with the default pseudopotential set, we must select one containing Pb. We thus use the LDA HGH pseudopotential set here.
  
Note that lead is not provided with the default pseudopotentials, so we must select here a pseudopotential containing Pb. We used here the LDA HGH pseudopotentials (<tt>{{variable|PseudopotentialSet|System::Species}} = hgh_lda</tt>).
+
It is also important to note that the ''k''-point symmetries cannot be used with Wannier90. Also, only Monkhorst-Pack grids are allowed, so that only one ''k''-point shift is allowed.
  
It is also important to note that the k-point symmetries cannot be used with Wannier90, and that only Monkhorst-Pack grids are allowed. Only one k-point shift is allowed.
+
=== Output ===
 +
Now run {{octopus}} using the above input file. The output should be similar to other ground-state calculations for periodic systems, so we are not going to look at it in detail. Nevertheless, to make sure there was no problem with the calculation and since we will need this information later, you should check the calculated Fermi energy. You can find this information in the {{file|static/info}} file:
 +
<pre>
 +
Fermi energy =    0.157425 H
 +
</pre>
  
== Output ==  
+
== Wannier90 ==
  
Now run {{octopus}} using the above input file. You should obtain, after running the code, a Fermi energy of 0.157425 H, see <tt>static/info</tt>.
+
The usage of Wannier90 as a post-processing tool requires several steps and several invocations of both Wannier90 and {{octopus}}. Note that all the interfacing between Wannier90 and {{octopus}} is done through a specialized utility called {{file|oct-wannier90}}.
  
== Using Wannier 90 ==
+
=== Step one: create the Wannier90 input file ===
  
In order to run Wannier90, you must prepare an input file for Wannier90. In order to do so, we provide a small utility that does the interface with Wannier90, called <tt>oct-wannier90</tt>.
+
In order to run Wannier90, you must prepare an input file for it. To make this task easier, the {{file|oct-wannier90}} utility can take the {{octopus}} input file and "translate" it for Wannier90. Here is how the input file for the utility should look like:
First, you need to add the line
 
  {{variable|Wannier90_Mode|Utilities::oct-wannier90}} = w90_setup
 
to your input file, and run <tt>oct-wannier90</tt>.
 
  
This will create a file <tt>w90.win</tt>, which is the skeleton of the input file for Wannier90.
+
{{variable|CalculationMode|Calculation_Modes}} = gs
As we are interested in lead, we will edit this file and replace the following lines
+
{{variable|PeriodicDimensions|System}} = 3
 +
 +
{{variable|Spacing|Mesh}} = 0.4
 +
 +
%{{variable|LatticeVectors|Mesh}}
 +
  0.0 | 0.5 | 0.5
 +
  0.5 | 0.0 | 0.5
 +
  0.5 | 0.5 | 0.0
 +
%
 +
 +
a = 9.3555
 +
%{{variable|LatticeParameters|Mesh}}
 +
  a | a | a
 +
%
 +
 +
{{variable|PseudopotentialSet|System::Species}} = hgh_lda
 +
%{{variable|ReducedCoordinates|System}}
 +
  "Pb" | 0.0 | 0.0 | 0.0
 +
%
 +
 +
%{{variable|KPointsGrid|Mesh}}
 +
  4 |  4 |  4
 +
%
 
   
 
   
  num_bands    6
+
  {{variable|Smearing|States}} = 0.1*eV
  num_wann    6
+
{{variable|SmearingFunction|States}} = fermi_dirac
  use_bloch_phases = .true.
+
  {{variable|ExtraStates|States}} = 4
 +
   
 +
{{variable|Wannier90Mode|Utilities::oct-wannier90}} = w90_setup
  
 +
This is basically the same input file as above with the following option added:
 +
* <tt>{{variable|Wannier90Mode|Utilities::oct-wannier90}} = w90_setup</tt>: this tells the {{file|oct-wannier90}} utility that we want to setup an input file for Wannier90 based on the contents of our input file.
 +
 +
Now run the the {{file|oct-wannier90}} utility. This will create a file named {{file|w90.win}} that should look like this:
 +
<pre>
 +
# this file has been created by the Octopus wannier90 utility
 +
 +
begin unit_cell_cart
 +
Ang
 +
  0.00000000  2.47535869  2.47535869
 +
  2.47535869  0.00000000  2.47535869
 +
  2.47535869  2.47535869  0.00000000
 +
end unit_cell_cart
 +
 +
begin atoms_frac
 +
Pb    0.00000000  0.00000000  0.00000000
 +
end atoms_frac
 +
 +
use_bloch_phases = .true.
 +
 +
num_bands    6
 +
num_wann    6
 +
 +
write_u_matrices = .true.
 +
translate_home_cell = .true.
 +
write_xyz = .true.
 +
 +
mp_grid    4  4  4
 +
 +
begin kpoints
 +
-0.00000000  -0.00000000  -0.00000000
 +
-0.25000000  -0.00000000  -0.00000000
 +
...
 +
</pre>
 +
 +
Before running Wannier90, we are going to slightly tweak this file. As we are interested in lead, we will replace the following lines:
 +
<pre>
 +
use_bloch_phases = .true.
 +
 +
num_bands    6
 +
num_wann    6
 +
</pre>
 
by
 
by
num_bands    6
+
<pre>
num_wann    4
+
num_bands    6
begin projections
+
num_wann    4
Pb:sp3
+
begin projections
end projections
+
Pb:sp3
 +
end projections
 +
</pre>
 +
By doing this, we are telling Wannier90 that we want to find 4 Wannier states out of the 6 bands contained in the DFT calculation. Moreover, we are using guess projections based on sp3 orbitals attached to the lead atom. More details about Wannier90, projections, and disentanglement can be found in the tutorials and manual of Wannier90.
  
By doing that, we are telling Wannier90 that we want to find 4 Wannier states, out of the 6 bands contained in the DFT calculation. Moreover, we are using guess projections based on sp3 orbitals attached to the lead atom. More details about Wannier90, projections and disentanglement can be found on the tutorials and manual of Wannier 90.
+
=== Step 2: generate the {{file|.nnkp}} file ===
  
After editing the file <tt>w90.win</tt>, you can run Wannier90 in preprocessing mode:
+
After editing the file {{file|w90.win}}, run Wannier90 in post-processing mode:
  wannier90.x -pp w90.win
+
{{command_line|wannier90.x -pp w90.win}}
  
This will produce the necessary <tt>w90.nnkp</tt> file, that tells Octopus how to compute the projections Wannier90 needs to proceed with the Wannierization.
+
This will produce a file named {{file|w90.nnkp}}. This file contains information telling {{octopus}} what further information does Wannier90 require for the following steps.
  
At this state, you need to change the Wannier90_mode variable in you input file to be
+
=== Step 3: generate files for Wannier90 ===
{{variable|Wannier90_Mode|Utilities::oct-wannier90}} = w90_output
 
Then, you can run the <tt>oct-wannier90</tt> utility again, and this time, it will produces the files <tt>w90.eig</tt>, <tt>w90.mmn</tt>, and <tt>w90.amn</tt>.
 
  
Finally, you can call Wannier90 to perform the wannierization
+
At this stage, we are going to tell {{octopus}} to generate some files for Wannier90 using the information from the {{file|w90.nnkp}} file. To do so, we change the value of the {{variable|Wannier90Mode|Utilities::oct-wannier90}} variable in the above {{octopus}} input file to:
  wannier90.x w90.win
+
{{variable|Wannier90Mode|Utilities::oct-wannier90}} = w90_output
 +
Then, run the {{file|oct-wannier90}} utility again. This time the utility will produces the files {{file|w90.eig}}, {{file|w90.mmn}}, and {{file|w90.amn}}. The variable that controls which files are produced is {{variable|Wannier90Files|Utilities::oct-wannier90}}.
 +
 
 +
=== Step 4: run Wannier90 ===
 +
 
 +
Finally, you call Wannier90 to perform the Wannierization:
 +
{{command_line|wannier90.x w90.win}}
  
 
== Computing the Fermi surface ==
 
== Computing the Fermi surface ==
  
Once you performed all the previous steps, you know how to run Wannier90 on top of an Octopus calculation.
+
[[Image:FS_Lead_band2_band3.png|thumb|420px|Fermi surface for bands 2 and 3 in lead.]]
In order to compute the interpolated Fermi surface, we can add to the <tt>w90.win</tt> file the following lines
 
restart = plot
 
fermi_energy = 4.283754645
 
fermi_surface_plot = true
 
The value of the Fermi energy corresponds to the one of Octopus, converged in eV.
 
  
By calling again Wannier90, you will obtain a file <tt>w90.bxsf</tt>, which you can plot using for instance xcrysden
+
Once you performed all the previous steps, you know how to run Wannier90 on top of an {{octopus}} calculation.
xcrysden --bxsf w90.bxsf
+
Lets now compute the interpolated Fermi surface. To do that, we add the following lines to the {{file|w90.win}} file:
 +
<pre>
 +
restart = plot
 +
fermi_energy = 4.283754645
 +
fermi_surface_plot = true
 +
</pre>
 +
The value of the Fermi energy corresponds to the one obtained by {{octopus}}, converted to eV.
  
and you show be able to produce the plot of the Fermi surface for band 2 and band 3, as shown below
+
By calling again Wannier90, you will obtain a file {{file|w90.bxsf}}, which you can plot using, for instance, xcrysden:
[[Image:FS_Lead_band2_band3.png|thumb|420px|Fermi surface for bands 2 and 3 in lead.]]
+
{{command_line|xcrysden --bxsf w90.bxsf}}
 +
From here you should be able to produce the plot of the Fermi surface for band 2 and band 3, as shown in the figure.
  
 
== Visualization of Wannier states using Octopus or Wannier90 ==
 
== Visualization of Wannier states using Octopus or Wannier90 ==
  
With Wannier90, it is possible to compute the Wannier states. For this, you need to output the periodic part of the Bloch states on the real-space grid. This produces the <tt>.unk</tt> files. For this, you need to specify the output of oct-wannier90 adding the following line in the <tt>inp</tt> file
+
Wannier90 allows one to compute the Wannier states. For this, you need to output the periodic part of the Bloch states on the real-space grid. This produces the {{file|.unk}} files. For this, you need to specify the output of {{file|oct-wannier90} by adding the following line to the {{file|inp}} file
  {{variable|Wannier90_Files|Utilities::oct-wannier90}} = w90_unk
+
  {{variable|Wannier90Files|Utilities::oct-wannier90}} = w90_unk
  
Note that in order to get all the files you need, you could use instead <tt>{{variable|Wannier90_Files|Utilities::oct-wannier90}} = w90_amn + w90_mmn + w90_eig + w90_unk</tt>.
+
Note that in order to get all the files you need in one run, you could instead use <tt>{{variable|Wannier90Files|Utilities::oct-wannier90}} = w90_amn + w90_mmn + w90_eig + w90_unk</tt>.
  
An alternative way of getting the states consist in letting Octopus computing them. For this, you need to get the <tt>U</tt> matrices from Wannier90, by adding in the w90.win file
+
An alternative way of getting the states is to let {{octopus}} compute them. You need to get the <tt>U</tt> matrices from Wannier90 for this by adding the following line to the {{file|w90.win}} file:
 
   write_u_matrices = .true.
 
   write_u_matrices = .true.
  
Then you can run <tt>oct-wannier90</tt> with the mode
+
Then run the {{file|oct-wannier90}} utility with the appropriate mode
   {{variable|Wannier90_Mode|Utilities::oct-wannier90}} = w90_wannier
+
   {{variable|Wannier90Mode|Utilities::oct-wannier90}} = w90_wannier
which will create a folder <tt>wannier</tt> containing the calculated Wannier states.
+
This will create a folder named {{file|wannier}} containing the calculated Wannier states. The main advantage of doing this is that the Wannier states can be obtained in any of the output formats supported by {{octopus}}. This is controlled, as usual, by the {{variable|OutputFormat|Output}} variable.
The main advantage of doing so with Octopus is that the Wannier states can be obtained in many different formats, as the output format is controlled by the variable {{variable|OutFormat|Output}}.
 
  
 +
<span class=noprint><hr>
 
Back to [[Tutorials]]
 
Back to [[Tutorials]]
  

Latest revision as of 08:12, 28 October 2019

Starting from Octopus Selene (10.x), Octopus provides an interface for Wannier90. In order to perform this tutorial, you need first to compile Wannier90. Detailed information can be found on the Wannier90 website.

In this tutorial, we follow the second example from the Wannier90 tutorials, which consists in computing the Fermi surface of lead. This requires several steps, which are explained in detail bellow.


Ground-state

Input

We start with the input file for Octopus. At this point there is nothing special to specify as Octopus does not need to know that Wannier90 will be called later.

CalculationMode = gs
PeriodicDimensions = 3

Spacing = 0.4

%LatticeVectors
  0.0 | 0.5 | 0.5 
  0.5 | 0.0 | 0.5
  0.5 | 0.5 | 0.0
%

a = 9.3555
%LatticeParameters
 a | a | a
%

PseudopotentialSet = hgh_lda
%ReducedCoordinates
 "Pb" | 0.0 | 0.0 | 0.0 
%

%KPointsGrid
  4 |  4 |  4
%

Smearing = 0.1*eV
SmearingFunction = fermi_dirac
ExtraStates = 4

The use of most of these variables is already explained in detail in other tutorials. See, for example, the Periodic Systems tutorial. Nevertheless, some options deserve a more detailed explanation:

  • SmearingFunction = fermi_dirac: as we are interested in lead, which is a metal, we need to use a smearing of the occupations in order to get a converged ground-state. Here we have chosen the smearing function to be a Fermi-Dirac distribution.
  • Smearing = 0.1*eV: this defines the effective temperature of the smearing function.
  • PseudopotentialSet = hgh_lda: since lead is not provided with the default pseudopotential set, we must select one containing Pb. We thus use the LDA HGH pseudopotential set here.

It is also important to note that the k-point symmetries cannot be used with Wannier90. Also, only Monkhorst-Pack grids are allowed, so that only one k-point shift is allowed.

Output

Now run Octopus using the above input file. The output should be similar to other ground-state calculations for periodic systems, so we are not going to look at it in detail. Nevertheless, to make sure there was no problem with the calculation and since we will need this information later, you should check the calculated Fermi energy. You can find this information in the static/info file:

Fermi energy =     0.157425 H

Wannier90

The usage of Wannier90 as a post-processing tool requires several steps and several invocations of both Wannier90 and Octopus. Note that all the interfacing between Wannier90 and Octopus is done through a specialized utility called oct-wannier90.

Step one: create the Wannier90 input file

In order to run Wannier90, you must prepare an input file for it. To make this task easier, the oct-wannier90 utility can take the Octopus input file and "translate" it for Wannier90. Here is how the input file for the utility should look like:

CalculationMode = gs
PeriodicDimensions = 3

Spacing = 0.4

%LatticeVectors
  0.0 | 0.5 | 0.5 
  0.5 | 0.0 | 0.5
  0.5 | 0.5 | 0.0
%

a = 9.3555
%LatticeParameters
 a | a | a
%

PseudopotentialSet = hgh_lda
%ReducedCoordinates
 "Pb" | 0.0 | 0.0 | 0.0 
%

%KPointsGrid
  4 |  4 |  4
%

Smearing = 0.1*eV
SmearingFunction = fermi_dirac
ExtraStates = 4

Wannier90Mode = w90_setup

This is basically the same input file as above with the following option added:

  • Wannier90Mode = w90_setup: this tells the oct-wannier90 utility that we want to setup an input file for Wannier90 based on the contents of our input file.

Now run the the oct-wannier90 utility. This will create a file named w90.win that should look like this:

# this file has been created by the Octopus wannier90 utility
 
begin unit_cell_cart
Ang
   0.00000000   2.47535869   2.47535869
   2.47535869   0.00000000   2.47535869
   2.47535869   2.47535869   0.00000000
end unit_cell_cart
 
begin atoms_frac
Pb     0.00000000   0.00000000   0.00000000
end atoms_frac
 
use_bloch_phases = .true.
 
num_bands    6
num_wann    6
 
write_u_matrices = .true.
translate_home_cell = .true.
write_xyz = .true.
 
mp_grid    4   4   4
 
begin kpoints
 -0.00000000  -0.00000000  -0.00000000
 -0.25000000  -0.00000000  -0.00000000
...

Before running Wannier90, we are going to slightly tweak this file. As we are interested in lead, we will replace the following lines:

use_bloch_phases = .true.
 
num_bands    6
num_wann    6

by

num_bands    6
num_wann    4
begin projections
Pb:sp3
end projections

By doing this, we are telling Wannier90 that we want to find 4 Wannier states out of the 6 bands contained in the DFT calculation. Moreover, we are using guess projections based on sp3 orbitals attached to the lead atom. More details about Wannier90, projections, and disentanglement can be found in the tutorials and manual of Wannier90.

Step 2: generate the .nnkp file

After editing the file w90.win, run Wannier90 in post-processing mode:

 $ wannier90.x -pp w90.win

This will produce a file named w90.nnkp. This file contains information telling Octopus what further information does Wannier90 require for the following steps.

Step 3: generate files for Wannier90

At this stage, we are going to tell Octopus to generate some files for Wannier90 using the information from the w90.nnkp file. To do so, we change the value of the Wannier90Mode variable in the above Octopus input file to:

Wannier90Mode = w90_output

Then, run the oct-wannier90 utility again. This time the utility will produces the files w90.eig, w90.mmn, and w90.amn. The variable that controls which files are produced is Wannier90Files.

Step 4: run Wannier90

Finally, you call Wannier90 to perform the Wannierization:

 $ wannier90.x w90.win

Computing the Fermi surface

Fermi surface for bands 2 and 3 in lead.

Once you performed all the previous steps, you know how to run Wannier90 on top of an Octopus calculation. Lets now compute the interpolated Fermi surface. To do that, we add the following lines to the w90.win file:

restart = plot
fermi_energy = 4.283754645
fermi_surface_plot = true

The value of the Fermi energy corresponds to the one obtained by Octopus, converted to eV.

By calling again Wannier90, you will obtain a file w90.bxsf, which you can plot using, for instance, xcrysden:

 $ xcrysden --bxsf w90.bxsf

From here you should be able to produce the plot of the Fermi surface for band 2 and band 3, as shown in the figure.

Visualization of Wannier states using Octopus or Wannier90

Wannier90 allows one to compute the Wannier states. For this, you need to output the periodic part of the Bloch states on the real-space grid. This produces the .unk files. For this, you need to specify the output of {{file|oct-wannier90} by adding the following line to the inp file

Wannier90Files = w90_unk

Note that in order to get all the files you need in one run, you could instead use Wannier90Files = w90_amn + w90_mmn + w90_eig + w90_unk.

An alternative way of getting the states is to let Octopus compute them. You need to get the U matrices from Wannier90 for this by adding the following line to the w90.win file:

 write_u_matrices = .true.

Then run the oct-wannier90 utility with the appropriate mode

 Wannier90Mode = w90_wannier

This will create a folder named wannier containing the calculated Wannier states. The main advantage of doing this is that the Wannier states can be obtained in any of the output formats supported by Octopus. This is controlled, as usual, by the OutputFormat variable.


Back to Tutorials