mirror of
https://github.com/triqs/dft_tools
synced 2024-12-21 11:53:41 +01:00
Renamed everything from 'lda' to 'dft'
This commit is contained in:
parent
86caf32a78
commit
88f4105e5b
@ -1,11 +1,11 @@
|
||||
.. index:: tutorial on Ce within Hub.-I approximation
|
||||
|
||||
.. _LDADMFTtutorial:
|
||||
.. _DFTDMFTtutorial:
|
||||
|
||||
LDA+DMFT tutorial: Ce with Hubbard-I approximation
|
||||
DFT+DMFT tutorial: Ce with Hubbard-I approximation
|
||||
==================================================
|
||||
|
||||
In this tutorial we will perform LDA+DMFT :program:`Wien2k` calculations of the high-temperature :math:`\gamma`-phase of Ce employing the
|
||||
In this tutorial we will perform DFT+DMFT :program:`Wien2k` calculations of the high-temperature :math:`\gamma`-phase of Ce employing the
|
||||
Hubbard-I approximation for its localized *4f* shell.
|
||||
First we create the Wien2k :file:`Ce-gamma.struct` file as described in `Wien2k manual <http://www.wien2k.at/reg_user/textbooks/usersguide.pdf>`_
|
||||
for the :math:`\gamma`-Ce fcc structure with lattice parameter of 9.75 a.u.
|
||||
@ -61,7 +61,7 @@ This program produces the following files:
|
||||
|
||||
* :file:`Ce-gamma.ctqmcout` and :file:`Ce-gamma.symqmc` containing projector operators and symmetry operations for orthonormalized Wannier orbitals, respectively.
|
||||
* :file:`Ce-gamma.parproj` and :file:`Ce-gamma.sympar` containing projector operators and symmetry operations for uncorrelated states, respectively. These files are needed for projected density-of-states or spectral-function calculations.
|
||||
* :file:`Ce-gamma.oubwin` needed for the charge desity recalculation in the case of fully self-consistent LDA+DMFT run (see below).
|
||||
* :file:`Ce-gamma.oubwin` needed for the charge desity recalculation in the case of fully self-consistent DFT+DMFT run (see below).
|
||||
|
||||
Now we have all necessary input from :program:`Wien2k` for running DMFT calculations.
|
||||
|
||||
@ -73,18 +73,18 @@ Now we have all necessary input from :program:`Wien2k` for running DMFT calculat
|
||||
Hubbard-I calculations in TRIQS
|
||||
-------------------------------
|
||||
|
||||
In order to run LDA+DMFT calculations within Hubbard-I we need the corresponding python script, :ref:`Ce-gamma-script`.
|
||||
In order to run DFT+DMFT calculations within Hubbard-I we need the corresponding python script, :ref:`Ce-gamma-script`.
|
||||
It is generally similar to the script for the case of DMFT calculations with the CT-QMC solver (see :ref:`advanced`),
|
||||
however there are also some differences. First, instead of *pytriqs.applications.dft.solver_multiband* we import Hubbard-I solver ::
|
||||
|
||||
from pytriqs.applications.impurity_solvers.hubbard_I.hubbard_solver import Solver
|
||||
|
||||
The Hubbard-I solver is very fast and we do not need to take into account the LDA blocking structure or use any approximation for the *U*-matrix ::
|
||||
The Hubbard-I solver is very fast and we do not need to take into account the DFT blocking structure or use any approximation for the *U*-matrix ::
|
||||
|
||||
use_blocks = False # use bloc structure from LDA input
|
||||
use_blocks = False # use bloc structure from DFT input
|
||||
use_matrix = True # use the U matrix calculated from Slater coefficients instead of (U+2J, U, U-J)
|
||||
|
||||
We load and convert the :program:`dmftproj` output and initialize the *SumkLDA* class as described in :ref:`LDADMFTmain` and :ref:`advanced` and then set up the Hubbard-I solver ::
|
||||
We load and convert the :program:`dmftproj` output and initialize the *SumkDFT* class as described in :ref:`DFTDMFTmain` and :ref:`advanced` and then set up the Hubbard-I solver ::
|
||||
|
||||
|
||||
S = Solver(beta = beta, l = l)
|
||||
@ -96,7 +96,7 @@ The Hubbard-I initialization `Solver` has also optional parameters one may use:
|
||||
|
||||
* `n_msb`: the number of Matsubara frequencies used. The default is `n_msb=1025`.
|
||||
* `use_spin_orbit`: if set 'True' the solver is run with spin-orbit coupling
|
||||
included. To perform actual LDA+DMFT calculations with spin-orbit one should
|
||||
included. To perform actual DFT+DMFT calculations with spin-orbit one should
|
||||
also run :program:`Wien2k` and :program:`dmftproj` in spin-polarized mode and
|
||||
with spin-orbit included. By default, `use_spin_orbit=False`.
|
||||
|
||||
@ -127,11 +127,11 @@ Green's function and then save them in the hdf5 file .
|
||||
Then the double counting is recalculated and the correlation energy is computed with the Migdal formula and stored in hdf5.
|
||||
|
||||
Finally, we compute the modified charge density and save it as well as correlational correction to the total energy in
|
||||
:file:`Ce-gamma.qdmft` file, which is then read by :program:`lapw2` in the case of self-consistent LDA+DMFT calculations.
|
||||
:file:`Ce-gamma.qdmft` file, which is then read by :program:`lapw2` in the case of self-consistent DFT+DMFT calculations.
|
||||
|
||||
.. index:: running LDA+DMFT calculations
|
||||
.. index:: running DFT+DMFT calculations
|
||||
|
||||
Running LDA+DMFT calculations
|
||||
Running DFT+DMFT calculations
|
||||
-----------------------------
|
||||
|
||||
After having prepared the script one may run one-shot DMFT calculations by
|
||||
@ -148,12 +148,12 @@ enables MPI. The exact form of this command will, of course, depend on
|
||||
mpi-launcher installed in your system.
|
||||
|
||||
Instead of doing one-shot run one may also perform fully self-consistent
|
||||
LDA+DMFT calculations, as we will do in this tutorial. We launch these
|
||||
DFT+DMFT calculations, as we will do in this tutorial. We launch these
|
||||
calculations as follows ::
|
||||
|
||||
run_triqs -qdmft
|
||||
|
||||
where `-qdmft` flag turns on LDA+DMFT calculations with :program:`Wien2k`. We
|
||||
where `-qdmft` flag turns on DFT+DMFT calculations with :program:`Wien2k`. We
|
||||
use here the default convergence criterion in :program:`Wien2k` (convergence to
|
||||
0.1 mRy in energy).
|
||||
|
||||
@ -193,9 +193,9 @@ The corresponding script :ref:`Ce-gamma_DOS-script` contains several new paramet
|
||||
N_om=2001 # number of points on the real-energy axis mesh
|
||||
broadening = 0.02 # broadening (the imaginary shift of the real-energy mesh)
|
||||
|
||||
Then one needs to load projectors needed for calculations of corresponding projected densities of states, as well as corresponding symmetries. To get access to analysing tools we initialize the `SumkLDATools` class ::
|
||||
Then one needs to load projectors needed for calculations of corresponding projected densities of states, as well as corresponding symmetries. To get access to analysing tools we initialize the `SumkDFTTools` class ::
|
||||
|
||||
SK = SumkLDATools(hdf_file=lda_filename+'.h5', use_lda_blocks=False)
|
||||
SK = SumkDFTTools(hdf_file=dft_filename+'.h5', use_dft_blocks=False)
|
||||
|
||||
Then after the solver initialization and setting up atomic levels we compute atomic Green's function and self-energy on the real axis::
|
||||
|
||||
|
@ -1,8 +1,8 @@
|
||||
from pytriqs.applications.dft.sumk_lda import *
|
||||
from pytriqs.applications.dft.sumk_dft import *
|
||||
from pytriqs.applications.dft.converters.wien2k_converter import *
|
||||
from pytriqs.applications.impurity_solvers.hubbard_I.hubbard_solver import Solver
|
||||
|
||||
lda_filename = 'Ce-gamma'
|
||||
dft_filename = 'Ce-gamma'
|
||||
beta = 40
|
||||
U_int = 6.00
|
||||
J_hund = 0.70
|
||||
@ -10,17 +10,17 @@ Loops = 2 # Number of DMFT sc-loops
|
||||
Mix = 0.7 # Mixing factor in QMC
|
||||
# 1.0 ... all from imp; 0.0 ... all from Gloc
|
||||
DC_type = 0 # 0...FLL, 1...Held, 2... AMF, 3...Lichtenstein
|
||||
useBlocs = False # use bloc structure from LDA input
|
||||
useBlocs = False # use bloc structure from DFT input
|
||||
useMatrix = True # use the U matrix calculated from Slater coefficients instead of (U+2J, U, U-J)
|
||||
Natomic = 1
|
||||
|
||||
HDFfilename = lda_filename+'.h5'
|
||||
HDFfilename = dft_filename+'.h5'
|
||||
|
||||
use_val= U_int * (Natomic - 0.5) - J_hund * (Natomic * 0.5 - 0.5)
|
||||
|
||||
# Convert DMFT input:
|
||||
# Can be commented after the first run
|
||||
Converter = Wien2kConverter(filename=lda_filename)
|
||||
Converter = Wien2kConverter(filename=dft_filename)
|
||||
Converter.convert_dmft_input()
|
||||
|
||||
#check if there are previous runs:
|
||||
@ -42,7 +42,7 @@ previous_runs = mpi.bcast(previous_runs)
|
||||
previous_present = mpi.bcast(previous_present)
|
||||
|
||||
# Init the SumK class
|
||||
SK=SumkLDA(hdf_file=lda_filename+'.h5',use_lda_blocks=False)
|
||||
SK=SumkDFT(hdf_file=dft_filename+'.h5',use_dft_blocks=False)
|
||||
|
||||
Norb = SK.corr_shells[0][3]
|
||||
l = SK.corr_shells[0][2]
|
||||
@ -154,7 +154,7 @@ for Iteration_Number in range(1,Loops+1):
|
||||
# find exact chemical potential
|
||||
if (SK.density_required):
|
||||
SK.chemical_potential = SK.find_mu( precision = 0.000001 )
|
||||
dN,d = SK.calc_density_correction(filename = lda_filename+'.qdmft')
|
||||
dN,d = SK.calc_density_correction(filename = dft_filename+'.qdmft')
|
||||
|
||||
mpi.report("Trace of Density Matrix: %s"%d)
|
||||
|
||||
@ -166,6 +166,6 @@ if (mpi.is_master_node()):
|
||||
DCenerg = ar['DCenerg%s'%itn]
|
||||
del ar
|
||||
correnerg -= DCenerg[0]
|
||||
f=open(lda_filename+'.qdmft','a')
|
||||
f=open(dft_filename+'.qdmft','a')
|
||||
f.write("%.16f\n"%correnerg)
|
||||
f.close()
|
||||
|
@ -1,27 +1,27 @@
|
||||
from pytriqs.applications.dft.sumk_lda_tools import *
|
||||
from pytriqs.applications.dft.sumk_dft_tools import *
|
||||
from pytriqs.applications.dft.converters.wien2k_converter import *
|
||||
from pytriqs.applications.impurity_solvers.hubbard_I.hubbard_solver import Solver
|
||||
|
||||
# Creates the data directory, cd into it:
|
||||
#Prepare_Run_Directory(DirectoryName = "Ce-Gamma")
|
||||
lda_filename = 'Ce-gamma'
|
||||
dft_filename = 'Ce-gamma'
|
||||
Beta = 40
|
||||
U_int = 6.00
|
||||
J_hund = 0.70
|
||||
DC_type = 0 # 0...FLL, 1...Held, 2... AMF, 3...Lichtenstein
|
||||
load_previous = True # load previous results
|
||||
useBlocs = False # use bloc structure from LDA input
|
||||
useBlocs = False # use bloc structure from DFT input
|
||||
useMatrix = True # use the U matrix calculated from Slater coefficients instead of (U+2J, U, U-J)
|
||||
ommin=-4.0
|
||||
ommax=6.0
|
||||
N_om=2001
|
||||
broadening = 0.02
|
||||
|
||||
HDFfilename = lda_filename+'.h5'
|
||||
HDFfilename = dft_filename+'.h5'
|
||||
|
||||
# Convert DMFT input:
|
||||
# Can be commented after the first run
|
||||
Converter = Wien2kConverter(filename=lda_filename,repacking=True)
|
||||
Converter = Wien2kConverter(filename=dft_filename,repacking=True)
|
||||
Converter.convert_dmft_input()
|
||||
Converter.convert_parproj_input()
|
||||
|
||||
@ -48,7 +48,7 @@ previous_present = mpi.bcast(previous_present)
|
||||
# from a converted h5 archive.
|
||||
|
||||
# Init the SumK class
|
||||
SK = SumkLDATools(hdf_file=lda_filename+'.h5',use_lda_blocks=False)
|
||||
SK = SumkDFTTools(hdf_file=dft_filename+'.h5',use_dft_blocks=False)
|
||||
|
||||
|
||||
if (mpi.is_master_node()):
|
||||
|
@ -1,33 +1,33 @@
|
||||
.. index:: LDA+DMFT calculation
|
||||
.. index:: DFT+DMFT calculation
|
||||
|
||||
.. _LDADMFTmain:
|
||||
.. _DFTDMFTmain:
|
||||
|
||||
The LDA+DMFT calculation
|
||||
The DFT+DMFT calculation
|
||||
========================
|
||||
|
||||
After having set up the hdf5 arxive, we can now do our LDA+DMFT calculation. It consists of
|
||||
After having set up the hdf5 arxive, we can now do our DFT+DMFT calculation. It consists of
|
||||
initialisation steps, and the actual DMFT self consistency loop.
|
||||
|
||||
.. index:: initialisation of LDA+DMFT
|
||||
.. index:: initialisation of DFT+DMFT
|
||||
|
||||
Initialisation of the calculation
|
||||
---------------------------------
|
||||
|
||||
Before doing the calculation, we have to intialize all the objects that we will need. The first thing is the
|
||||
:class:`SumkLDA` class. It contains all basic routines that are necessary to perform a summation in k-space
|
||||
:class:`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_lda import *
|
||||
SK = SumkLDA(hdf_file = filename)
|
||||
from pytriqs.applications.dft.sumk_dft import *
|
||||
SK = SumkDFT(hdf_file = filename)
|
||||
|
||||
The only necessary parameter is the filename of the hdf5 archive. In addition, there are some optional parameters:
|
||||
|
||||
* `mu`: The chemical potential at initialization. This value is only used if no other value is found in the hdf5 arxive. The default value is 0.0.
|
||||
* `h_field`: External magnetic field. The default value is 0.0.
|
||||
* `use_lda_blocks`: If true, the structure of the density matrix is analysed at initialisation, and non-zero matrix elements
|
||||
* `use_dft_blocks`: If true, the structure of the density matrix is analysed at initialisation, and non-zero matrix elements
|
||||
are identified. The DMFT calculation is then restricted to these matrix elements, yielding a more efficient solution of the
|
||||
local interaction problem. Degeneracies in orbital and spin space are also identified and stored for later use. The default value is `False`.
|
||||
* `lda_data`, `symmcorr_data`, `parproj_data`, `symmpar_data`, `bands_data`: These string variables define the subgroups in the hdf5 arxive,
|
||||
* `dft_data`, `symmcorr_data`, `parproj_data`, `symmpar_data`, `bands_data`: These string variables define the subgroups in the hdf5 arxive,
|
||||
where the corresponding information is stored. The default values are consistent with those in :ref:`interfacetowien`.
|
||||
|
||||
At initialisation, the necessary data is read from the hdf5 file. If a calculation is restarted based on a previous hdf5 file, information on
|
||||
@ -47,7 +47,7 @@ The necessary parameters are the inverse temperature `beta`, the Coulomb interac
|
||||
and the number of orbitals `n_orb`. There are again several optional parameters that allow the tailoring of the local Hamiltonian to
|
||||
specific needs. They are:
|
||||
|
||||
* `gf_struct`: The block structure of the local density matrix given in the format calculated by :class:`SumkLDA`.
|
||||
* `gf_struct`: The block structure of the local density matrix given in the format calculated by :class:`SumkDFT`.
|
||||
* `map`: If `gf_struct` is given as parameter, `map` also must be given. This is the mapping from the block structure to a general
|
||||
up/down structure.
|
||||
|
||||
@ -76,11 +76,11 @@ parameters for which default values are set. Generally, they should be reset for
|
||||
* `length_cycle`: Number of CTQMC moves per one cycle.
|
||||
* `n_warmup_cycles`: Number of initial CTQMC cycles before measurements start. Usually of order of 10000, sometimes needs to be increased significantly.
|
||||
|
||||
Most of above parameters can be taken directly from the :class:`SumkLDA` class, without defining them by hand. We will see a specific example
|
||||
Most of above parameters can be taken directly from the :class:`SumkDFT` class, without defining them by hand. We will see a specific example
|
||||
at the end of this tutorial.
|
||||
|
||||
|
||||
.. index:: LDA+DMFT loop, one-shot calculation
|
||||
.. index:: DFT+DMFT loop, one-shot calculation
|
||||
|
||||
Doing the DMFT loop
|
||||
-------------------
|
||||
@ -104,7 +104,7 @@ set up the loop over DMFT iterations and the self-consistency condition::
|
||||
SK.set_dc( dm, U_interact = U, J_hund = J, use_dc_formula = 0) # Set the double counting term
|
||||
SK.save() # save everything to the hdf5 arxive
|
||||
|
||||
These basic steps are enough to set up the basic DMFT Loop. For a detailed description of the :class:`SumkLDA` routines,
|
||||
These basic steps are enough to set up the basic DMFT Loop. For a detailed description of the :class:`SumkDFT` routines,
|
||||
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
|
||||
calculate the density of the impurity problem. Then, the routine `set_dc` takes as parameters this density matrix, the
|
||||
@ -119,11 +119,11 @@ At the end of the calculation, we can save the Greens function and self energy i
|
||||
from pytriqs.archive import HDFArchive
|
||||
import pytriqs.utility.mpi as mpi
|
||||
if mpi.is_master_node():
|
||||
ar = HDFArchive("YourLDADMFTcalculation.h5",'w')
|
||||
ar = HDFArchive("YourDFTDMFTcalculation.h5",'w')
|
||||
ar["G"] = S.G
|
||||
ar["Sigma"] = S.Sigma
|
||||
|
||||
This is it!
|
||||
|
||||
These are the essential steps to do a one-shot LDA+DMFT calculation. For full charge-self consistent calculations, there are some more things
|
||||
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.
|
@ -7,7 +7,7 @@ Normally, one wants to adjust some more parameters in order to make the calculat
|
||||
will see a more advanced example, which is also suited for parallel execution.
|
||||
First, we load the necessary modules::
|
||||
|
||||
from pytriqs.applications.dft.sumk_lda import *
|
||||
from pytriqs.applications.dft.sumk_dft import *
|
||||
from pytriqs.applications.dft.converters.wien2k_converter import *
|
||||
from pytriqs.applications.dft.solver_multiband import *
|
||||
from pytriqs.gf.local import *
|
||||
@ -15,7 +15,7 @@ First, we load the necessary modules::
|
||||
|
||||
Then we define some parameters::
|
||||
|
||||
lda_filename='srvo3'
|
||||
dft_filename='srvo3'
|
||||
U = 2.7
|
||||
J = 0.65
|
||||
beta = 40
|
||||
@ -23,7 +23,7 @@ Then we define some parameters::
|
||||
mix = 0.8 # 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
|
||||
use_blocks = True # use bloc structure from LDA input
|
||||
use_blocks = True # use bloc structure from DFT input
|
||||
use_matrix = False # True: Slater parameters, False: Kanamori parameters U+2J, U, U-J
|
||||
use_spinflip = False # use the full rotational invariant interaction?
|
||||
prec_mu = 0.0001
|
||||
@ -32,10 +32,10 @@ Then we define some parameters::
|
||||
warming_iterations = 2000
|
||||
|
||||
|
||||
Most of these parameters are self-explaining. The first, `lda_filename`, gives the filename of the input files.
|
||||
Most of these parameters are self-explaining. The first, `dft_filename`, gives the filename of the input files.
|
||||
The next step, as described in the previous section, is to convert the input files::
|
||||
|
||||
Converter = Wien2kConverter(filename=lda_filename, repacking=True)
|
||||
Converter = Wien2kConverter(filename=dft_filename, repacking=True)
|
||||
Converter.convert_dmft_input()
|
||||
mpi.barrier()
|
||||
|
||||
@ -46,7 +46,7 @@ from scratch::
|
||||
previous_runs = 0
|
||||
previous_present = False
|
||||
if mpi.is_master_node():
|
||||
ar = HDFArchive(lda_filename+'.h5','a')
|
||||
ar = HDFArchive(dft_filename+'.h5','a')
|
||||
if 'iterations' in ar:
|
||||
previous_present = True
|
||||
previous_runs = ar['iterations']
|
||||
@ -56,18 +56,18 @@ from scratch::
|
||||
# if previous runs are present, no need for recalculating the bloc structure:
|
||||
calc_blocs = use_blocks and (not previous_present)
|
||||
|
||||
Now we can use all this information to initialise the :class:`SumkLDA` class::
|
||||
Now we can use all this information to initialise the :class:`SumkDFT` class::
|
||||
|
||||
SK=SumkLDA(hdf_file=lda_filename+'.h5',use_lda_blocks=calc_blocs)
|
||||
SK=SumkDFT(hdf_file=dft_filename+'.h5',use_dft_blocks=calc_blocs)
|
||||
|
||||
If there was a previous run, we know already about the block structure, and therefore `UseLDABlocs` is set to `False`.
|
||||
If there was a previous run, we know already about the block structure, and therefore `UseDFTBlocs` is set to `False`.
|
||||
The next step is to initialise the Solver::
|
||||
|
||||
Norb = SK.corr_shells[0][3]
|
||||
l = SK.corr_shells[0][2]
|
||||
S = SolverMultiBand(beta=beta,n_orb=Norb,gf_struct=SK.gf_struct_solver[0],map=SK.map[0])
|
||||
|
||||
As we can see, many options of the solver are set by properties of the :class:`SumkLDA` class, so we don't have
|
||||
As we can see, many options of the solver are set by properties of the :class:`SumkDFT` class, so we don't have
|
||||
to set them manually.
|
||||
|
||||
If there are previous runs stored in the hdf5 archive, we can now load the self energy
|
||||
@ -75,7 +75,7 @@ of the last iteration::
|
||||
|
||||
if (previous_present):
|
||||
if (mpi.is_master_node()):
|
||||
ar = HDFArchive(lda_filename+'.h5','a')
|
||||
ar = HDFArchive(dft_filename+'.h5','a')
|
||||
S.Sigma << ar['SigmaImFreq']
|
||||
del ar
|
||||
S.Sigma = mpi.bcast(S.Sigma)
|
||||
@ -123,7 +123,7 @@ previous section, with some additional refinement::
|
||||
# Now mix Sigma and G with factor Mix, if wanted:
|
||||
if ((iteration_number>1) or (previous_present)):
|
||||
if (mpi.is_master_node()):
|
||||
ar = HDFArchive(lda_filename+'.h5','a')
|
||||
ar = HDFArchive(dft_filename+'.h5','a')
|
||||
mpi.report("Mixing Sigma and G with factor %s"%mix)
|
||||
S.Sigma << mix * S.Sigma + (1.0-mix) * ar['Sigma']
|
||||
S.G << mix * S.G + (1.0-mix) * ar['GF']
|
||||
@ -133,7 +133,7 @@ previous section, with some additional refinement::
|
||||
|
||||
# Write the final Sigma and G to the hdf5 archive:
|
||||
if (mpi.is_master_node()):
|
||||
ar = HDFArchive(lda_filename+'.h5','a')
|
||||
ar = HDFArchive(dft_filename+'.h5','a')
|
||||
ar['iterations'] = previous_runs + iteration_number
|
||||
ar['Sigma'] = S.Sigma
|
||||
ar['GF'] = S.G
|
||||
@ -146,7 +146,7 @@ previous section, with some additional refinement::
|
||||
#Save stuff:
|
||||
SK.save()
|
||||
|
||||
This is all we need for the LDA+DMFT calculation. At the end, all results are stored in the hdf5 output file.
|
||||
This is all we need for the DFT+DMFT calculation. At the end, all results are stored in the hdf5 output file.
|
||||
|
||||
|
||||
|
||||
|
@ -11,10 +11,10 @@ This section explains how to use some tools of the package in order to analyse t
|
||||
There are methods included e.g. in the :program:`ALPS` package, which can be used for these purposes. But
|
||||
be careful: All these methods have to be used very carefully!
|
||||
|
||||
The tools for analysis can be found in an extension of the :class:`SumkLDA` class and are
|
||||
loaded by importing the module :class:`SumkLDATools`::
|
||||
The tools for analysis can be found in an extension of the :class:`SumkDFT` class and are
|
||||
loaded by importing the module :class:`SumkDFTTools`::
|
||||
|
||||
from pytriqs.applications.dft.sumk_lda_tools import *
|
||||
from pytriqs.applications.dft.sumk_dft_tools import *
|
||||
|
||||
There are two practical tools for which you do not need a self energy on the real axis, namely the:
|
||||
|
||||
@ -26,12 +26,12 @@ The self energy on the real frequency axis is necessary in computing the:
|
||||
* momentum-integrated spectral function including self-energy effects,
|
||||
* momentum-resolved spectral function (i.e. ARPES).
|
||||
|
||||
The initialisation of the class is equivalent to that of the :class:`SumkLDA`
|
||||
The initialisation of the class is equivalent to that of the :class:`SumkDFT`
|
||||
class::
|
||||
|
||||
SK = SumkLDATools(hdf_file = filename)
|
||||
SK = SumkDFTTools(hdf_file = filename)
|
||||
|
||||
Note that all routines available in :class:`SumkLDA` are also available here.
|
||||
Note that all routines available in :class:`SumkDFT` are also available here.
|
||||
|
||||
Routines without real-frequency self energy
|
||||
-------------------------------------------
|
||||
@ -72,7 +72,7 @@ Most conveniently, it is stored as a real frequency :class:`BlockGf` object in t
|
||||
|
||||
You may also store it in text files. If all blocks of your self energy are of dimension 1x1, you store them in `fname_(block)0.dat` files. Here `(block)` is a block name (`up`, `down`, or combined `ud`). In the case when you have matrix blocks, you store them in `(i)_(j).dat` files, where `(i)` and `(j)` are the orbital indices, in the `fname_(block)` directory.
|
||||
|
||||
This self energy is loaded and put into the :class:`SumkLDA` class by the function::
|
||||
This self energy is loaded and put into the :class:`SumkDFT` class by the function::
|
||||
|
||||
SK.constr_Sigma_real_axis(filename, hdf=True, hdf_dataset='SigmaReFreq',n_om=0)
|
||||
|
||||
|
@ -13,7 +13,7 @@ A (not so) quick tour
|
||||
:maxdepth: 1
|
||||
|
||||
interface
|
||||
LDADMFTmain
|
||||
DFTDMFTmain
|
||||
advanced
|
||||
analysis
|
||||
selfcons
|
||||
@ -45,6 +45,6 @@ This is the reference manual for the python routines.
|
||||
:maxdepth: 2
|
||||
|
||||
reference/h5structure
|
||||
reference/sumk_lda
|
||||
reference/sumk_dft
|
||||
|
||||
|
||||
|
@ -33,11 +33,11 @@ an hdf5 arxive, named :file:`material_of_interest.h5`, where all the data is sto
|
||||
|
||||
There are three optional parameters to the Constructor:
|
||||
|
||||
* `lda_subgrp`: We store all data in subgroups of the hdf5 arxive. For the main data
|
||||
* `dft_subgrp`: We store all data in subgroups of the hdf5 arxive. For the main data
|
||||
that is needed for the DMFT loop, we use the subgroup specified by this optional parameter.
|
||||
The default value `lda_input` is used as the subgroup name.
|
||||
The default value `dft_input` is used as the subgroup name.
|
||||
* `symmcorr_subgrp`: In this subgroup we store all the data for applying the symmetry
|
||||
operations in the DMFT loop. The default value is `lda_symmcorr_input`.
|
||||
operations in the DMFT loop. The default value is `dft_symmcorr_input`.
|
||||
* `repacking`: If true, and the hdf5 file already exists, the system command :program:`h5repack`
|
||||
is invoked. This command ensures a minimal file size of the hdf5
|
||||
file. The default value is `False`. If you wish to use this, ensure
|
||||
@ -48,13 +48,13 @@ hdf5 arxive by::
|
||||
|
||||
Converter.convert_dmft_input()
|
||||
|
||||
This reads all the data, and stores it in the subgroup `lda_subgrp`, as discussed above.
|
||||
This reads all the data, and stores it in the subgroup `dft_subgrp`, as discussed above.
|
||||
In this step, the files :file:`material_of_interest.ctqmcout` and :file:`material_of_interest.symqmc`
|
||||
have to be present in the working directory.
|
||||
|
||||
After this step, all the necessary information for the DMFT loop is stored in the hdf5 arxive, where
|
||||
the string variable `Converter.hdf_file` gives the file name of the arxive.
|
||||
You can now proceed with :ref:`LDADMFTmain`.
|
||||
You can now proceed with :ref:`DFTDMFTmain`.
|
||||
|
||||
|
||||
Data for post-processing
|
||||
@ -70,8 +70,8 @@ of :program:`Wien2k`, you have to use::
|
||||
This reads the files :file:`material_of_interest.parproj` and :file:`material_of_interest.sympar`.
|
||||
Again, there are two optional parameters
|
||||
|
||||
* `parproj_subgrp`: The subgroup for partial projectors data. The default value is `lda_parproj_input`.
|
||||
* `symmpar_subgrp`: The subgroup for symmetry operations data. The default value is `lda_symmpar_input`.
|
||||
* `parproj_subgrp`: The subgroup for partial projectors data. The default value is `dft_parproj_input`.
|
||||
* `symmpar_subgrp`: The subgroup for symmetry operations data. The default value is `dft_symmpar_input`.
|
||||
|
||||
Another routine of the class allows to read the input for plotting the momentum-resolved
|
||||
spectral function. It is done by::
|
||||
@ -79,7 +79,7 @@ spectral function. It is done by::
|
||||
Converter.convert_bands_input()
|
||||
|
||||
The optional parameter that controls where the data is stored is `bands_subgrp`,
|
||||
with the default value `lda_bands_input`.
|
||||
with the default value `dft_bands_input`.
|
||||
|
||||
After having converted this input, you can further proceed with the :ref:`analysis`.
|
||||
|
||||
@ -87,7 +87,7 @@ MPI issues
|
||||
----------
|
||||
|
||||
The interface package is written such that all the operations are done only on the master node.
|
||||
The broadcasting to the nodes has to be done by hand. The :class:`SumkLDA`, described in the
|
||||
The broadcasting to the nodes has to be done by hand. The :class:`SumkDFT`, described in the
|
||||
following section, takes care of this automatically.
|
||||
|
||||
Interfaces to other packages
|
||||
|
@ -11,7 +11,7 @@ hdf5 data format
|
||||
|
||||
In order to be used with the DMFT routines, the following data needs to be provided in the hdf5 file. It contains a lot of information in order to perform DMFT calculations for all kinds of situations, e.g. d-p Hamiltonians, more than one correlated atomic shell, or using symmetry operations for the k-summation. We store all data in subgroups of the hdf5 arxive:
|
||||
|
||||
:program:`Main data`: There needs to be one subgroup for the main data of the calculation. The default name of this group is `lda_input`. Its contents are
|
||||
:program:`Main data`: There needs to be one subgroup for the main data of the calculation. The default name of this group is `dft_input`. Its contents are
|
||||
|
||||
* `energy_unit`, numpy.float. The unit of energy used for the calculation
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
|
||||
SumK_LDA
|
||||
SumK_DFT
|
||||
========
|
||||
|
||||
.. toctree::
|
@ -12,15 +12,15 @@ changes in the charge density due to correlation effects. In the following, we d
|
||||
:program:`TRIQS` tools in combination with the :program:`Wien2k` program, although an extension to other
|
||||
codes is also possible.
|
||||
|
||||
We can use the DMFT script as introduced in sections :ref:`LDADMFTmain` and :ref:`advanced`, with a few simple
|
||||
We can use the DMFT script as introduced in sections :ref:`DFTDMFTmain` and :ref:`advanced`, with a few simple
|
||||
modifications. First, in order to be compatible with the :program:`Wien2k` standards, the DMFT script has to be
|
||||
named ``case.py``, where `case` is the name of the :program:`Wien2k` calculation, see the section
|
||||
:ref:`interfacetowien` for details. We can then set the variable `lda_filename` dynamically::
|
||||
:ref:`interfacetowien` for details. We can then set the variable `dft_filename` dynamically::
|
||||
|
||||
import os
|
||||
lda_filename = os.getcwd().rpartition('/')[2]
|
||||
dft_filename = os.getcwd().rpartition('/')[2]
|
||||
|
||||
This sets the `lda_filename` to the name of the current directory. The remainder of the script is identical to
|
||||
This sets the `dft_filename` to the name of the current directory. The remainder of the script is identical to
|
||||
that for one-shot calculations. Only at the very end do we have to calculate the modified charge density,
|
||||
and store it in a format such that :program:`Wien2k` can read it. Therefore, after the DMFT loop that we saw in the
|
||||
previous section, we symmetrise the self energy, and recalculate the impurity Green function::
|
||||
@ -35,12 +35,12 @@ Now we calculate the modified charge density::
|
||||
# find exact chemical potential
|
||||
SK.put_Sigma(Sigma_imp = [ S.Sigma ])
|
||||
chemical_potential = SK.find_mu( precision = 0.000001 )
|
||||
dN, d = SK.calc_density_correction(filename = lda_filename+'.qdmft')
|
||||
dN, d = SK.calc_density_correction(filename = dft_filename+'.qdmft')
|
||||
SK.save()
|
||||
|
||||
First we find the chemical potential with high precision, and after that the routine
|
||||
``SK.calc_density_correction(filename)`` calculates the density matrix including correlation effects. The result
|
||||
is stored in the file `lda_filename.qdmft`, which is later read by the :program:`Wien2k` program. The last statement saves
|
||||
is stored in the file `dft_filename.qdmft`, which is later read by the :program:`Wien2k` program. The last statement saves
|
||||
the chemical potential into the hdf5 archive.
|
||||
We need also the correlation energy, which we evaluate by the Migdal formula::
|
||||
|
||||
@ -53,7 +53,7 @@ From this value, we substract the double counting energy::
|
||||
and save this value too::
|
||||
|
||||
if (mpi.is_master_node()):
|
||||
f=open(lda_filename+'.qdmft','a')
|
||||
f=open(dft_filename+'.qdmft','a')
|
||||
f.write("%.16f\n"%correnerg)
|
||||
f.close()
|
||||
|
||||
@ -83,5 +83,5 @@ For practical purposes, you keep the number of DMFT loops within one DFT cycle l
|
||||
unstable convergence, you have to adjust the parameters such as
|
||||
`loops`, `mix`, or `Delta_mix` to improve the convergence.
|
||||
|
||||
In the next section, :ref:`LDADMFTtutorial`, we will see in a detailed
|
||||
In the next section, :ref:`DFTDMFTtutorial`, we will see in a detailed
|
||||
example how such a self consistent calculation is performed.
|
||||
|
@ -4,11 +4,11 @@ from pytriqs.operators import *
|
||||
from pytriqs.archive import HDFArchive
|
||||
from pytriqs.applications.impurity_solvers.cthyb import *
|
||||
from pytriqs.gf.local import *
|
||||
from pytriqs.applications.dft.sumk_lda import *
|
||||
from pytriqs.applications.dft.sumk_dft import *
|
||||
from pytriqs.applications.dft.converters.wien2k_converter import *
|
||||
from pytriqs.applications.dft.solver_multiband import *
|
||||
|
||||
lda_filename='Gd_fcc'
|
||||
dft_filename='Gd_fcc'
|
||||
U = 9.6
|
||||
J = 0.8
|
||||
beta = 40
|
||||
@ -16,7 +16,7 @@ loops = 10 # 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 = 0 # DC type: 0 FLL, 1 Held, 2 AMF
|
||||
use_blocks = True # use bloc structure from LDA input
|
||||
use_blocks = True # use bloc structure from DFT input
|
||||
prec_mu = 0.0001
|
||||
|
||||
# Solver parameters
|
||||
@ -29,14 +29,14 @@ p["length_cycle"] = 50
|
||||
p["n_warmup_cycles"] = 50
|
||||
p["n_cycles"] = 5000
|
||||
|
||||
Converter = Wien2kConverter(filename=lda_filename, repacking=True)
|
||||
Converter = Wien2kConverter(filename=dft_filename, repacking=True)
|
||||
Converter.convert_dmft_input()
|
||||
mpi.barrier()
|
||||
|
||||
previous_runs = 0
|
||||
previous_present = False
|
||||
if mpi.is_master_node():
|
||||
f = HDFArchive(lda_filename+'.h5','a')
|
||||
f = HDFArchive(dft_filename+'.h5','a')
|
||||
if 'dmft_output' in f:
|
||||
ar = f['dmft_output']
|
||||
if 'iterations' in ar:
|
||||
@ -50,7 +50,7 @@ previous_present = mpi.bcast(previous_present)
|
||||
# if previous runs are present, no need for recalculating the bloc structure:
|
||||
calc_blocs = use_blocks and (not previous_present)
|
||||
|
||||
SK=SumkLDA(hdf_file=lda_filename+'.h5',use_lda_blocks=calc_blocs)
|
||||
SK=SumkDFT(hdf_file=dft_filename+'.h5',use_dft_blocks=calc_blocs)
|
||||
|
||||
n_orb = SK.corr_shells[0][3]
|
||||
l = SK.corr_shells[0][2]
|
||||
@ -68,7 +68,7 @@ S = Solver(beta=beta, gf_struct=gf_struct)
|
||||
|
||||
if (previous_present):
|
||||
if (mpi.is_master_node()):
|
||||
S.Sigma_iw << HDFArchive(lda_filename+'.h5','a')['dmft_output']['Sigma_iw']
|
||||
S.Sigma_iw << HDFArchive(dft_filename+'.h5','a')['dmft_output']['Sigma_iw']
|
||||
S.Sigma_iw = mpi.bcast(S.Sigma_iw)
|
||||
|
||||
for iteration_number in range(1,loops+1):
|
||||
@ -90,7 +90,7 @@ for iteration_number in range(1,loops+1):
|
||||
if (mpi.is_master_node()):
|
||||
# We can do a mixing of Delta in order to stabilize the DMFT iterations:
|
||||
S.G0_iw << S.Sigma_iw + inverse(S.G_iw)
|
||||
ar = HDFArchive(lda_filename+'.h5','a')['dmft_output']
|
||||
ar = HDFArchive(dft_filename+'.h5','a')['dmft_output']
|
||||
if ((iteration_number>1) or (previous_present)):
|
||||
mpi.report("Mixing input Delta with factor %s"%delta_mix)
|
||||
Delta = (delta_mix * delta(S.G0_iw)) + (1.0-delta_mix) * ar['Delta_iw']
|
||||
@ -111,7 +111,7 @@ for iteration_number in range(1,loops+1):
|
||||
# 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(lda_filename+'.h5','a')['dmft_output']
|
||||
ar = HDFArchive(dft_filename+'.h5','a')['dmft_output']
|
||||
mpi.report("Mixing Sigma and G with factor %s"%sigma_mix)
|
||||
S.Sigma_iw << sigma_mix * S.Sigma_iw + (1.0-sigma_mix) * ar['Sigma_iw']
|
||||
S.G_iw << sigma_mix * S.G_iw + (1.0-sigma_mix) * ar['G_iw']
|
||||
@ -121,7 +121,7 @@ for iteration_number in range(1,loops+1):
|
||||
|
||||
# Write the final Sigma and G to the hdf5 archive:
|
||||
if (mpi.is_master_node()):
|
||||
ar = HDFArchive(lda_filename+'.h5','a')
|
||||
ar = HDFArchive(dft_filename+'.h5','a')
|
||||
ar['iterations'] = previous_runs + iteration_number
|
||||
ar['Sigma_iw'] = S.Sigma_iw
|
||||
ar['G_iw'] = S.G_iw
|
||||
@ -135,6 +135,6 @@ for iteration_number in range(1,loops+1):
|
||||
SK.save()
|
||||
|
||||
if mpi.is_master_node():
|
||||
ar = HDFArchive("ldadmft.h5",'w')
|
||||
ar = HDFArchive("dftdmft.h5",'w')
|
||||
ar["G_iw"] = S.G_iw
|
||||
ar["Sigma_iw"] = S.Sigma_iw
|
||||
|
@ -1,4 +1,4 @@
|
||||
* remove inequiv_shells from sumk_lda, modify update_archive scripts
|
||||
* remove inequiv_shells from sumk_dft, modify update_archive scripts
|
||||
|
||||
==========================
|
||||
Substitutions:
|
||||
@ -30,9 +30,9 @@ SymmCorr -> dft_symmcorr_input
|
||||
SumK_LDA_ParProj -> dft_parproj_input
|
||||
SymmPar -> dft_symmpar_input
|
||||
|
||||
def __init__(self, filename, lda_subgrp = 'SumK_LDA', symm_subgrp = 'SymmCorr', repacking = False):
|
||||
def __init__(self, filename, dft_subgrp = 'SumK_LDA', symm_subgrp = 'SymmCorr', repacking = False):
|
||||
-->
|
||||
def __init__(self, filename, lda_subgrp = 'dft_input', symm_subgrp = 'dft_symm_input', repacking = False):
|
||||
def __init__(self, filename, dft_subgrp = 'dft_input', symm_subgrp = 'dft_symm_input', repacking = False):
|
||||
|
||||
declare all groupnames in init
|
||||
|
||||
|
@ -20,13 +20,13 @@
|
||||
#
|
||||
################################################################################
|
||||
|
||||
from sumk_lda import SumkLDA
|
||||
from sumk_dft import SumkDFT
|
||||
from symmetry import Symmetry
|
||||
from sumk_lda_tools import SumkLDATools
|
||||
from sumk_dft_tools import SumkDFTTools
|
||||
from U_matrix import *
|
||||
from converters import *
|
||||
|
||||
__all__=['SumkLDA','Symmetry','SumkLDATools','Wien2kConverter','HkConverter',
|
||||
__all__=['SumkDFT','Symmetry','SumkDFTTools','Wien2kConverter','HkConverter',
|
||||
'U_J_to_radial_integrals', 'U_matrix', 'U_matrix_kanamori',
|
||||
'angular_matrix_element', 'clebsch_gordan', 'cubic_names', 'eg_submatrix',
|
||||
'reduce_4index_to_2index', 'spherical_to_cubic', 't2g_submatrix',
|
||||
|
@ -28,7 +28,7 @@
|
||||
sk = R.next()
|
||||
|
||||
except StopIteration : # a more explicit error if the file is corrupted.
|
||||
raise "SumkLDA.read_Sigma_ME : reading mesh failed!"
|
||||
raise "SumkDFT.read_Sigma_ME : reading mesh failed!"
|
||||
R.close()
|
||||
|
||||
# check whether the mesh is uniform
|
||||
@ -58,7 +58,7 @@
|
||||
isig = R.next()
|
||||
g.data[iom,iL,iR]=rsig+1j*isig
|
||||
except StopIteration : # a more explicit error if the file is corrupted.
|
||||
raise "SumkLDA.read_Sigma_ME : reading Sigma from file failed!"
|
||||
raise "SumkDFT.read_Sigma_ME : reading Sigma from file failed!"
|
||||
R.close()
|
||||
|
||||
|
||||
|
@ -7,13 +7,13 @@ if len(sys.argv) < 2:
|
||||
sys.exit()
|
||||
|
||||
print """
|
||||
This script is to remove any SumkLDA generated output from the h5 archive
|
||||
This script is to remove any SumkDFT generated output from the h5 archive
|
||||
and to restore it to the original post-converter state.
|
||||
"""
|
||||
|
||||
filename = sys.argv[1]
|
||||
A = h5py.File(filename)
|
||||
for group in ['lda_output','dmft_output']:
|
||||
for group in ['dft_output','dmft_output']:
|
||||
if group in A: del(A[group])
|
||||
A.close()
|
||||
|
||||
|
@ -29,18 +29,18 @@ from converter_tools import *
|
||||
|
||||
class HkConverter(ConverterTools):
|
||||
"""
|
||||
Conversion from general H(k) file to an hdf5 file that can be used as input for the SumK_LDA class.
|
||||
Conversion from general H(k) file to an hdf5 file that can be used as input for the SumKDFT class.
|
||||
"""
|
||||
|
||||
def __init__(self, hk_file, hdf_file, lda_subgrp = 'lda_input', symmcorr_subgrp = 'lda_symmcorr_input', repacking = False):
|
||||
def __init__(self, hk_file, hdf_file, dft_subgrp = 'dft_input', symmcorr_subgrp = 'dft_symmcorr_input', repacking = False):
|
||||
"""
|
||||
Init of the class.
|
||||
"""
|
||||
|
||||
assert type(hk_file)==StringType,"hk_file must be a filename"
|
||||
self.hdf_file = hdf_file
|
||||
self.lda_file = hk_file
|
||||
self.lda_subgrp = lda_subgrp
|
||||
self.dft_file = hk_file
|
||||
self.dft_subgrp = dft_subgrp
|
||||
self.symmcorr_subgrp = symmcorr_subgrp
|
||||
self.fortran_to_replace = {'D':'E', '(':' ', ')':' ', ',':' '}
|
||||
|
||||
@ -57,10 +57,10 @@ class HkConverter(ConverterTools):
|
||||
|
||||
# Read and write only on the master node
|
||||
if not (mpi.is_master_node()): return
|
||||
mpi.report("Reading input from %s..."%self.lda_file)
|
||||
mpi.report("Reading input from %s..."%self.dft_file)
|
||||
|
||||
# R is a generator : each R.Next() will return the next number in the file
|
||||
R = ConverterTools.read_fortran_file(self,self.lda_file,self.fortran_to_replace)
|
||||
R = ConverterTools.read_fortran_file(self,self.dft_file,self.fortran_to_replace)
|
||||
try:
|
||||
energy_unit = 1.0 # the energy conversion factor is 1.0, we assume eV in files
|
||||
n_k = int(R.next()) # read the number of k points
|
||||
@ -188,16 +188,16 @@ class HkConverter(ConverterTools):
|
||||
things_to_set = ['n_shells','shells','n_corr_shells','corr_shells','n_spin_blocs','n_orbitals','n_k','SO','SP','energy_unit']
|
||||
for it in things_to_set: setattr(self,it,locals()[it])
|
||||
except StopIteration : # a more explicit error if the file is corrupted.
|
||||
raise "HK Converter : reading file lda_file failed!"
|
||||
raise "HK Converter : reading file dft_file failed!"
|
||||
|
||||
R.close()
|
||||
|
||||
# Save to the HDF5:
|
||||
ar = HDFArchive(self.hdf_file,'a')
|
||||
if not (self.lda_subgrp in ar): ar.create_group(self.lda_subgrp)
|
||||
if not (self.dft_subgrp in ar): ar.create_group(self.dft_subgrp)
|
||||
things_to_save = ['energy_unit','n_k','k_dep_projection','SP','SO','charge_below','density_required',
|
||||
'symm_op','n_shells','shells','n_corr_shells','corr_shells','use_rotations','rot_mat',
|
||||
'rot_mat_time_inv','n_reps','dim_reps','T','n_orbitals','proj_mat','bz_weights','hopping',
|
||||
'n_inequiv_shells', 'corr_to_inequiv', 'inequiv_to_corr']
|
||||
for it in things_to_save: ar[self.lda_subgrp][it] = locals()[it]
|
||||
for it in things_to_save: ar[self.dft_subgrp][it] = locals()[it]
|
||||
del ar
|
||||
|
@ -28,24 +28,24 @@ from converter_tools import *
|
||||
|
||||
class Wien2kConverter(ConverterTools):
|
||||
"""
|
||||
Conversion from Wien2k output to an hdf5 file that can be used as input for the SumkLDA class.
|
||||
Conversion from Wien2k output to an hdf5 file that can be used as input for the SumkDFT class.
|
||||
"""
|
||||
|
||||
def __init__(self, filename, lda_subgrp = 'lda_input', symmcorr_subgrp = 'lda_symmcorr_input',
|
||||
parproj_subgrp='lda_parproj_input', symmpar_subgrp='lda_symmpar_input',
|
||||
bands_subgrp = 'lda_bands_input', repacking = False):
|
||||
def __init__(self, filename, dft_subgrp = 'dft_input', symmcorr_subgrp = 'dft_symmcorr_input',
|
||||
parproj_subgrp='dft_parproj_input', symmpar_subgrp='dft_symmpar_input',
|
||||
bands_subgrp = 'dft_bands_input', repacking = False):
|
||||
"""
|
||||
Init of the class. Variable filename gives the root of all filenames, e.g. case.ctqmcout, case.h5, and so on.
|
||||
"""
|
||||
|
||||
assert type(filename)==StringType, "Please provide the LDA files' base name as a string."
|
||||
assert type(filename)==StringType, "Please provide the DFT files' base name as a string."
|
||||
self.hdf_file = filename+'.h5'
|
||||
self.lda_file = filename+'.ctqmcout'
|
||||
self.dft_file = filename+'.ctqmcout'
|
||||
self.symmcorr_file = filename+'.symqmc'
|
||||
self.parproj_file = filename+'.parproj'
|
||||
self.symmpar_file = filename+'.sympar'
|
||||
self.band_file = filename+'.outband'
|
||||
self.lda_subgrp = lda_subgrp
|
||||
self.dft_subgrp = dft_subgrp
|
||||
self.symmcorr_subgrp = symmcorr_subgrp
|
||||
self.parproj_subgrp = parproj_subgrp
|
||||
self.symmpar_subgrp = symmpar_subgrp
|
||||
@ -66,10 +66,10 @@ class Wien2kConverter(ConverterTools):
|
||||
|
||||
# Read and write only on the master node
|
||||
if not (mpi.is_master_node()): return
|
||||
mpi.report("Reading input from %s..."%self.lda_file)
|
||||
mpi.report("Reading input from %s..."%self.dft_file)
|
||||
|
||||
# R is a generator : each R.Next() will return the next number in the file
|
||||
R = ConverterTools.read_fortran_file(self,self.lda_file,self.fortran_to_replace)
|
||||
R = ConverterTools.read_fortran_file(self,self.dft_file,self.fortran_to_replace)
|
||||
try:
|
||||
energy_unit = R.next() # read the energy convertion factor
|
||||
n_k = int(R.next()) # read the number of k points
|
||||
@ -182,20 +182,20 @@ class Wien2kConverter(ConverterTools):
|
||||
things_to_set = ['n_shells','shells','n_corr_shells','corr_shells','n_spin_blocs','n_orbitals','n_k','SO','SP','energy_unit']
|
||||
for it in things_to_set: setattr(self,it,locals()[it])
|
||||
except StopIteration : # a more explicit error if the file is corrupted.
|
||||
raise "Wien2k_converter : reading file lda_file failed!"
|
||||
raise "Wien2k_converter : reading file %s failed!"%filename
|
||||
|
||||
R.close()
|
||||
# Reading done!
|
||||
|
||||
# Save it to the HDF:
|
||||
ar = HDFArchive(self.hdf_file,'a')
|
||||
if not (self.lda_subgrp in ar): ar.create_group(self.lda_subgrp)
|
||||
if not (self.dft_subgrp in ar): ar.create_group(self.dft_subgrp)
|
||||
# The subgroup containing the data. If it does not exist, it is created. If it exists, the data is overwritten!
|
||||
things_to_save = ['energy_unit','n_k','k_dep_projection','SP','SO','charge_below','density_required',
|
||||
'symm_op','n_shells','shells','n_corr_shells','corr_shells','use_rotations','rot_mat',
|
||||
'rot_mat_time_inv','n_reps','dim_reps','T','n_orbitals','proj_mat','bz_weights','hopping',
|
||||
'n_inequiv_shells', 'corr_to_inequiv', 'inequiv_to_corr']
|
||||
for it in things_to_save: ar[self.lda_subgrp][it] = locals()[it]
|
||||
for it in things_to_save: ar[self.dft_subgrp][it] = locals()[it]
|
||||
del ar
|
||||
|
||||
# Symmetries are used, so now convert symmetry information for *correlated* orbitals:
|
||||
|
@ -1,5 +1,5 @@
|
||||
def lattice_gf(self, ik, mu, iw_or_w="iw", beta=40, broadening, mesh=None, with_Sigma=True, with_dc=True):
|
||||
"""Calculates the lattice Green function from the LDA hopping and the self energy at k-point number ik
|
||||
"""Calculates the lattice Green function from the DFT hopping and the self energy at k-point number ik
|
||||
and chemical potential mu."""
|
||||
|
||||
ntoi = self.spin_names_to_ind[self.SO]
|
||||
|
@ -28,13 +28,13 @@ import pytriqs.utility.mpi as mpi
|
||||
from pytriqs.archive import *
|
||||
from symmetry import *
|
||||
|
||||
class SumkLDA:
|
||||
class SumkDFT:
|
||||
"""This class provides a general SumK method for combining ab-initio code and pytriqs."""
|
||||
|
||||
|
||||
def __init__(self, hdf_file, mu = 0.0, h_field = 0.0, use_lda_blocks = False,
|
||||
lda_data = 'lda_input', symmcorr_data = 'lda_symmcorr_input', parproj_data = 'lda_parproj_input',
|
||||
symmpar_data = 'lda_symmpar_input', bands_data = 'lda_bands_input', lda_output = 'lda_output'):
|
||||
def __init__(self, hdf_file, mu = 0.0, h_field = 0.0, use_dft_blocks = False,
|
||||
dft_data = 'dft_input', symmcorr_data = 'dft_symmcorr_input', parproj_data = 'dft_parproj_input',
|
||||
symmpar_data = 'dft_symmpar_input', bands_data = 'dft_bands_input', dft_output = 'dft_output'):
|
||||
"""
|
||||
Initialises the class from data previously stored into an HDF5
|
||||
"""
|
||||
@ -43,12 +43,12 @@ class SumkLDA:
|
||||
mpi.report("Give a string for the HDF5 filename to read the input!")
|
||||
else:
|
||||
self.hdf_file = hdf_file
|
||||
self.lda_data = lda_data
|
||||
self.dft_data = dft_data
|
||||
self.symmcorr_data = symmcorr_data
|
||||
self.parproj_data = parproj_data
|
||||
self.symmpar_data = symmpar_data
|
||||
self.bands_data = bands_data
|
||||
self.lda_output = lda_output
|
||||
self.dft_output = dft_output
|
||||
self.G_upfold = None
|
||||
self.h_field = h_field
|
||||
|
||||
@ -57,7 +57,7 @@ class SumkLDA:
|
||||
'symm_op','n_shells','shells','n_corr_shells','corr_shells','use_rotations','rot_mat',
|
||||
'rot_mat_time_inv','n_reps','dim_reps','T','n_orbitals','proj_mat','bz_weights','hopping',
|
||||
'n_inequiv_shells', 'corr_to_inequiv', 'inequiv_to_corr']
|
||||
self.subgroup_present, self.value_read = self.read_input_from_hdf(subgrp = self.lda_data, things_to_read = things_to_read)
|
||||
self.subgroup_present, self.value_read = self.read_input_from_hdf(subgrp = self.dft_data, things_to_read = things_to_read)
|
||||
|
||||
if self.SO and (abs(self.h_field) > 0.000001):
|
||||
self.h_field = 0.0
|
||||
@ -79,7 +79,7 @@ class SumkLDA:
|
||||
#-----
|
||||
# If these quantities are not in HDF, set them up
|
||||
optional_things = ['gf_struct_solver','sumk_to_solver','solver_to_sumk','solver_to_sumk_block','chemical_potential','dc_imp','dc_energ','deg_shells']
|
||||
self.subgroup_present, self.value_read = self.read_input_from_hdf(subgrp = self.lda_output, things_to_read = [],
|
||||
self.subgroup_present, self.value_read = self.read_input_from_hdf(subgrp = self.dft_output, things_to_read = [],
|
||||
optional_things = optional_things)
|
||||
if (not self.subgroup_present) or (not self.value_read['gf_struct_solver']):
|
||||
# No gf_struct was stored in HDF, so first set a standard one:
|
||||
@ -112,7 +112,7 @@ class SumkLDA:
|
||||
self.symmcorr = Symmetry(hdf_file,subgroup=self.symmcorr_data)
|
||||
|
||||
# Analyse the block structure and determine the smallest blocks, if desired
|
||||
if use_lda_blocks: dm = self.analyse_block_structure()
|
||||
if use_dft_blocks: dm = self.analyse_block_structure()
|
||||
|
||||
# Now save new things to HDF5:
|
||||
# FIXME WHAT HAPPENS TO h_field? INPUT TO __INIT__? ADD TO OPTIONAL_THINGS?
|
||||
@ -175,10 +175,10 @@ class SumkLDA:
|
||||
|
||||
if not (mpi.is_master_node()): return # do nothing on nodes
|
||||
ar = HDFArchive(self.hdf_file,'a')
|
||||
if not self.lda_output in ar: ar.create_group(self.lda_output)
|
||||
if not self.dft_output in ar: ar.create_group(self.dft_output)
|
||||
for it in things_to_save:
|
||||
try:
|
||||
ar[self.lda_output][it] = getattr(self,it)
|
||||
ar[self.dft_output][it] = getattr(self,it)
|
||||
except:
|
||||
mpi.report("%s not found, and so not stored."%it)
|
||||
del ar
|
||||
@ -243,7 +243,7 @@ class SumkLDA:
|
||||
|
||||
|
||||
def lattice_gf_matsubara(self,ik,mu,beta=40,with_Sigma=True):
|
||||
"""Calculates the lattice Green function from the LDA hopping and the self energy at k-point number ik
|
||||
"""Calculates the lattice Green function from the DFT hopping and the self energy at k-point number ik
|
||||
and chemical potential mu."""
|
||||
|
||||
ntoi = self.spin_names_to_ind[self.SO]
|
||||
@ -617,9 +617,9 @@ class SumkLDA:
|
||||
|
||||
def set_dc(self,dens_mat,U_interact,J_hund,orb=0,use_dc_formula=0,use_val=None):
|
||||
"""Sets the double counting term for inequiv orbital orb:
|
||||
use_dc_formula = 0: LDA+U FLL double counting,
|
||||
use_dc_formula = 0: fully-localised limit (FLL),
|
||||
use_dc_formula = 1: Held's formula,
|
||||
use_dc_formula = 2: AMF.
|
||||
use_dc_formula = 2: around mean-field (AMF).
|
||||
Be sure that you are using the correct interaction Hamiltonian!"""
|
||||
|
||||
for icrsh in range(self.n_corr_shells):
|
@ -26,18 +26,18 @@ import pytriqs.utility.dichotomy as dichotomy
|
||||
from pytriqs.gf.local import *
|
||||
import pytriqs.utility.mpi as mpi
|
||||
from symmetry import *
|
||||
from sumk_lda import SumkLDA
|
||||
from sumk_dft import SumkDFT
|
||||
|
||||
class SumkLDATools(SumkLDA):
|
||||
"""Extends the SumkLDA class with some tools for analysing the data."""
|
||||
class SumkDFTTools(SumkDFT):
|
||||
"""Extends the SumkDFT class with some tools for analysing the data."""
|
||||
|
||||
|
||||
def __init__(self, hdf_file, mu = 0.0, h_field = 0.0, use_lda_blocks = False, lda_data = 'lda_input', symmcorr_data = 'lda_symmcorr_input',
|
||||
parproj_data = 'lda_parproj_input', symmpar_data = 'lda_symmpar_input', bands_data = 'lda_bands_input'):
|
||||
def __init__(self, hdf_file, mu = 0.0, h_field = 0.0, use_dft_blocks = False, dft_data = 'dft_input', symmcorr_data = 'dft_symmcorr_input',
|
||||
parproj_data = 'dft_parproj_input', symmpar_data = 'dft_symmpar_input', bands_data = 'dft_bands_input'):
|
||||
|
||||
self.G_upfold_refreq = None
|
||||
SumkLDA.__init__(self, hdf_file=hdf_file, mu=mu, h_field=h_field, use_lda_blocks=use_lda_blocks,
|
||||
lda_data=lda_data, symmcorr_data=symmcorr_data, parproj_data=parproj_data,
|
||||
SumkDFT.__init__(self, hdf_file=hdf_file, mu=mu, h_field=h_field, use_dft_blocks=use_dft_blocks,
|
||||
dft_data=dft_data, symmcorr_data=symmcorr_data, parproj_data=parproj_data,
|
||||
symmpar_data=symmpar_data, bands_data=bands_data)
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
from pytriqs.applications.dft.sumk_lda import *
|
||||
from pytriqs.applications.dft.sumk_dft import *
|
||||
from pytriqs.applications.dft.converters import Wien2kConverter
|
||||
from pytriqs.gf.local.block_gf import BlockGf
|
||||
from pytriqs.gf.local.gf_imfreq import GfImFreq
|
||||
@ -23,7 +23,7 @@ class TransBasis:
|
||||
Converter.convert_dmft_input()
|
||||
del Converter
|
||||
|
||||
self.SK = SumkLDA(hdf_file=hdf_datafile+'.h5',use_lda_blocks=False)
|
||||
self.SK = SumkDFT(hdf_file=hdf_datafile+'.h5',use_dft_blocks=False)
|
||||
else:
|
||||
self.SK = SK
|
||||
|
||||
|
@ -40,8 +40,8 @@ filename = sys.argv[1]
|
||||
A = h5py.File(filename)
|
||||
|
||||
# Rename groups
|
||||
old_to_new = {'SumK_LDA':'lda_input', 'SumK_LDA_ParProj':'lda_parproj_input',
|
||||
'SymmCorr':'lda_symmcorr_input', 'SymmPar':'lda_symmpar_input', 'SumK_LDA_Bands':'lda_bands_input'}
|
||||
old_to_new = {'SumK_LDA':'dft_input', 'SumK_LDA_ParProj':'dft_parproj_input',
|
||||
'SymmCorr':'dft_symmcorr_input', 'SymmPar':'dft_symmpar_input', 'SumK_LDA_Bands':'dft_bands_input'}
|
||||
|
||||
for old, new in old_to_new.iteritems():
|
||||
if old not in A.keys(): continue
|
||||
@ -49,27 +49,27 @@ for old, new in old_to_new.iteritems():
|
||||
A.copy(old,new)
|
||||
del(A[old])
|
||||
|
||||
# Move output items from lda_input to lda_output
|
||||
# Move output items from dft_input to dft_output
|
||||
move_to_output = ['gf_struct_solver','map_inv','map',
|
||||
'chemical_potential','dc_imp','dc_energ','deg_shells',
|
||||
'h_field']
|
||||
for obj in move_to_output:
|
||||
if obj in A['lda_input'].keys():
|
||||
if not 'lda_output' in A: A.create_group('lda_output')
|
||||
print "Moving %s to lda_output ..."%obj
|
||||
A.copy('lda_input/'+obj,'lda_output/'+obj)
|
||||
del(A['lda_input'][obj])
|
||||
if obj in A['dft_input'].keys():
|
||||
if not 'dft_output' in A: A.create_group('dft_output')
|
||||
print "Moving %s to dft_output ..."%obj
|
||||
A.copy('dft_input/'+obj,'dft_output/'+obj)
|
||||
del(A['dft_input'][obj])
|
||||
|
||||
# Add shell equivalency quantities
|
||||
B = A['lda_input']
|
||||
corr_shells = HDFArchive(filename,'r')['lda_input']['corr_shells']
|
||||
B = A['dft_input']
|
||||
corr_shells = HDFArchive(filename,'r')['dft_input']['corr_shells']
|
||||
equiv_shell_info = det_shell_equivalence(corr_shells)
|
||||
B['n_inequiv_shells'] = equiv_shell_info[0]
|
||||
B['corr_to_inequiv'] = equiv_shell_info[1]
|
||||
B['inequiv_to_corr'] = equiv_shell_info[2]
|
||||
|
||||
# Rename variables
|
||||
groups = ['lda_symmcorr_input','lda_symmpar_input']
|
||||
groups = ['dft_symmcorr_input','dft_symmpar_input']
|
||||
|
||||
for group in groups:
|
||||
if group not in A.keys(): continue
|
||||
|
@ -4,7 +4,7 @@ find_package(TriqsTest)
|
||||
FILE(COPY SrVO3.h5 SrVO3.ctqmcout SrVO3.symqmc SrVO3.sympar SrVO3.parproj hk_convert_hamiltonian.hk DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
|
||||
triqs_add_test_hdf(wien2k_convert " -p 1.e-6" )
|
||||
triqs_add_test_hdf(hk_convert " -p 1.e-6" )
|
||||
triqs_add_test_hdf(sumklda_basic " -d 1.e-6" )
|
||||
triqs_add_test_hdf(sumkdft_basic " -d 1.e-6" )
|
||||
triqs_add_test_hdf(srvo3_Gloc " -d 1.e-6" )
|
||||
triqs_add_test_hdf(U_mat " -d 1.e-6" )
|
||||
|
||||
|
BIN
test/SrVO3.h5
BIN
test/SrVO3.h5
Binary file not shown.
Binary file not shown.
@ -20,7 +20,7 @@
|
||||
################################################################################
|
||||
|
||||
from pytriqs.archive import *
|
||||
from pytriqs.applications.dft.sumk_lda import *
|
||||
from pytriqs.applications.dft.sumk_dft import *
|
||||
from pytriqs.applications.dft.converters.wien2k_converter import *
|
||||
from pytriqs.applications.impurity_solvers.cthyb import *
|
||||
from pytriqs.operators.hamiltonians import set_operator_structure
|
||||
@ -29,7 +29,7 @@ from pytriqs.operators.hamiltonians import set_operator_structure
|
||||
beta = 40
|
||||
|
||||
# Init the SumK class
|
||||
SK=SumkLDA(hdf_file='SrVO3.h5',use_lda_blocks=True)
|
||||
SK=SumkDFT(hdf_file='SrVO3.h5',use_dft_blocks=True)
|
||||
|
||||
num_orbitals = SK.corr_shells[0][3]
|
||||
l = SK.corr_shells[0][2]
|
||||
|
@ -21,15 +21,15 @@
|
||||
################################################################################
|
||||
|
||||
from pytriqs.archive import *
|
||||
from pytriqs.applications.dft.sumk_lda_tools import SumkLDATools
|
||||
from pytriqs.applications.dft.sumk_dft_tools import SumkDFTTools
|
||||
|
||||
|
||||
SK = SumkLDATools(hdf_file = 'SrVO3.h5')
|
||||
SK = SumkDFTTools(hdf_file = 'SrVO3.h5')
|
||||
|
||||
dm = SK.density_matrix(method = 'using_gf', beta = 40)
|
||||
dm_pc = SK.partial_charges(40)
|
||||
|
||||
ar = HDFArchive('sumklda_basic.output.h5','w')
|
||||
ar = HDFArchive('sumkdft_basic.output.h5','w')
|
||||
ar['dm'] = dm
|
||||
ar['dm_pc'] = dm_pc
|
||||
del ar
|
Binary file not shown.
Loading…
Reference in New Issue
Block a user