Calculating the density of states
Objectives
- Understand how to calculate the density of states (DOS)
- Using weights in the DOS
- Use an AiiDA workflow for the DOS
Introduction
To calculate a density of states (DOS), i.e., a visualization of the available single particle states per energy, we have to start from a self-consistent density.
In addition to a self-consistent density, we also might want to use a different k-point set and Brilloun zone (BZ) integration method. In comparison to the charge density, a DOS is energy resolved. This imposes increased requirements on these aspects to obtain converged results. In particular, the use of some kind of tetrahedon-method for the BZ integration is very advisable to obtain a nice DOS.
Info
To obtain a high quality DOS the following steps are needed:
1. Obtain a self-consistent density for your system.
2. If needed, refine the choice for the k-point set and the BZ integration method.
2. Run FLEUR with proper switches: dos="T"
3. Visualize your DOS.
FLEUR steps
Prepare by performing a SCF calculation
We use a simple bulk system (fcc-Cu) for this example. The same setup was already used in F3.
You can either copy the self-consistent data from F2 or perform a self-consistency here.
#either copy
cd CuBulk
cp ../../F2/CuBulk/* .
#or do the SCF here
cd CuBulk
inpgen -f CuBulk.txt
fleur_MPI
DOS calculation
To calculate a density of states one has to set the switch on dos
in the output
section of the inp.xml
file.
<span style="color:red">Open the file ```CuBulk/inp.xml``` in an editor window, find the switch and set it to "T".</span>
Afterwards one can simply restart FLEUR.
fleur_MPI
This time you should see a "STOP message: Charge density postprocessing done.", indicating that data for a DOS was generated. Check the files generated:
ls
As you can see several new output files have been generated. The data for the DOS can be found in the banddos.hdf
file. There is also a simpler plain text output in the Local.1
file, but we use the banddos.hdf
here.
Simple DOS plotting tool
We provide a set of python tools to be used with FLEUR. These are collected in the masci_tools
as found here and they can directly be used in a simple python script.
from masci_tools.io.parsers.hdf5 import HDF5Reader
from masci_tools.io.parsers.hdf5.recipes import FleurDOS
from masci_tools.vis.fleur import plot_fleur_dos
#Read in data
with HDF5Reader('CuBulk/banddos.hdf') as h5reader:
data, attributes = h5reader.read(recipe=FleurDOS)
#Plot the data
#Notice that you get the axis object of this plot is returned
#if you want to make any special additions
ax = plot_fleur_dos(data, attributes)
This is a very basic way to calculate the DOS. In particular, we used the same k-point set as in the SCF cycles and the histogramm method for the BZ integration. This also means that we had to use (and used) a rather large smearing of the raw DOS data on the energy mesh. This was given in the sigma
attribute in the bandDOS
tag in inp.xml
.
<bandDOS minEnergy="-.50000000*Htr" maxEnergy=".50000000*Htr" sigma=".01500000" storeEVData="T"/>
To obtain a better DOS it is advisable to use the tetrahedron integration instead. For this we need a different k-point set which we can generate using inpgen
.
inpgen -inp.xml -kpt tria@nk=500
Here we asked for another k-point set with 500 k-points. This set will be suitable for the special tetrahedron integration method named tria
in FLEUR. We then can modify the inp.xml
by
- changing the name of the k-set to be used:
<kPointListSelection listName="default-3"/>
- changing the BZ-integration method to tria:
<bzIntegration valenceElectrons="11.00000000" mode="tria" fermiSmearingEnergy=".00100000">
- removing the smearing of the DOS:
<bandDOS minEnergy="-.50000000*Htr" maxEnergy=".50000000*Htr" sigma=".00000" storeEVData="T"/>
<span style="color:red">Please modify the `inp.xml` accordingly</span>
And then start FLEUR again:
fleur_MPI
The DOS can then be visualized again. Here we change the script from above slightly by using the show_lresolved=True
option to plot in addition the DOS decomposed in contributions from different l=s,p,d,f
states. Please note that due to the different k-point set and integration scheme the DOS is much more detailed.
from masci_tools.io.parsers.hdf5 import HDF5Reader
from masci_tools.io.parsers.hdf5.recipes import FleurDOS
from masci_tools.vis.fleur import plot_fleur_dos
#Read in data
with HDF5Reader('CuBulk/banddos.hdf') as h5reader:
data, attributes = h5reader.read(recipe=FleurDOS)
#Plot the data
#Notice that you get the axis object of this plot is returned
#if you want to make any special additions
ax = plot_fleur_dos(data, attributes,show_lresolved=True)
AiiDA-FLEUR workflow
To perform the same simulation as above using AiiDA, we will now first perform the SCF calculation explicitly. In order to start from SCRATCH, we will perform the calculations in a separate sub-directory 'aiida'.
mkdir aiida; cd aiida
inpgen -f ../CuBulk.txt
aiida-fleur launch scf
Now the dos
workflow of aiida-fleur can be used by simply calling it.
!!! note As the dos workflow will require not only an inp.xml
file but also a self-consistent charge density, you have to provide the info on the previous SCF workflow stored in its output to create this link. This is done using the -P
option.
```sos
aiida-fleur launch dos -P scf.json
This workflow will now create some additional output files
ls
In particular, the workflow automatically calls the plotting tools and creates a simple DOS plot.
display < dos_plot.png
As the banddos.hdf
is also provided, further plots can also be generated as shown above.
Modifying the workflow
!!! note The underlying workflow in aiida-fleur is actually a banddos
workflow, i.e. it handles both DOS and bandstructure calculations. For simplicity, we provide here different interfaces, but if you use aiida-fleur in python you will only find the common banddos
workflow.
The banddos workflow which he use here has some options controlling its behaviour. These can be set by providing a python dictionary with some options. In order to do this using the command line interface, you can provide a json file with the required input. Most easily, you create this file by using the special filename template.json
with the -wf
option to provide the workflow parameters.
aiida-fleur launch dos -wf template.json
This "magic" option creates a template-file called wf_band.json
which you can now view and modify:
cat wf_dos.json
For example you can modify the smearing we discussed above or the energy window in which you calculate the DOS.
Then you can simply run the workflow again. This time we use the -wf
option to provide our settings to the workflow.
aiida-fleur launch dos -wf wf_dos.json -P scf.json
display < dos_plot.png
Learn more
To learn more about the possibilities for DOS calculations in FLEUR please visit: - https://www.flapw.de/MaX-7.0/documentation/dos/ - https://www.flapw.de/MaX-7.0/documentation/dos-modes/