[doc] Restructuring doc II

* Committing missing files of last commit
    * Correcting typos
    * Modifications according to issue #56
This commit is contained in:
Manuel Zingl 2016-07-08 12:04:31 +02:00
parent 5c70f1bca0
commit 1c29776727
16 changed files with 299 additions and 402 deletions

View File

@ -14,14 +14,16 @@ Olivier Parcollet (CEA Saclay). A first step has been the definition of the
framework and the construction of the projective Wannier functions as input for
the DMFT calculations [#dft_tools1]_. This has been followed by the introduction
of full charge self-consistency [#dft_tools2]_, necessary for total energy
calculations.
calculations. The package at hand is fully implemented as an application
based on the TRIQS library [#dft_tools3]_.
**Developers**: M. Aichhorn, L. Pourovskii, V. Vildosola, C. Martins, P. Seth, M. Zingl
**Developers**: M. Aichhorn, L. Pourovskii, P.Seth, V. Vildosola, M. Zingl, O. E. Peil, X. Deng, J. Mravlje, G. Kraberger, C. Martins, M. Ferrero, O. Parcollet
**Related papers**:
.. [#dft_tools1] `M. Aichhorn, L. Pourovskii, V. Vildosola, M. Ferrero, O. Parcollet, T. Miyake, A. Georges, and S. Biermann, Phys. Rev. B 80, 085101 (2009) <http://link.aps.org/doi/10.1103/PhysRevB.80.085101>`_ (:download:`bibtex file <dft_tools1.bib>`)
.. [#dft_tools2] `M. Aichhorn, L. Pourovskii, and A. Georges, Phys. Rev. B 84, 054529 (2011) <http://link.aps.org/doi/10.1103/PhysRevB.84.054529>`_ (:download:`bibtex file <dft_tools2.bib>`)
.. [#dft_tools3] `M. Aichhorn, L. Pourovskii, P.Seth, V. Vildosola, M. Zingl, O. E. Peil, X. Deng, J. Marvlje, G. Kraberger, C. Martins, M. Ferrero, and O. Parcollet, Commt. Phys. Commun. 204, 200 (2016) <http://www.sciencedirect.com/science/article/pii/S0010465516300728>`_ (:download:`bibtex file <dft_tools3.bib>`)
This application is a part of our scientific work and we would appreciate if
projects using it will include a citation to the above relevant papers. In

View File

@ -1,3 +1,5 @@
.. _dftplusdmft:
Introduction to DFT+DMFT
========================
@ -8,7 +10,7 @@ terms it states that electrons in a crystal form bands of allowed
states in momentum space. These states are then filled by the
electrons according to Pauli's principle up the Fermi level. With this
simple picture one can explain the electronic band structure of simple
materials such as elementary copper or aluminium.
materials such as elementary copper or aluminum.
Following this principle one can easily classify all existing
materials into metals and insulators, with semiconductors being
@ -17,9 +19,8 @@ spectrum. Following this band theory, a system is a metal if there is
an odd number of electrons in the valence bands, since this leads to a
partially filled band, cutting the Fermi energy and, thus, producing a
Fermi surface, i.e metallic behavior. On the other hand, an even
number of electrons leads to
completely filled bands with a finite excitation gap to the conduction
bands, i.e. insulating behavior.
number of electrons leads to completely filled bands with a finite
excitation gap to the conduction bands, i.e. insulating behavior.
This classification works pretty well for a large class of
materials, where the electronic band structures are reproduced by
@ -41,7 +42,7 @@ current
because of the strong Coulomb repulsion between the electrons. With
reference to Sir Nevill Mott, who contributed substantially to the
explanation of this effect in the 1930's, these materials are in
general reffered to as Mott insulators.
general referred to as Mott insulators.
Density-functional theory in a (very small) nutshell
----------------------------------------------------
@ -63,7 +64,7 @@ that is discussed in the literature on DFT, let us just note that the
main result of DFT calculations are the Kohn-Sham energies
:math:`\varepsilon_{\nu\mathbf{k}}` and the Kohn-Sham orbitals :math:`\psi_{\nu\mathbf{k}}(\mathbf{r})`.
This set of equations is exact, however, the exchange correlation
potential :math:`V_{xc}(\mathbf{r})` is not known explicitely. In
potential :math:`V_{xc}(\mathbf{r})` is not known explicitly. In
order to do actual calculations, it needs to be approximated in some
way. The local density approximation is one of the most famous
approximations used in this context. This approximation works well for
@ -75,7 +76,7 @@ From DFT to DMFT
In order to extend our calculations to strong correlations, we need to
go from a description by bands to a description in terms of
(localised) orbitals: Wannier functions.
(localized) orbitals: Wannier functions.
In principle, Wannier functions :math:`\chi_{\mu\sigma}(\mathbf{r})`
are nothing else than a Fourier transform of the Bloch basis set from
@ -88,7 +89,7 @@ where we introduced also the spin degree of freedom :math:`\sigma`. The
unitary matrix :math:`U_{\mu\nu}` is not uniquely defined, but allows for a
certain amount of freedom in the calculation of Wannier function. A
very popular choice is the constraint that the resulting Wannier
functions should be maximally localised in space. Another route,
functions should be maximally localized in space. Another route,
computationally much lighter and more stable, are projective Wannier
functions. This scheme is used for the Wien2k interface in this
package.
@ -98,7 +99,7 @@ A central quantity in this scheme is the projection operator
:math:`\nu` a Bloch band index.
Its definition and how it is calculated can be found in the original
literature or in the extensive documentation of the
:program:`dmftproj` program shipped with :program:`dft_tools`.
:program:`dmftproj` program shipped with :program:`DFTTools`.
Using projective Wannier functions for DMFT
-------------------------------------------
@ -121,7 +122,7 @@ with the DFT Green function
This non-interacting Green function :math:`G^0_{mn}(i\omega)` defines,
together with the interaction Hamiltonian, the Anderson impurity
model. The DMFT self-consitency cycle can now be formulated as
model. The DMFT self-consistency cycle can now be formulated as
follows:
#. Take :math:`G^0_{mn}(i\omega)` and the interaction Hamiltonian and
@ -173,9 +174,9 @@ Full charge self-consistency
The feedback of the electronic correlations to the Kohn-Sham orbitals
is included by the interacting density matrix. With going into the
details, it basically consists of calculating the Kohn Sham density
details, it basically consists of calculating the Kohn-Sham density
:math:`\rho(\mathbf{r})` in the presence of this interacting density
matrix. This new density now defines a new Kohn Sham
matrix. This new density now defines a new Kohn-Sham
exchange-correlation potential, which in turn leads to new
:math:`\varepsilon_{\nu\mathbf{k}}`,
:math:`\psi_{\nu\mathbf{k}}(\mathbf{r})`, and projectors
@ -186,4 +187,4 @@ step 3, before the local lattice Green
function is downfolded again into orbital space.
How all these calculations can be done in practice with this
:program:`dft_tools` package is subject of the user guide in this documentation.
:program:`DFTTools` package is subject of the user guide in this documentation.

View File

@ -1,18 +1,21 @@
Structure of DFT Tools
======================
.. _structure:
Structure of :program:`DFTTools`
================================
.. image:: images/structure.png
:width: 700
:align: center
The central part of :program:`dft_tools`, which is performing the
The central part of :program:`DFTTools`, which is performing the
steps for the DMFT self-consistency cycle, is written following the
same philosophy as the :ref:`TRIQS <triqslibs:welcome>` toolbox. At
the user level, easy-to-use python modules are provided that allow to
write simple and short scripts performing the actual
calculation. Here, we will describe the general structure of the
package, for the details of how to use the modules, please consult the
user guide of this :ref:`documentation`.
write simple and short scripts performing the actual calculation.
The usage of those modules is presented in the user guide of this
:ref:`documentation`. Before considering the user guide, we suggest
to read the following introduction on the general structure of
the :program:`DFTTools` package.
The interface layer
-------------------
@ -30,37 +33,37 @@ Wien2k interface
""""""""""""""""
This interface layer consists of two parts. First, the output from Wien2k
is taken, and localised Wannier orbitals are constructed. This is done
by the fortran program :program:`dmftproj`. The second part consist in
is taken, and localized Wannier orbitals are constructed. This is done
by the FORTRAN program :program:`dmftproj`. The second part consist in
the conversion of the :program:`dmftproj` into the hdf5 file
format to be used for the DMFT calculation. This step is done by a
python routine called :class:`Wien2kConverter`, that reads the text output and
creates the hdf5 input file with the necessary ingredients. Quite
naturally, :program:`dft_tools` will adopt this converter concept also for future
naturally, :program:`DFTTools` will adopt this converter concept also for future
developments for other DFT packages.
General interface
"""""""""""""""""
In addition to the specialised Wien2k interface, :program:`dft_tools`
In addition to the specialized Wien2k interface, :program:`DFTTools`
provides also a very light-weight general interface. It basically
consists of a very simple :class:`HkConverter`. As input it requires a
hamiltonian matrix :math:`H_{mn}(\mathbf{k})` written already in
localised-orbital indices :math:`m,n`, on a :math:`\mathbf{k}`-point
Hamiltonian matrix :math:`H_{mn}(\mathbf{k})` written already in
localized-orbital indices :math:`m,n`, on a :math:`\mathbf{k}`-point
grid covering the Brillouin zone, and just a few other informations
like total numer of electrons, how many correlated atoms in the unit
cell, and so on. It converts this hamiltonian into a hdf5 format and
like total number of electrons, how many correlated atoms in the unit
cell, and so on. It converts this Hamiltonian into a hdf5 format and
sets some variables to standard values, such that it can be used with
the python modules performing the DMFT calculation. How the
hamiltonian matrix :math:`H_{mn}(\mathbf{k})` is actually calculated,
is **not** part of this interace.
Hamiltonian matrix :math:`H_{mn}(\mathbf{k})` is actually calculated,
is **not** part of this interface.
The DMFT calculation
--------------------
As mentioned above, there are a few python routines that allow to
perform the multi-band DMFT calculation in the context of real
materials. The major part is contained inte module
materials. The major part is contained in the module
:class:`SumkDFT`. It contains routines to
* calculate local Greens functions
@ -69,7 +72,7 @@ materials. The major part is contained inte module
* calculate the double-counting correction
* calculate the chemical potential in order to get the electron count right
* other things like determining the structure of the local
hamiltonian, rotating from local to global coordinate systems, etc.
Hamiltonian, rotating from local to global coordinate systems, etc.
At the user level, all these routines can be used to construct
situation- and problem-dependent DMFT calculations in a very efficient
@ -90,8 +93,8 @@ Post-processing
The main result of DMFT calculation is the interacting Greens function
and the Self energy. However, one is normally interested in
quantitites like band structure, density of states, or transport
properties. In order to calculate these things, :program:`dft_tools`
quantities like band structure, density of states, or transport
properties. In order to calculate these things, :program:`DFTTools`
provides the post-processing modules :class:`SumkDFTTools`. It
contains routines to calculate
@ -102,11 +105,8 @@ contains routines to calculate
or thermopower.
.. warning::
At the moment neither :ref:`TRIQS<triqslibs:welcome>` nor :program:`dft_tools`
At the moment neither :ref:`TRIQS<triqslibs:welcome>` nor :program:`DFTTools`
provides Maximum Entropy routines! You can use the Pade
approximants implemented in the TRIQS library, or you use your own
approximation implemented in the :ref:`TRIQS <triqslibs:welcome>` library, or you use your own
home-made Maximum Entropy code to do the analytic continuation from
Matsubara to the real-frequency axis.

View File

@ -17,7 +17,7 @@ extensions = ['sphinx.ext.autodoc',
source_suffix = '.rst'
project = u'TRIQS_DFT Tools'
project = u'TRIQS DFTTools'
copyright = u'2011-2013, M. Aichhorn, L. Pourovskii, V. Vildosola, C. Martins'
version = '@DFT_TOOLS_VERSION@'
release = '@DFT_TOOLS_RELEASE@'
@ -28,16 +28,15 @@ templates_path = ['@CMAKE_SOURCE_DIR@/doc/_templates']
html_theme = 'triqs'
html_theme_path = ['@TRIQS_THEMES_PATH@']
html_show_sphinx = False
html_context = {'header_title': 'dft_tools',
html_context = {'header_title': 'dft tools',
'header_subtitle': 'connecting <a class="triqs" style="font-size: 12px" href="http://ipht.cea.fr/triqs">TRIQS</a> to DFT packages',
'header_links': [['Install', 'install'],
['Documentation', 'documentation'],
['Issues', 'issues'],
['About dft_tools', 'about']]}
['About DFTTools', 'about']]}
html_static_path = ['@CMAKE_SOURCE_DIR@/doc/_static']
html_sidebars = {'index': ['sideb.html', 'searchbox.html']}
htmlhelp_basename = 'TRIQSDftToolsdoc'
intersphinx_mapping = {'python': ('http://docs.python.org/2.7', None), 'triqslibs': ('http://ipht.cea.fr/triqs', None),
'triqscthyb': ('http://ipht.cea.fr/triqs/applications/cthyb', None)}
intersphinx_mapping = {'python': ('http://docs.python.org/2.7', None), 'triqslibs': ('http://ipht.cea.fr/triqs', None), 'triqscthyb': ('http://ipht.cea.fr/triqs/applications/cthyb', None)}

View File

@ -1,4 +1,4 @@
.. module:: pytriqs.applications.dft_tools
.. module:: pytriqs.applications.dft
.. _documentation:
@ -11,6 +11,7 @@ Basic notions
.. toctree::
:maxdepth: 2
basicnotions/first
basicnotions/dft_dmft
basicnotions/structure
@ -23,6 +24,7 @@ User guide
guide/conversion
guide/dftdmft_singleshot
guide/SrVO3
guide/dftdmft_selfcons
guide/analysis
guide/full_tutorial

View File

@ -55,20 +55,21 @@ And next, we can initialize the :class:`SumkDFT <dft.sumk_dft.SumkDFT>` class::
Initializing the solver
-----------------------
We also have to specify the :ref:`CTHYB solver <triqscthyb:welcome>` related settings. The
minimal parameters for a SrVO3 DMFT calculation on 16 cores are::
We also have to specify the :ref:`CTHYB solver <triqscthyb:welcome>` related settings.
We assume that the DMFT script for SrVO3 is executed on 16 cores. A sufficient set
of parameters for a first guess is::
p = {}
# solver
p["random_seed"] = 123 * mpi.rank + 567
p["length_cycle"] = 200
p["n_warmup_cycles"] = 50000
p["n_cycles"] = 500000
p["n_warmup_cycles"] = 100000
p["n_cycles"] = 1000000
# tail fit
p["perform_tail_fit"] = True
p["fit_max_moment"] = 4
p["fit_min_n"] = 60
p["fit_max_n"] = 140
p["fit_min_n"] = 30
p["fit_max_n"] = 60
Here we use a tail fit to deal with numerical noise of higher Matsubara frequencies.
For other options and more details on the solver parameters, we refer the user to
@ -180,17 +181,26 @@ This is all we need for the DFT+DMFT calculation.
You can see in this code snippet, that all results of this calculation
will be stored in a separate subgroup in the hdf5 file, called `dmft_output`.
Note that this script performs 15 DMFT cycles, but does not check for
convergence. Of course, it is possible to build in convergence criterias.
convergence. Of course, it would be possible to build in convergence criteria.
A simple check for convergence can be also done if you store multiple quantities
of each iteration and analyze the convergence by hand. In general, it is advisable
to start with a lower statistics (less measurements), but then increase it at a
point close to converged results (e.g. after a few initial iterations). This helps
to keep computational costs low during the first iterations.
Using the Kanamori Hamiltonian and the parameters above (but on 16 cores),
your self energy after the **first iteration** should look like the
self energy shown below.
.. image:: images_scripts/SrVO3_Sigma_iw_it1.png
:width: 700
:align: center
.. _tailfit:
Tail fit paramters
------------------
Tail fit parameters
-------------------
A good way to identify suitable tail fit parameters is by "human inspection".
Therefore disabled the tail fitting first::

View File

@ -7,13 +7,13 @@ This section explains how to use some tools of the package in order to analyse t
There are two practical tools for which a self energy on the real axis is not needed, namely:
* :meth:`dos_wannier_basis <pytriqs.applications.dft.sumk_dft_tools.SumkDFTTools.dos_wannier_basis>` for the density of states of the Wannier orbitals and
* :meth:`partial_charges <pytriqs.applications.dft.sumk_dft_tools.SumkDFTTools.partial_charges>` for the partial charges according to the :program:`Wien2k` definition.
* :meth:`dos_wannier_basis <dft.sumk_dft_tools.SumkDFTTools.dos_wannier_basis>` for the density of states of the Wannier orbitals and
* :meth:`partial_charges <dft.sumk_dft_tools.SumkDFTTools.partial_charges>` for the partial charges according to the :program:`Wien2k` definition.
However, a real frequency self energy has to be provided by the user for the methods:
* :meth:`dos_parproj_basis <pytriqs.applications.dft.sumk_dft_tools.SumkDFTTools.dos_parproj_basis>` for the momentum-integrated spectral function including self energy effects and
* :meth:`spaghettis <pytriqs.applications.dft.sumk_dft_tools.SumkDFTTools.spaghettis>` for the momentum-resolved spectral function (i.e. ARPES)
* :meth:`dos_parproj_basis <dft.sumk_dft_tools.SumkDFTTools.dos_parproj_basis>` for the momentum-integrated spectral function including self energy effects and
* :meth:`spaghettis <dft.sumk_dft_tools.SumkDFTTools.spaghettis>` for the momentum-resolved spectral function (i.e. ARPES)
.. warning::
This package does NOT provide an explicit method to do an **analytic continuation** of the
@ -24,26 +24,26 @@ However, a real frequency self energy has to be provided by the user for the met
Initialisation
--------------
All tools described below are collected in an extension of the :class:`SumkDFT <pytriqs.applications.dft.sumk_dft.SumkDFT>` class and are
loaded by importing the module :class:`SumkDFTTools <pytriqs.applications.dft.sumk_dft_tools.SumkDFTTools>`::
All tools described below are collected in an extension of the :class:`SumkDFT <dft.sumk_dft.SumkDFT>` class and are
loaded by importing the module :class:`SumkDFTTools <dft.sumk_dft_tools.SumkDFTTools>`::
from pytriqs.applications.dft.sumk_dft_tools import *
The initialisation of the class is equivalent to that of the :class:`SumkDFT <pytriqs.applications.dft.sumk_dft.SumkDFT>`
The initialisation of the class is equivalent to that of the :class:`SumkDFT <dft.sumk_dft.SumkDFT>`
class::
SK = SumkDFTTools(hdf_file = filename + '.h5')
Note that all routines available in :class:`SumkDFT <pytriqs.applications.dft.sumk_dft.SumkDFT>` are also available here.
Note that all routines available in :class:`SumkDFT <dft.sumk_dft.SumkDFT>` are also available here.
If required, we have to load and initialise the real frequency self energy. Most conveniently,
you have your self energy already stored as a real frequency :class:`BlockGf <pytriqs.gf.local.BlockGf>` object
If required, we have to load and initialise the real frequency self energy. Most conveniently,
you have your self energy already stored as a real frequency :class:`BlockGf <pytriqs.gf.local.BlockGf>` object
in a hdf5 file::
ar = HDFArchive('case.h5', 'a')
SigmaReFreq = ar['dmft_output']['Sigma_w']
You may also have your self energy stored in text files. For this case the :ref:`TRIQS <triqslibs:welcome>` library offers
You may also have your self energy stored in text files. For this case the :ref:`TRIQS <triqslibs:welcome>` library offers
the function :meth:`read_gf_from_txt`, which is able to load the data from text files of one Greens function block
into a real frequency :class:`ReFreqGf <pytriqs.gf.local.ReFreqGf>` object. Loading each block separately and
building up a :class:´BlockGf <pytriqs.gf.local.BlockGf>´ is done with::
@ -58,18 +58,18 @@ building up a :class:´BlockGf <pytriqs.gf.local.BlockGf>´ is done with::
where:
* `block_txtfiles` is a rank 2 square np.array(str) or list[list[str]] holding the file names of one block and
* `block_txtfiles` is a rank 2 square np.array(str) or list[list[str]] holding the file names of one block and
* `block_name` is the name of the block.
It is important that each data file has to contain three columns: the real frequency mesh, the real part and the imaginary part
of the self energy - exactly in this order! The mesh should be the same for all files read in and non-uniform meshes are not supported.
Finally, we set the self energy into the `SK` object::
of the self energy - exactly in this order! The mesh should be the same for all files read in and non-uniform meshes are not supported.
Finally, we set the self energy into the `SK` object::
SK.set_Sigma([SigmaReFreq])
and additionally set the chemical potential and the double counting correction from the DMFT calculation::
chemical_potential, dc_imp, dc_energ = SK.load(['chemical_potential','dc_imp','dc_energ'])
SK.set_mu(chemical_potential)
SK.set_dc(dc_imp,dc_energ)
@ -84,16 +84,16 @@ For plotting the density of states of the Wannier orbitals, you type::
SK.dos_wannier_basis(broadening=0.03, mesh=[om_min, om_max, n_om], with_Sigma=False, with_dc=False, save_to_file=True)
which produces plots between the real frequencies `om_min` and `om_max`, using a mesh of `n_om` points. The parameter
which produces plots between the real frequencies `om_min` and `om_max`, using a mesh of `n_om` points. The parameter
`broadening` defines an additional Lorentzian broadening, and has the default value of `0.01 eV`. To check the Wannier
density of states after the projection set `with_Sigma` and `with_dc` to `False`. If `save_to_file` is set to `True`
the output is printed into the files
* `DOS_wannier_(sp).dat`: The total DOS, where `(sp)` stands for `up`, `down`, or combined `ud`. The latter case
is relevant for calculations including spin-orbit interaction.
* `DOS_wannier_(sp)_proj(i).dat`: The DOS projected to an orbital with index `(i)`. The index `(i)` refers to
* `DOS_wannier_(sp)_proj(i).dat`: The DOS projected to an orbital with index `(i)`. The index `(i)` refers to
the indices given in ``SK.shells``.
* `DOS_wannier_(sp)_proj(i)_(m)_(n).dat`: As above, but printed as orbitally-resolved matrix in indices
* `DOS_wannier_(sp)_proj(i)_(m)_(n).dat`: As above, but printed as orbitally-resolved matrix in indices
`(m)` and `(n)`. For `d` orbitals, it gives the DOS separately for, e.g., :math:`d_{xy}`, :math:`d_{x^2-y^2}`, and so on,
otherwise, the output is returned by the function for a further usage in :program:`python`.
@ -110,7 +110,7 @@ real frequency self energy for this purpose. The calculation is done by::
which calculates the partial charges using the self energy, double counting, and chemical potential as set in the
`SK` object. On return, `dm` is a list, where the list items correspond to the density matrices of all shells
defined in the list `SK.shells`. This list is constructed by the :program:`Wien2k` converter routines and stored automatically
in the hdf5 archive. For the structure of `dm`, see also :meth:`reference manual <pytriqs.applications.dft.sumk_dft_tools.SumkDFTTools.partial_charges>`.
in the hdf5 archive. For the structure of `dm`, see also :meth:`reference manual <dft.sumk_dft_tools.SumkDFTTools.partial_charges>`.
Correlated spectral function (with real frequency self energy)
--------------------------------------------------------------
@ -129,7 +129,7 @@ Momentum resolved spectral function (with real frequency self energy)
Another quantity of interest is the momentum-resolved spectral function, which can directly be compared to ARPES
experiments. First we have to execute `lapw1`, `lapw2 -almd` and :program:`dmftproj` with the `-band`
option and use the :meth:`convert_bands_input <pytriqs.applications.dft.converters.wien2k_converter.Wien2kConverter.convert_bands_input>`
option and use the :meth:`convert_bands_input <dft.converters.wien2k_converter.Wien2kConverter.convert_bands_input>`
routine, which converts the required files (for a more detailed description see :ref:`conversion`). The spectral function is then calculated by typing::
SK.spaghettis(broadening=0.01,plot_shift=0.0,plot_range=None,ishell=None,save_to_file='Akw_')

View File

@ -34,9 +34,9 @@ some files that we need for the Wannier orbital construction.
The orbital construction itself is done by the Fortran program
:program:`dmftproj`. For an extensive manual to this program see
:download:`TutorialDmftproj.pdf <images_scripts/TutorialDmftproj.pdf>`.
Here we will only describe only the basic steps.
Here we will only describe the basic steps.
Let us take the example of SrVO3, a commonly used
Let us take the compound SrVO3, a commonly used
example for DFT+DMFT calculations. The input file for
:program:`dmftproj` looks like
@ -56,9 +56,9 @@ following 3 to 5 lines:
harmonics).
#. The four numbers refer to *s*, *p*, *d*, and *f* electrons,
resp. Putting 0 means doing nothing, putting 1 will calculate
**unnormalised** projectors in compliance with the Wien2k
**unnormalized** projectors in compliance with the Wien2k
definition. The important flag is 2, this means to include these
electrons as correlated electrons, and calculate normalised Wannier
electrons as correlated electrons, and calculate normalized Wannier
functions for them. In the example above, you see that only for the
vanadium *d* we set the flag to 2. If you want to do simply a DMFT
calculation, then set everything to 0, except one flag 2 for the
@ -100,12 +100,12 @@ directory name):
respectively. These files are needed for projected
density-of-states or spectral-function calculations in
post-processing only.
* :file:`case.oubwin` needed for the charge desity recalculation in
* :file:`case.oubwin` needed for the charge density recalculation in
the case of fully self-consistent DFT+DMFT run (see below).
Now we convert these files into an hdf5 file that can be used for the
DMFT calculations. For this purpose we
use the python module :class:`Wien2kConverter <pytriqs.applications.dft.converters.wien2k_converter.Wien2kConverter>`. It is initialised as::
use the python module :class:`Wien2kConverter <dft.converters.wien2k_converter.Wien2kConverter>`. It is initialized as::
from pytriqs.applications.dft.converters.wien2k_converter import *
Converter = Wien2kConverter(filename = case)
@ -119,7 +119,7 @@ an hdf5 archive, named :file:`case.h5`, where all the data is
stored. For other parameters of the constructor please visit the
:ref:`refconverters` section of the reference manual.
After initialising the interface module, we can now convert the input
After initializing the interface module, we can now convert the input
text files to the hdf5 archive by::
Converter.convert_dft_input()
@ -133,21 +133,21 @@ After this step, all the necessary information for the DMFT loop is
stored in the hdf5 archive, where the string variable
`Converter.hdf_filename` gives the file name of the archive.
At this point you should use the method :meth:`dos_wannier_basis <pytriqs.applications.dft.sumk_dft_tools.SumkDFTTools.dos_wannier_basis>`
contained in the module :class:`SumkDFTTools <pytriqs.applications.dft.sumk_dft_tools.SumkDFTTools>` to check the density of
states of the Wannier orbitals (see :ref:`analysis`).
At this point you should use the method :meth:`dos_wannier_basis <dft.sumk_dft_tools.SumkDFTTools.dos_wannier_basis>`
contained in the module :class:`SumkDFTTools <dft.sumk_dft_tools.SumkDFTTools>` to check the density of
states of the Wannier orbitals (see :ref:`analysis`).
You have now everything for performing a DMFT calculation, and you can
proceed with :ref:`singleshot`.
proceed with the section on :ref:`single-shot DFT+DMFT calculations <singleshot>`.
Data for post-processing
""""""""""""""""""""""""
In case you want to do post-processing of your data using the module
:class:`SumkDFTTools <pytriqs.applications.dft.sumk_dft_tools.SumkDFTTools>`, some more files
:class:`SumkDFTTools <dft.sumk_dft_tools.SumkDFTTools>`, some more files
have to be converted to the hdf5 archive. For instance, for
calculating the partial density of states or partial charges
consistent with the definition of :program:`Wien2k`, you have to invoke::
consistent with the definition of :program:`Wien2k`, you have to invoke::
Converter.convert_parproj_input()
@ -165,8 +165,8 @@ following. First, one has to do the Wien2k calculation on the given
Again, maybe with the optional additional extra flags according to
Wien2k. Now we use a routine of the converter module allows to read
and convert the input for :class:`SumkDFTTools <pytriqs.applications.dft.sumk_dft_tools.SumkDFTTools>`::
and convert the input for :class:`SumkDFTTools <dft.sumk_dft_tools.SumkDFTTools>`::
Converter.convert_bands_input()
After having converted this input, you can further proceed with the
@ -186,7 +186,7 @@ A general H(k)
--------------
In addition to the more complicated Wien2k converter,
:program:`dft_tools` contains also a light converter. It takes only
:program:`DFTTools` contains also a light converter. It takes only
one inputfile, and creates the necessary hdf outputfile for
the DMFT calculation. The header of this input file has to have the
following format:
@ -204,15 +204,13 @@ The lines of this header define
#. The last line contains several numbers: the number of irreducible
representations, and then the dimensions of the irreps. One
possibility is as the example above, another one would be 2
2 3. Thiw would mean, 2 irreps (eg and t2g), of dimension 2 and 3,
resp.
2 3. This would mean, 2 irreps (eg and t2g), of dimension 2 and 3,
resp.
After these header lines, the file has to contain the Hamiltonian
matrix in orbital space. The standard convention is that you give for
each
:math:`\mathbf{k}`-point first the matrix of the real part, then the
matrix of the imaginary part, and then move on to the next
:math:`\mathbf{k}`-point.
each :math:`\mathbf{k}`-point first the matrix of the real part, then the
matrix of the imaginary part, and then move on to the next :math:`\mathbf{k}`-point.
The converter itself is used as::
@ -221,8 +219,7 @@ The converter itself is used as::
Converter.convert_dft_input()
where :file:`hkinputfile` is the name of the input file described
above. This produces the hdf file that you need, and you cna proceed
with the
above. This produces the hdf file that you need for a DMFT calculation.
For more options of this converter, have a look at the
:ref:`refconverters` section of the reference manual.
@ -231,24 +228,24 @@ For more options of this converter, have a look at the
Wannier90 Converter
-------------------
Using this converter it is possible to convert the output of
:program:`Wannier90` (http://wannier.org) calculations of
Maximally Localized Wannier Functions (MLWF) and create a HDF5 archive
Using this converter it is possible to convert the output of
`wannier90 <http://wannier.org>`_
Maximally Localized Wannier Functions (MLWF) and create a HDF5 archive
suitable for one-shot DMFT calculations with the
:class:`SumkDFT <pytriqs.applications.dft.sumk_dft.SumkDFT>` class.
:class:`SumkDFT <dft.sumk_dft.SumkDFT>` class.
The user must supply two files in order to run the Wannier90 Converter:
#. The file :file:`seedname_hr.dat`, which contains the DFT Hamiltonian
in the MLWF basis calculated through :program:`wannier90` with ``hr_plot = true``
(please refer to the :program:`wannier90` documentation).
#. A file named :file:`seedname.inp`, which contains the required
#. A file named :file:`seedname.inp`, which contains the required
information about the :math:`\mathbf{k}`-point mesh, the electron density,
the correlated shell structure, ... (see below).
Here and in the following, the keyword ``seedname`` should always be intended
as a placeholder for the actual prefix chosen by the user when creating the
input for :program:`wannier90`.
input for :program:`wannier90`.
Once these two files are available, one can use the converter as follows::
from pytriqs.applications.dft.converters import Wannier90Converter
@ -260,8 +257,8 @@ the following format:
.. literalinclude:: images_scripts/LaVO3_w90.inp
The example shows the input for the perovskite crystal of LaVO\ :sub:`3`
in the room-temperature `Pnma` symmetry. The unit cell contains four
The example shows the input for the perovskite crystal of LaVO\ :sub:`3`
in the room-temperature `Pnma` symmetry. The unit cell contains four
symmetry-equivalent correlated sites (the V atoms) and the total number
of electrons per unit cell is 8 (see second line).
The first line specifies how to generate the :math:`\mathbf{k}`-point
@ -269,18 +266,18 @@ mesh that will be used to obtain :math:`H(\mathbf{k})`
by Fourier transforming :math:`H(\mathbf{R})`.
Currently implemented options are:
* :math:`\Gamma`-centered uniform grid with dimensions
:math:`n_{k_x} \times n_{k_y} \times n_{k_z}`;
* :math:`\Gamma`-centered uniform grid with dimensions
:math:`n_{k_x} \times n_{k_y} \times n_{k_z}`;
specify ``0`` followed by the three grid dimensions,
like in the example above
* :math:`\Gamma`-centered uniform grid with dimensions
automatically determined by the converter (from the number of
automatically determined by the converter (from the number of
:math:`\mathbf{R}` vectors found in :file:`seedname_hr.dat`);
just specify ``-1``
Inside :file:`seedname.inp`, it is crucial to correctly specify the
Inside :file:`seedname.inp`, it is crucial to correctly specify the
correlated shell structure, which depends on the contents of the
:program:`wannier90` output :file:`seedname_hr.dat` and on the order
:program:`wannier90` output :file:`seedname_hr.dat` and on the order
of the MLWFs contained in it.
The number of MLWFs must be equal to, or greater than the total number
@ -291,7 +288,7 @@ additional MLWFs correspond to uncorrelated orbitals (e.g., the O-\ `2p` shells)
When reading the hoppings :math:`\langle w_i | H(\mathbf{R}) | w_j \rangle`
(where :math:`w_i` is the :math:`i`-th MLWF), the converter also assumes that
the first indices correspond to the correlated shells (in our example,
the V-t\ :sub:`2g` shells). Therefore, the MLWFs corresponding to the
the V-t\ :sub:`2g` shells). Therefore, the MLWFs corresponding to the
uncorrelated shells (if present) must be listed **after** those of the
correlated shells.
With the :program:`wannier90` code, this can be achieved this by listing the
@ -303,19 +300,19 @@ In our `Pnma`-LaVO\ :sub:`3` example, for instance, we could use::
O:l=1:mr=1,2,3:z=0,0,1:x=-1,1,0
End Projections
where the ``x=-1,1,0`` option indicates that the V--O bonds in the octahedra are
where the ``x=-1,1,0`` option indicates that the V--O bonds in the octahedra are
rotated by (approximatively) 45 degrees with respect to the axes of the `Pbnm` cell.
The converter will analyse the matrix elements of the local hamiltonian
to find the symmetry matrices `rot_mat` needed for the global-to-local
transformation of the basis set for correlated orbitals
The converter will analyze the matrix elements of the local Hamiltonian
to find the symmetry matrices `rot_mat` needed for the global-to-local
transformation of the basis set for correlated orbitals
(see section :ref:`hdfstructure`).
The matrices are obtained by finding the unitary transformations that diagonalize
:math:`\langle w_i | H_I(\mathbf{R}=0,0,0) | w_j \rangle`, where :math:`I` runs
over the correlated shells and `i,j` belong to the same shell (more details elsewhere...).
If two correlated shells are defined as equivalent in :file:`seedname.inp`,
then the corresponding eigenvalues have to match within a threshold of 10\ :sup:`-5`,
otherwise the converter will produce an error/warning.
otherwise the converter will produce an error/warning.
If this happens, please carefully check your data in :file:`seedname_hr.dat`.
This method might fail in non-trivial cases (i.e., more than one correlated
shell is present) when there are some degenerate eigenvalues:
@ -330,10 +327,10 @@ The current implementation of the Wannier90 Converter has some limitations:
* No charge self-consistency possible at the moment.
* Calculations with spin-orbit (``SO=1``) are not supported.
* The spin-polarized case (``SP=1``) is not yet tested.
* The post-processing routines in the module
:class:`SumkDFTTools <pytriqs.applications.dft.sumk_dft_tools.SumkDFTTools>`
were not tested with this converter.
* ``proj_mat_all`` are not used, so there are no projectors onto the
* The post-processing routines in the module
:class:`SumkDFTTools <dft.sumk_dft_tools.SumkDFTTools>`
were not tested with this converter.
* ``proj_mat_all`` are not used, so there are no projectors onto the
uncorrelated orbitals for now.
@ -344,14 +341,14 @@ The interface packages are written such that all the file operations
are done only on the master node. In general, the philosophy of the
package is that whenever you read in something from the archive
yourself, you have to *manually* broadcast it to the nodes. An
exception to this rule is when you use routines from :class:`SumkDFT <pytriqs.applications.dft.sumk_dft.SumkDFT>`
or :class:`SumkDFTTools <pytriqs.applications.dft.sumk_dft_tools.SumkDFTTools>`, where the broadcasting is done for you.
exception to this rule is when you use routines from :class:`SumkDFT <dft.sumk_dft.SumkDFT>`
or :class:`SumkDFTTools <dft.sumk_dft_tools.SumkDFTTools>`, where the broadcasting is done for you.
Interfaces to other packages
----------------------------
Because of the modular structure, it is straight forward to extend the :ref:`TRIQS <triqslibs:welcome>` package
in order to work with other band-structure codes. The only necessary requirement is that
Because of the modular structure, it is straight forward to extend the :ref:`TRIQS <triqslibs:welcome>` package
in order to work with other band-structure codes. The only necessary requirement is that
the interface module produces an hdf5 archive, that stores all the data in the specified
form. For the details of what data is stored in detail, see the
:ref:`hdfstructure` part of the reference manual.

View File

@ -5,287 +5,163 @@
Single-shot DFT+DMFT
====================
After having set up the hdf5 archive, we can now proceed to our first DFT+DMFT calculation.
It consists of initialization steps, and the actual DMFT self-consistency loop,
With the code snippets below you can build your own script and target
it to your needs. Little examples on :ref:`mixing <mixing>` and on
:ref:`restarting from a previous calculation <restartcalc>` at the end of this page
should also demonstrate how simple you can modify your own DMFT script. A full working
calculation for SrVO3 is discussed in the :ref:`next section <SrVO3>`.
After having set up the hdf5 archive, we can now do our DFT+DMFT calculation. It consists of
initialization steps, and the actual DMFT self-consistency loop, as is
discussed below.
Initialisation of the calculation
Initialization of the calculation
---------------------------------
Before doing the calculation, we have to intialize all the objects that we will need. The first thing is the
:class:`SumkDFT <pytriqs.applications.dft.sumk_dft.SumkDFT>` class. It contains all basic routines that are necessary to perform a summation in k-space
Before doing the actual calculation, we have to initialize all needed objects.
The first thing is the :class:`SumkDFT <dft.sumk_dft.SumkDFT>` class.
It contains all basic routines that are necessary to perform a summation in k-space
to get the local quantities used in DMFT. It is initialized by::
from pytriqs.applications.dft.sumk_dft import *
SK = SumkDFT(hdf_file = filename + '.h5')
from pytriqs.applications.dft.sumk_dft import *
SK = SumkDFT(hdf_file = filename + '.h5')
Setting up the impurity solver
------------------------------
The next step is to setup an impurity solver. There are different
solvers available within the :ref:`TRIQS <triqslibs:welcome>` framework. Below, we will discuss
the example of the hybridisation
solvers available within the :ref:`TRIQS <triqslibs:welcome>` framework.
E.g. for :ref:`SrVO3 <SrVO3>`, we will use the hybridization
expansion :ref:`CTHYB solver <triqscthyb:welcome>`. Later on, we will
see also the example of the Hubbard-I solver. They all have in common,
that they are called by a uniform command::
S.solve(params)
see also the example of the `Hubbard-I solver <http://ipht.cea.fr/triqs/applications/hubbardI>`_.
They all have in common, that they are called by an uniform command::
where `params` are the solver parameters and depend on the actual
solver that is used. Before going into the details of the solver, let
us discuss in the next section how to perform the DMFT loop using
the methods of :program:`dft_tools`, assuming that we have set up a
working solver instance.
S.solve(params)
where :emphasis:`params` are the solver parameters and depend on the actual
solver. Setting up the :ref:`CTHYB solver <triqscthyb:welcome>` for SrVO3 is
discussed on the :ref:`next page <SrVO3>`. Here, let us now perform the DMFT
loop using the methods of :program:`DFTTools`, assuming that we have already
set up a working solver instance.
Doing the DMFT loop
-------------------
Having initialized the SumK class and the Solver, we can proceed with the DMFT
loop itself. We have to set up the loop over DMFT
iterations and the self-consistency condition::
Having initialized the :class:`Sumk class <dft.sumk_dft.SumkDFT>`
and the solver, we can proceed with the actual DMFT part of the calculation.
We set up the loop over DMFT iterations and the self-consistency condition::
n_loops = 5
for iteration_number in range(n_loops) : # start the DMFT loop
n_loops = 15
for iteration_number in range(n_loops) : # start the DMFT loop
SK.set_Sigma([ S.Sigma ]) # Put self energy to the SumK class
chemical_potential = SK.calc_mu() # calculate the chemical potential for the given density
S.G_iw << SK.extract_G_loc()[0] # extract the local Green function
S.G0_iw << inverse(S.Sigma_iw + inverse(S.G_iw)) # finally get G0, the input for the solver
SK.set_Sigma([ S.Sigma ]) # Put self energy to the SumK class
chemical_potential = SK.calc_mu() # calculate the chemical potential for the given density
S.G_iw << SK.extract_G_loc()[0] # extract the local Green function
S.G0_iw << inverse(S.Sigma_iw + inverse(S.G_iw)) # finally get G0, the input for the Solver
S.solve(h_int=h_int, **p) # now solve the impurity problem
S.solve(h_int=h_int, **p) # now solve the impurity problem
dm = S.G_iw.density() # Density matrix of the impurity problem
SK.calc_dc(dm, U_interact=U, J_hund=J, orb=0, use_dc_formula=1) # Set the double counting term
SK.save(['chemical_potential','dc_imp','dc_energ']) # Save data in the hdf5 archive
dm = S.G_iw.density() # Density matrix of the impurity problem
SK.calc_dc(dm, U_interact=U, J_hund=J, orb=0, use_dc_formula=1) # Set the double counting term
SK.save(['chemical_potential','dc_imp','dc_energ']) # Save data in the hdf5 archive
These basic steps are enough to set up the basic DMFT Loop. For a detailed
description of the :class:`SumkDFT <pytriqs.applications.dft.sumk_dft.SumkDFT>` routines, see the reference
manual.
After
the self-consistency steps (extracting a new :math:`G^0(i\omega)`),
the Anderson impurity problem is solved.
Different to model calculations, we have to do a few
These steps are enough for a basic DMFT Loop.
After the self-consistency steps, which lead to a new :math:`G^0(i\omega)`,
the impurity solver is called. Different to model calculations, we have to do a few
more steps after this, because of the double-counting correction. We first
calculate the density of the impurity problem. Then, the routine `calc_dc`
calculate the density of the impurity problem. Then, the routine :meth:`calc_dc <dft.sumk_dft.SumkDFT.calc_dc>`
takes as parameters this density matrix, the Coulomb interaction, Hund's rule
coupling, and the type of double-counting that should be used. Possible values
for `use_dc_formula` are:
for :emphasis:`use_dc_formula` are:
* `0`: Full-localised limit
* `1`: DC formula as given in K. Held, Adv. Phys. 56, 829 (2007).
* `2`: Around-mean-field
* `0`: Full-localised limit (FLL)
* `1`: DC formula as given in K. Held, Adv. Phys. 56, 829 (2007).
* `2`: Around-mean-field (AMF)
At the end of the calculation, we can save the Greens function and self energy into a file::
from pytriqs.archive import HDFArchive
import pytriqs.utility.mpi as mpi
if mpi.is_master_node():
ar = HDFArchive("YourDFTDMFTcalculation.h5",'w')
ar["G"] = S.G_iw
ar["Sigma"] = S.Sigma_iw
This is it!
These are the essential steps to do a one-shot DFT+DMFT calculation.
For full charge-self consistent calculations, there are some more things
to consider, which we will see later on.
A full DFT+DMFT calculation
---------------------------
We will discuss now how to set up a full working calculation,
including setting up the CTHYB solver, and specifying some more parameters
in order to make the calculation more efficient. Here, we
will see a more advanced example, which is also suited for parallel
execution. For the convenience of the user, we provide also two
working python scripts in this documentation. One for a calculation
using Kanamori definitions (:download:`dft_dmft_cthyb.py
<images_scripts/dft_dmft_cthyb.py>`) and one with a
rotational-invariant Slater interaction Hamiltonian (:download:`dft_dmft_cthyb_slater.py
<images_scripts/dft_dmft_cthyb.py>`). The user has to adapt these
scripts to his own needs.
First, we load the necessary modules::
from pytriqs.applications.dft.sumk_dft import *
from pytriqs.gf.local import *
from pytriqs.archive import HDFArchive
from pytriqs.operators.util import *
from pytriqs.applications.impurity_solvers.cthyb import *
The last two lines load the modules for the construction of the CTHYB
solver.
Then we define some parameters::
dft_filename='SrVO3'
U = 4.0
J = 0.65
beta = 40
loops = 10 # Number of DMFT sc-loops
sigma_mix = 0.8 # Mixing factor of Sigma after solution of the AIM
dc_type = 1 # DC type: 0 FLL, 1 Held, 2 AMF
use_blocks = True # use bloc structure from DFT input
prec_mu = 0.0001
# Solver parameters
p = {}
p["length_cycle"] = 200
p["n_warmup_cycles"] = 2000
p["n_cycles"] = 20000
Most of these parameters are self-explanatory. The first,
`dft_filename`, gives the filename of the input files. For more
details on the solver parameters, we refer the user to
the :ref:`CTHYB solver <triqscthyb:welcome>` documentation.
We assume that the conversion to the hdf5 archive is already done. We
can check now in this archive, if previous runs are present, or if we have to start
from scratch::
previous_runs = 0
previous_present = False
if mpi.is_master_node():
f = HDFArchive(dft_filename+'.h5','a')
if 'dmft_output' in f:
ar = f['dmft_output']
if 'iterations' in ar:
previous_present = True
previous_runs = ar['iterations']
else:
f.create_group('dmft_output')
del f
previous_runs = mpi.bcast(previous_runs)
previous_present = mpi.bcast(previous_present)
You can see in this code snippet, that all results of this calculation
will be stored in a separate subgroup in the hdf5 file, called
`dmft_output`. Removing this subgroup allows you to reset your
calculation to the starting point easily.
Now we can use all this information to initialise the :class:`SumkDFT <pytriqs.applications.dft.sumk_dft.SumkDFT>` class::
SK = SumkDFT(hdf_file=dft_filename+'.h5',use_dft_blocks=use_blocks)
The next step is to initialise the :class:`Solver <pytriqs.applications.impurity_solvers.cthyb.Solver>` class. It consist
of two steps
#. Calculating the multi-band interaction matrix, and setting up the
interaction Hamiltonian
#. Setting up the solver class
The first step is done using methods of
the :ref:`TRIQS <triqslibs:welcome>` library::
n_orb = SK.corr_shells[0]['dim']
l = SK.corr_shells[0]['l']
spin_names = ["up","down"]
orb_names = [i for i in range(n_orb)]
# Use GF structure determined by DFT blocks:
gf_struct = SK.gf_struct_solver[0]
# Construct U matrix for density-density calculations:
Umat, Upmat = U_matrix_kanamori(n_orb=n_orb, U_int=U, J_hund=J)
We assumed here that we want to use an interaction matrix with
Kanamori definitions of :math:`U` and :math:`J`. For
other choices (Slater interaction matrix for instance), and other
parameters, we refer to the reference manual
of the :ref:`TRIQS <triqslibs:welcome>` library.
Next, we construct the Hamiltonian and the solver::
h_int = h_int_density(spin_names, orb_names, map_operator_structure=SK.sumk_to_solver[0], U=Umat, Uprime=Upmat)
S = Solver(beta=beta, gf_struct=gf_struct)
As you see, we take only density-density interactions into
account. Other choices for the Hamiltonian are
* h_int_kanamori
* h_int_slater
These two include full rotational invariant interactions. Again,
options can be found in the :ref:`TRIQS <triqslibs:welcome>` library
reference manual.
If there are previous runs stored in the hdf5 archive, we can now load the self energy
of the last iteration::
if previous_present:
from pytriqs.archive import HDFArchive
import pytriqs.utility.mpi as mpi
if mpi.is_master_node():
ar = HDFArchive(dft_filename+'.h5','a')
S.Sigma_iw << ar['dmft_output']['Sigma_iw']
del ar
ar = HDFArchive("YourDFTDMFTcalculation.h5",'w')
ar["G"] = S.G_iw
ar["Sigma"] = S.Sigma_iw
These are the essential steps necessary for a one-shot DFT+DMFT calculation.
For a detailed description of the :class:`SumkDFT <dft.sumk_dft.SumkDFT>`
routines, see the :ref:`reference manual <reference>`. To perform full charge self-consistent calculations, there
are some more things to consider, which we will see :ref:`later on <full_charge_selfcons>`.
.. _restartcalc:
Restarting a calculation
------------------------
Often only a few DMFT iterations are performed first, and thus, it is desirable to
carry out further iterations, e.g. to improve on the convergence. With a little modification
at the initialization stage (before the DMFT loop) it is possible to detect if previous runs
are present, or if the calculation should start from scratch::
previous_runs = 0
previous_present = False
if mpi.is_master_node():
f = HDFArchive(dft_filename+'.h5','a')
if 'dmft_output' in f:
ar = f['dmft_output']
if 'iterations' in ar:
previous_present = True
previous_runs = ar['iterations']
else:
f.create_group('dmft_output')
del f
previous_runs = mpi.bcast(previous_runs)
previous_present = mpi.bcast(previous_present)
You can see from this code snippet, that removing the subgroup :emphasis:`dmft_results` from the
hdf file has the effect of reseting the calculation to the starting point. If there are previous
runs stored in the hdf5 archive, we can now load the self energy, the chemical potential and
double counting values of the last iteration::
if previous_present:
if mpi.is_master_node():
ar = HDFArchive(dft_filename+'.h5','a')
S.Sigma_iw << ar['dmft_output']['Sigma_iw']
del ar
S.Sigma_iw << mpi.bcast(S.Sigma_iw)
chemical_potential,dc_imp,dc_energ = SK.load(['chemical_potential','dc_imp','dc_energ'])
S.Sigma_iw << mpi.bcast(S.Sigma_iw)
SK.set_mu(chemical_potential)
SK.set_dc(dc_imp,dc_energ)
SK.set_mu(chemical_potential)
SK.set_dc(dc_imp,dc_energ)
The data is loaded only on the master node, and therefore we broadcast it to the slave nodes.
Be careful when storing the :emphasis:`iteration_number` as we also have to add the previous
iteration count::
ar['dmft_output']['iterations'] = iteration_number + previous_runs
The self-energy is broadcast from the master node to the slave nodes. Also, the
last saved chemical potential and double counting values are read in and set.
.. _mixing:
Now we can go to the definition of the self-consistency step. It consists again
of the basic steps discussed in the previous section, with some additional
refinements::
for iteration_number in range(1,loops+1):
if mpi.is_master_node(): print "Iteration = ", iteration_number
SK.symm_deg_gf(S.Sigma_iw,orb=0) # symmetrise Sigma
SK.set_Sigma([ S.Sigma_iw ]) # put Sigma into the SumK class
chemical_potential = SK.calc_mu( precision = prec_mu ) # find the chemical potential for given density
S.G_iw << SK.extract_G_loc()[0] # calc the local Green function
mpi.report("Total charge of Gloc : %.6f"%S.G_iw.total_density())
# Init the DC term and the real part of Sigma, if no previous runs found:
if (iteration_number==1 and previous_present==False):
dm = S.G_iw.density()
SK.calc_dc(dm, U_interact = U, J_hund = J, orb = 0, use_dc_formula = dc_type)
S.Sigma_iw << SK.dc_imp[0]['up'][0,0]
# Calculate new G0_iw to input into the solver:
S.G0_iw << S.Sigma_iw + inverse(S.G_iw)
S.G0_iw << inverse(S.G0_iw)
Mixing
------
# Solve the impurity problem:
S.solve(h_int=h_int, **p)
# Solved. Now do post-solution stuff:
mpi.report("Total charge of impurity problem : %.6f"%S.G_iw.total_density())
# Now mix Sigma and G with factor sigma_mix, if wanted:
if (iteration_number>1 or previous_present):
if mpi.is_master_node():
ar = HDFArchive(dft_filename+'.h5','a')
mpi.report("Mixing Sigma and G with factor %s"%sigma_mix)
S.Sigma_iw << sigma_mix * S.Sigma_iw + (1.0-sigma_mix) * ar['dmft_output']['Sigma_iw']
S.G_iw << sigma_mix * S.G_iw + (1.0-sigma_mix) * ar['dmft_output']['G_iw']
del ar
S.G_iw << mpi.bcast(S.G_iw)
S.Sigma_iw << mpi.bcast(S.Sigma_iw)
# Write the final Sigma and G to the hdf5 archive:
if mpi.is_master_node():
ar = HDFArchive(dft_filename+'.h5','a')
ar['dmft_output']['iterations'] = iteration_number + previous_runs
ar['dmft_output']['G_0'] = S.G0_iw
ar['dmft_output']['G_tau'] = S.G_tau
ar['dmft_output']['G_iw'] = S.G_iw
ar['dmft_output']['Sigma_iw'] = S.Sigma_iw
del ar
In some cases a mixing of two consecutive self energies (or alternatively two hybridization
functions) can be necessary in order to ensure convergence::
# Set the new double counting:
dm = S.G_iw.density() # compute the density matrix of the impurity problem
SK.calc_dc(dm, U_interact = U, J_hund = J, orb = 0, use_dc_formula = dc_type)
mix = 0.8 # mixing factor
if (iteration_number>1 or previous_present):
if mpi.is_master_node():
ar = HDFArchive(dft_filename+'.h5','a')
mpi.report("Mixing Sigma and G with factor %s"%mix)
S.Sigma_iw << mix * S.Sigma_iw + (1.0-mix) * ar['dmft_output']['Sigma_iw']
S.G_iw << mix * S.G_iw + (1.0-mix) * ar['dmft_output']['G_iw']
del ar
S.G_iw << mpi.bcast(S.G_iw)
S.Sigma_iw << mpi.bcast(S.Sigma_iw)
# Save stuff into the dft_output group of hdf5 archive in case of rerun:
SK.save(['chemical_potential','dc_imp','dc_energ'])
This is all we need for the DFT+DMFT calculation. At the end, all results are stored in the hdf5 output file.
In this little piece of code, which should be placed after calling the solver, two consecutive
self energies are linearly mixed with the factor :emphasis:`mix`. Of course, it is possible
to implement more advanced mixing schemes (e.g. Broyden's methods), however, in most cases
simple linear mixing or even no mixing is sufficient for a reasonably fast convergence.

View File

@ -89,7 +89,7 @@ however there are also some differences. First difference is that we import the
The Hubbard-I solver is very fast and we do not need to take into account the DFT block structure or use any approximation for the *U*-matrix.
We load and convert the :program:`dmftproj` output and initialize the
:class:`SumkDFT <pytriqs.applications.dft.sumk_dft.SumkDFT>` class as described in :ref:`conversion` and
:class:`SumkDFT <dft.sumk_dft.SumkDFT>` class as described in :ref:`conversion` and
:ref:`singleshot` and then set up the Hubbard-I solver ::
S = Solver(beta = beta, l = l)
@ -206,7 +206,7 @@ symmetries::
Converter.convert_parpoj_input()
To get access to analysing tools we initialize the
:class:`SumkDFTTools <pytriqs.applications.dft.sumk_dft_tools.SumkDFTTools>` class ::
:class:`SumkDFTTools <dft.sumk_dft_tools.SumkDFTTools>` class ::
SK = SumkDFTTools(hdf_file=dft_filename+'.h5', use_dft_blocks=False)

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

View File

@ -6,10 +6,10 @@ from pytriqs.gf.local import *
from pytriqs.applications.dft.sumk_dft import *
dft_filename='SrVO3'
U = U.0
U = 4.0
J = 0.65
beta = 40
loops = 10 # Number of DMFT sc-loops
loops = 15 # Number of DMFT sc-loops
sigma_mix = 1.0 # Mixing factor of Sigma after solution of the AIM
delta_mix = 1.0 # Mixing factor of Delta as input for the AIM
dc_type = 1 # DC type: 0 FLL, 1 Held, 2 AMF
@ -20,9 +20,14 @@ h_field = 0.0
# Solver parameters
p = {}
p["max_time"] = -1
p["length_cycle"] = 50
p["n_warmup_cycles"] = 50
p["n_cycles"] = 5000
p["random_seed"] = 123 * mpi.rank + 567
p["length_cycle"] = 200
p["n_warmup_cycles"] = 100000
p["n_cycles"] = 1000000
p["perfrom_tail_fit"] = True
p["fit_max_moments"] = 4
p["fit_min_n"] = 30
p["fit_max_n"] = 60
# If conversion step was not done, we could do it here. Uncomment the lines it you want to do this.
#from pytriqs.applications.dft.converters.wien2k_converter import *
@ -141,6 +146,5 @@ for iteration_number in range(1,loops+1):
dm = S.G_iw.density() # compute the density matrix of the impurity problem
SK.calc_dc(dm, U_interact = U, J_hund = J, orb = 0, use_dc_formula = dc_type)
# Save stuff into the dft_output group of hdf5 archive in case of rerun:
# Save stuff into the user_data group of hdf5 archive in case of rerun:
SK.save(['chemical_potential','dc_imp','dc_energ'])

View File

@ -6,7 +6,7 @@ from pytriqs.gf.local import *
from pytriqs.applications.dft.sumk_dft import *
from pytriqs.applications.dft.converters.wien2k_converter import *
dft_filename='Gd_fcc'
dft_filename='SrVO3'
U = 9.6
J = 0.8
beta = 40
@ -21,9 +21,14 @@ h_field = 0.0
# Solver parameters
p = {}
p["max_time"] = -1
p["length_cycle"] = 50
p["n_warmup_cycles"] = 50
p["n_cycles"] = 5000
p["random_seed"] = 123 * mpi.rank + 567
p["length_cycle"] = 200
p["n_warmup_cycles"] = 100000
p["n_cycles"] = 1000000
p["perfrom_tail_fit"] = True
p["fit_max_moments"] = 4
p["fit_min_n"] = 30
p["fit_max_n"] = 60
# If conversion step was not done, we could do it here. Uncomment the lines it you want to do this.
#from pytriqs.applications.dft.converters.wien2k_converter import *
@ -144,5 +149,3 @@ for iteration_number in range(1,loops+1):
# Save stuff into the dft_output group of hdf5 archive in case of rerun:
SK.save(['chemical_potential','dc_imp','dc_energ'])

View File

@ -1,6 +1,6 @@
.. _Transport:
Transport calculations test
Transport calculations
============================
Formalism
@ -44,13 +44,13 @@ real-frequency self energy by doing an analytic continuation.
it is crucial to perform the analytic continuation in such a way that the obtained real frequency self energy
is accurate around the Fermi energy as low energy features strongly influence the final results!
Besides the self energy the Wien2k files read by the transport converter (:meth:`convert_transport_input <pytriqs.applications.dft.converters.wien2k_converter.Wien2kConverter.convert_transport_input>`) are:
Besides the self energy the Wien2k files read by the transport converter (:meth:`convert_transport_input <dft.converters.wien2k_converter.Wien2kConverter.convert_transport_input>`) are:
* :file:`.struct`: The lattice constants specified in the struct file are used to calculate the unit cell volume.
* :file:`.outputs`: In this file the k-point symmetries are given.
* :file:`.oubwin`: Contains the indices of the bands within the projected subspace (written by :program:`dmftproj`) for each k-point.
* :file:`.pmat`: This file is the output of the Wien2k optics package and contains the velocity (momentum) matrix elements between all bands in the desired energy
window for each k-point. How to use the optics package is described below.
* :file:`.h5`: The hdf5 archive has to be present and should contain the dft_input subgroup. Otherwise :meth:`convert_dft_input <pytriqs.applications.dft.converters.wien2k_converter.Wien2kConverter.convert_dft_input>` needs to be called before :meth:`convert_transport_input <pytriqs.applications.dft.converters.wien2k_converter.Wien2kConverter.convert_transport_input>`.
* :file:`.h5`: The hdf5 archive has to be present and should contain the dft_input subgroup. Otherwise :meth:`convert_dft_input <dft.converters.wien2k_converter.Wien2kConverter.convert_dft_input>` needs to be called before :meth:`convert_transport_input <dft.converters.wien2k_converter.Wien2kConverter.convert_transport_input>`.
Wien2k optics package
@ -84,7 +84,7 @@ First we have to read the Wien2k files and store the relevant information in the
SK = SumkDFTTools(hdf_file='case.h5', use_dft_blocks=True)
The converter :meth:`convert_transport_input <pytriqs.applications.dft.converters.wien2k_converter.Wien2kConverter.convert_transport_input>`
The converter :meth:`convert_transport_input <dft.converters.wien2k_converter.Wien2kConverter.convert_transport_input>`
reads the required data of the Wien2k output and stores it in the `dft_transp_input` subgroup of your hdf file.
Additionally we need to read and set the self energy, the chemical potential and the double counting::
@ -104,7 +104,7 @@ Here the transport distribution is calculated in :math:`xx` direction for the fr
To use the previously obtained self energy we set with_Sigma to True and the broadening to :math:`0.0`.
As we also want to calculate the Seebeck coefficient we have to include :math:`\Omega=0.0` in the mesh.
Note that the current version of the code repines the :math:`\Omega` values to the closest values on the self energy mesh.
For complete description of the input parameters see the :meth:`transport_distribution reference <pytriqs.applications.dft.sumk_dft_tools.SumkDFTTools.transport_distribution>`.
For complete description of the input parameters see the :meth:`transport_distribution reference <dft.sumk_dft_tools.SumkDFTTools.transport_distribution>`.
The resulting transport distribution is not automatically saved, but this can be easily achieved with::

View File

@ -1,11 +1,11 @@
.. index:: DFT Tools
.. index:: DFTTools
.. module:: pytriqs.applications.dft
.. _dfttools:
.. _dft:
DFT Tools
=========
DFTTools
========
This :ref:`TRIQS-based <triqslibs:welcome>`-based application is aimed
at ab-initio calculations for

View File

@ -1223,9 +1223,12 @@ class SumkDFT:
therefore calculated separately for each `k`-point.
Since in general n_orbitals depends on k, the calculation is done in the following order:
..math:: n_{tot} = \sum_{k} n(k),
with
..math:: n(k) = Tr G_{\nu\nu'}(k, i\omega_{n}).
.. math:: n_{tot} = \sum_{k} n(k),
with
.. math:: n(k) = Tr G_{\nu\nu'}(k, i\omega_{n}).
The calculation is done in the global coordinate system, if distinction is made between local/global.