2014-11-18 11:30:26 +01:00
.. index :: DFT+DMFT calculation
2013-08-07 16:40:18 +02:00
2014-11-18 11:30:26 +01:00
.. _DFTDMFTmain:
2013-08-07 16:40:18 +02:00
2014-11-18 11:30:26 +01:00
The DFT+DMFT calculation
2013-08-07 16:40:18 +02:00
========================
2015-02-06 10:24:58 +01:00
After having set up the hdf5 archive, we can now do our DFT+DMFT calculation. It consists of
2013-08-07 16:40:18 +02:00
initialisation steps, and the actual DMFT self consistency loop.
2014-11-18 11:30:26 +01:00
.. index :: initialisation of DFT+DMFT
2013-08-07 16:40:18 +02:00
Initialisation of the calculation
---------------------------------
Before doing the calculation, we have to intialize all the objects that we will need. The first thing is the
2014-11-18 11:30:26 +01:00
:class: `SumkDFT` class. It contains all basic routines that are necessary to perform a summation in k-space
2013-08-07 16:40:18 +02:00
to get the local quantities used in DMFT. It is initialized by::
2014-11-18 11:30:26 +01:00
from pytriqs.applications.dft.sumk_dft import *
SK = SumkDFT(hdf_file = filename)
2013-08-07 16:40:18 +02:00
The only necessary parameter is the filename of the hdf5 archive. In addition, there are some optional parameters:
2015-02-06 10:24:58 +01:00
* `mu` : The chemical potential at initialization. This value is only used if no other value is found in the hdf5 archive. The default value is 0.0.
2014-09-22 19:21:10 +02:00
* `h_field` : External magnetic field. The default value is 0.0.
2014-11-18 11:30:26 +01:00
* `use_dft_blocks` : If true, the structure of the density matrix is analysed at initialisation, and non-zero matrix elements
2013-08-07 16:40:18 +02:00
are identified. The DMFT calculation is then restricted to these matrix elements, yielding a more efficient solution of the
2014-09-22 19:21:10 +02:00
local interaction problem. Degeneracies in orbital and spin space are also identified and stored for later use. The default value is `False` .
2015-02-06 10:24:58 +01:00
* `dft_data` , `symmcorr_data` , `parproj_data` , `symmpar_data` , `bands_data` : These string variables define the subgroups in the hdf5 archive,
2014-09-22 19:21:10 +02:00
where the corresponding information is stored. The default values are consistent with those in :ref: `interfacetowien` .
2013-08-07 16:40:18 +02:00
2014-09-22 19:21:10 +02:00
At initialisation, the necessary data is read from the hdf5 file. If a calculation is restarted based on a previous hdf5 file, information on
degenerate shells, the block structure of the density matrix, the chemical potential, and double counting correction is also read in.
2013-08-07 16:40:18 +02:00
.. index :: Multiband solver
Setting up the Multi-Band Solver
--------------------------------
There is a module that helps setting up the multiband CTQMC solver. It is loaded and initialized by::
from pytriqs.applications.dft.solver_multiband import *
2014-01-21 16:49:04 +01:00
S = SolverMultiBand(beta, n_orb, gf_struct = SK.gf_struct_solver[0], map=SK.map[0])
2013-08-07 16:40:18 +02:00
The necessary parameters are the inverse temperature `beta` , the Coulomb interaction `U_interact` , the Hund's rule coupling `J_hund` ,
2014-09-22 19:21:10 +02:00
and the number of orbitals `n_orb` . There are again several optional parameters that allow the tailoring of the local Hamiltonian to
2013-08-07 16:40:18 +02:00
specific needs. They are:
2014-11-18 11:30:26 +01:00
* `gf_struct` : The block structure of the local density matrix given in the format calculated by :class: `SumkDFT` .
2014-09-22 19:21:10 +02:00
* `map` : If `gf_struct` is given as parameter, `map` also must be given. This is the mapping from the block structure to a general
2013-08-07 16:40:18 +02:00
up/down structure.
2014-01-21 16:49:04 +01:00
The solver method is called later by this statement::
2014-03-28 23:29:06 +01:00
S.solve(U_interact,J_hund,use_spinflip=False,use_matrix=True,
2014-09-22 19:21:10 +02:00
l=2,T=None, dim_reps=None, irep=None, n_cycles =10000,
2014-03-28 23:29:06 +01:00
length_cycle=200,n_warmup_cycles=1000)
2014-01-21 16:49:04 +01:00
2014-09-22 19:21:10 +02:00
The parameters for the Coulomb interaction `U_interact` and the Hund's coupling `J_hund` are necessary input parameters. The rest are optional
parameters for which default values are set. Generally, they should be reset for the problem at hand. Here is a description of the parameters:
2014-01-21 16:49:04 +01:00
2014-09-22 19:21:10 +02:00
* `use_matrix` : If `True` , the interaction matrix is calculated from Slater integrals, which are computed from `U_interact` and
2013-08-07 16:40:18 +02:00
`J_hund` . Otherwise, a Kanamori representation is used. Attention: We define the intraorbital interaction as
2014-03-31 19:23:13 +02:00
`U_interact` , the interorbital interaction for opposite spins as `U_interact-2*J_hund` , and interorbital for equal spins as
2014-09-22 19:21:10 +02:00
`U_interact-3*J_hund` .
* `T` : The matrix that transforms the interaction matrix from spherical harmonics to a symmetry-adapted basis. Only effective for Slater
parametrisation, i.e. `use_matrix=True` .
* `l` : The orbital quantum number. Again, only effective for Slater parametrisation, i.e. `use_matrix=True` .
2013-08-07 16:40:18 +02:00
* `use_spinflip` : If `True` , the full rotationally-invariant interaction is used. Otherwise, only density-density terms are
kept in the local Hamiltonian.
2014-09-22 19:21:10 +02:00
* `dim_reps` : If only a subset of the full d-shell is used as correlated orbtials, one can specify here the dimensions of all the subspaces
2013-08-07 16:40:18 +02:00
of the d-shell, i.e. t2g and eg. Only effective for Slater parametrisation.
* `irep` : The index in the list `dim_reps` of the subset that is used. Only effective for Slater parametrisation.
2014-09-22 19:21:10 +02:00
* `n_cycles` : Number of CTQMC cycles (a sequence of moves followed by a measurement) per core. The default value of 10000 is the minimum, and generally should be increased.
* `length_cycle` : Number of CTQMC moves per one cycle.
2014-03-28 23:29:06 +01:00
* `n_warmup_cycles` : Number of initial CTQMC cycles before measurements start. Usually of order of 10000, sometimes needs to be increased significantly.
2013-08-07 16:40:18 +02:00
2014-11-18 11:30:26 +01:00
Most of above parameters can be taken directly from the :class: `SumkDFT` class, without defining them by hand. We will see a specific example
2013-08-07 16:40:18 +02:00
at the end of this tutorial.
2014-11-18 11:30:26 +01:00
.. index :: DFT+DMFT loop, one-shot calculation
2013-08-07 16:40:18 +02:00
Doing the DMFT loop
-------------------
Having initialised the SumK class and the Solver, we can proceed with the DMFT loop itself. As explained in the tutorial, we have to
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
SK.put_Sigma(Sigma_imp = [ S.Sigma ]) # Put self energy to the SumK class
2014-12-03 23:12:39 +01:00
chemical_potential = SK.calc_mu() # calculate the chemical potential for the given density
S.G << SK.extract_G_loc()[0] # extract the local Green function
S.G0 << inverse(S.Sigma + inverse(S.G)) # finally get G0, the input for the Solver
2013-08-07 16:40:18 +02:00
2014-03-31 19:17:05 +02:00
S.solve(U_interact,J_hund,use_spinflip=False,use_matrix=True, # now solve the impurity problem
2014-09-22 19:21:10 +02:00
l=2,T=None, dim_reps=None, irep=None, n_cycles =10000,
2014-03-31 19:17:05 +02:00
length_cycle=200,n_warmup_cycles=1000)
2013-08-07 16:40:18 +02:00
2014-11-19 16:54:13 +01:00
dm = S.G.density() # Density matrix of the impurity problem
2014-12-03 23:12:39 +01:00
SK.calc_dc( dm, U_interact = U, J_hund = J, use_dc_formula = 0) # Set the double counting term
2014-11-19 16:54:13 +01:00
SK.save(['chemical_potential','dc_imp','dc_energ']) # Save data in the hdf5 archive
2013-08-07 16:40:18 +02:00
2014-11-18 11:30:26 +01:00
These basic steps are enough to set up the basic DMFT Loop. For a detailed description of the :class: `SumkDFT` routines,
2013-08-07 16:40:18 +02:00
see the reference manual. After the self-consistency steps, the solution of the Anderson impurity problem is calculation by CTQMC.
Different to model calculations, we have to do a few more steps after this, because of the double-counting correction. We first
2014-12-03 23:12:39 +01:00
calculate the density of the impurity problem. Then, the routine `calc_dc` takes as parameters this density matrix, the
2013-08-07 16:40:18 +02:00
Coulomb interaction, Hund's rule coupling, and the type of double-counting that should be used. Possible values for `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
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():
2014-11-18 11:30:26 +01:00
ar = HDFArchive("YourDFTDMFTcalculation.h5",'w')
2014-03-28 23:29:06 +01:00
ar["G"] = S.G
ar["Sigma"] = S.Sigma
2013-08-07 16:40:18 +02:00
This is it!
2014-11-18 11:30:26 +01:00
These are the essential steps to do a one-shot DFT+DMFT calculation. For full charge-self consistent calculations, there are some more things
2013-08-07 16:40:18 +02:00
to consider, which we will see later on.