3
0
mirror of https://github.com/triqs/dft_tools synced 2024-07-04 18:36:05 +02:00

Added a wrapper function set_Sigma for more standard API

This commit is contained in:
Priyanka Seth 2015-11-02 11:42:47 +01:00
parent 0a07681455
commit f93fd828c0
13 changed files with 18 additions and 17 deletions

View File

@ -77,7 +77,7 @@ for iteration_number in range(1,loops+1):
if mpi.is_master_node(): print "Iteration = ", iteration_number if mpi.is_master_node(): print "Iteration = ", iteration_number
SK.symm_deg_gf(S.Sigma_iw,orb=0) # symmetrise Sigma SK.symm_deg_gf(S.Sigma_iw,orb=0) # symmetrise Sigma
SK.put_Sigma(Sigma_imp = [ S.Sigma_iw ]) # put Sigma into the SumK class SK.set_Sigma([ S.Sigma_iw ]) # set Sigma into the SumK class
chemical_potential = SK.calc_mu( precision = prec_mu ) # find the chemical potential for given density 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 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()) mpi.report("Total charge of Gloc : %.6f"%S.G_iw.total_density())

View File

@ -64,9 +64,9 @@ where:
It is important that each data file has to contain three columns: the real frequency mesh, the real part and the imaginary part 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. 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 put the self energy into the `SK` object:: Finally, we set the self energy into the `SK` object::
SK.put_Sigma(Sigma_imp = [SigmaReFreq]) SK.set_Sigma([SigmaReFreq])
and additionally set the chemical potential and the double counting correction from the DMFT calculation:: and additionally set the chemical potential and the double counting correction from the DMFT calculation::
@ -96,7 +96,7 @@ the output is printed into the files
* `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, `(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 ouptput is returned by the function for a further usage in :program:`python`. otherwise, the output is returned by the function for a further usage in :program:`python`.
Partial charges Partial charges
--------------- ---------------
@ -104,7 +104,7 @@ Partial charges
Since we can calculate the partial charges directly from the Matsubara Green's functions, we also do not need a Since we can calculate the partial charges directly from the Matsubara Green's functions, we also do not need a
real frequency self energy for this purpose. The calculation is done by:: real frequency self energy for this purpose. The calculation is done by::
SK.put_Sigma(Sigma_imp = SigmaImFreq) SK.set_Sigma(SigmaImFreq)
dm = SK.partial_charges(beta=40.0, with_Sigma=True, with_dc=True) dm = SK.partial_charges(beta=40.0, with_Sigma=True, with_dc=True)
which calculates the partial charges using the self energy, double counting, and chemical potential as set in the which calculates the partial charges using the self energy, double counting, and chemical potential as set in the

View File

@ -41,7 +41,7 @@ These steps are not necessary, but can help to reduce fluctuations in the total
Now we calculate the modified charge density:: Now we calculate the modified charge density::
# find exact chemical potential # find exact chemical potential
SK.put_Sigma(Sigma_imp = [ S.Sigma_iw ]) SK.set_Sigma([ S.Sigma_iw ])
chemical_potential = SK.calc_mu( precision = 0.000001 ) chemical_potential = SK.calc_mu( precision = 0.000001 )
dN, d = SK.calc_density_correction(filename = dft_filename+'.qdmft') dN, d = SK.calc_density_correction(filename = dft_filename+'.qdmft')
SK.save(['chemical_potential','dc_imp','dc_energ']) SK.save(['chemical_potential','dc_imp','dc_energ'])

View File

@ -50,7 +50,7 @@ iterations and the self-consistency condition::
n_loops = 5 n_loops = 5
for iteration_number in range(n_loops) : # start the DMFT loop 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 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 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.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.G0_iw << inverse(S.Sigma_iw + inverse(S.G_iw)) # finally get G0, the input for the Solver
@ -239,7 +239,7 @@ refinements::
if mpi.is_master_node(): print "Iteration = ", iteration_number if mpi.is_master_node(): print "Iteration = ", iteration_number
SK.symm_deg_gf(S.Sigma_iw,orb=0) # symmetrise Sigma SK.symm_deg_gf(S.Sigma_iw,orb=0) # symmetrise Sigma
SK.put_Sigma(Sigma_imp = [ S.Sigma_iw ]) # put Sigma into the SumK class 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 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 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()) mpi.report("Total charge of Gloc : %.6f"%S.G_iw.total_density())

View File

@ -65,7 +65,7 @@ for iteration_number in range(1,Loops+1):
itn = iteration_number + previous_runs itn = iteration_number + previous_runs
# put Sigma into the SumK class: # put Sigma into the SumK class:
SK.put_Sigma(Sigma_imp = [ S.Sigma ]) SK.set_Sigma([ S.Sigma ])
# Compute the SumK, possibly fixing mu by dichotomy # Compute the SumK, possibly fixing mu by dichotomy
chemical_potential = SK.calc_mu( precision = 0.000001 ) chemical_potential = SK.calc_mu( precision = 0.000001 )

View File

@ -47,7 +47,7 @@ S.set_atomic_levels( eal = eal )
# Run the solver to get GF and self-energy on the real axis # Run the solver to get GF and self-energy on the real axis
S.GF_realomega(ommin=ommin, ommax = ommax, N_om=N_om,U_int=U_int,J_hund=J_hund) S.GF_realomega(ommin=ommin, ommax = ommax, N_om=N_om,U_int=U_int,J_hund=J_hund)
SK.put_Sigma(Sigma_imp = [S.Sigma]) SK.set_Sigma([S.Sigma])
# compute DOS # compute DOS
SK.dos_parproj_basis(broadening=broadening) SK.dos_parproj_basis(broadening=broadening)

View File

@ -82,7 +82,7 @@ for iteration_number in range(1,loops+1):
if mpi.is_master_node(): print "Iteration = ", iteration_number if mpi.is_master_node(): print "Iteration = ", iteration_number
SK.symm_deg_gf(S.Sigma_iw,orb=0) # symmetrise Sigma SK.symm_deg_gf(S.Sigma_iw,orb=0) # symmetrise Sigma
SK.put_Sigma(Sigma_imp = [ S.Sigma_iw ]) # put Sigma into the SumK class SK.set_Sigma([ S.Sigma_iw ]) # set Sigma into the SumK class
chemical_potential = SK.calc_mu( precision = prec_mu ) # find the chemical potential for given density 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 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()) mpi.report("Total charge of Gloc : %.6f"%S.G_iw.total_density())

View File

@ -83,7 +83,7 @@ for iteration_number in range(1,loops+1):
if mpi.is_master_node(): print "Iteration = ", iteration_number if mpi.is_master_node(): print "Iteration = ", iteration_number
SK.symm_deg_gf(S.Sigma_iw,orb=0) # symmetrise Sigma SK.symm_deg_gf(S.Sigma_iw,orb=0) # symmetrise Sigma
SK.put_Sigma(Sigma_imp = [ S.Sigma_iw ]) # put Sigma into the SumK class SK.set_Sigma([ S.Sigma_iw ]) # set Sigma into the SumK class
chemical_potential = SK.calc_mu( precision = prec_mu ) # find the chemical potential for given density 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 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()) mpi.report("Total charge of Gloc : %.6f"%S.G_iw.total_density())

View File

@ -86,7 +86,7 @@ reads the required data of the Wien2k output and stores it in the `dft_transp_in
Additionally we need to read and set the self energy, the chemical potential and the double counting:: Additionally we need to read and set the self energy, the chemical potential and the double counting::
ar = HDFArchive('case.h5', 'a') ar = HDFArchive('case.h5', 'a')
SK.put_Sigma(Sigma_imp = [ar['dmft_output']['Sigma_w']]) SK.set_Sigma([ar['dmft_output']['Sigma_w']])
chemical_potential,dc_imp,dc_energ = SK.load(['chemical_potential','dc_imp','dc_energ']) chemical_potential,dc_imp,dc_energ = SK.load(['chemical_potential','dc_imp','dc_energ'])
SK.set_mu(chemical_potential) SK.set_mu(chemical_potential)
SK.set_dc(dc_imp,dc_energ) SK.set_dc(dc_imp,dc_energ)

View File

@ -510,6 +510,8 @@ class SumkDFT:
return G_latt return G_latt
def set_Sigma(self,Sigma_imp):
self.put_Sigma(Sigma_imp)
def put_Sigma(self, Sigma_imp): def put_Sigma(self, Sigma_imp):
r""" r"""
@ -557,7 +559,6 @@ class SumkDFT:
for icrsh in range(self.n_corr_shells): for icrsh in range(self.n_corr_shells):
for bname,gf in SK_Sigma_imp[icrsh]: gf << self.rotloc(icrsh,gf,direction='toGlobal') for bname,gf in SK_Sigma_imp[icrsh]: gf << self.rotloc(icrsh,gf,direction='toGlobal')
def extract_G_loc(self, mu=None, with_Sigma=True, with_dc=True): def extract_G_loc(self, mu=None, with_Sigma=True, with_dc=True):
r""" r"""
Extracts the local downfolded Green function by the Brillouin-zone integration of the lattice Green's function. Extracts the local downfolded Green function by the Brillouin-zone integration of the lattice Green's function.

View File

@ -24,7 +24,7 @@ a_list = [a for a,al in SK.gf_struct_solver[0].iteritems()]
g_list = [read_gf_from_txt([['Sigma_' + a + '.dat']], a) for a in a_list] g_list = [read_gf_from_txt([['Sigma_' + a + '.dat']], a) for a in a_list]
Sigma_txt = BlockGf(name_list = a_list, block_list = g_list, make_copies=False) Sigma_txt = BlockGf(name_list = a_list, block_list = g_list, make_copies=False)
SK.put_Sigma(Sigma_imp = [Sigma_txt]) SK.set_Sigma([Sigma_txt])
SK.hdf_file = 'sigma_from_file.output.h5' SK.hdf_file = 'sigma_from_file.output.h5'
SK.save(['Sigma_imp_w']) SK.save(['Sigma_imp_w'])

View File

@ -41,7 +41,7 @@ gf_struct = set_operator_structure(spin_names,orb_names,orb_hybridized)
glist = [ GfImFreq(indices=inner,beta=beta) for block,inner in gf_struct.iteritems()] glist = [ GfImFreq(indices=inner,beta=beta) for block,inner in gf_struct.iteritems()]
Sigma_iw = BlockGf(name_list = gf_struct.keys(), block_list = glist, make_copies = False) Sigma_iw = BlockGf(name_list = gf_struct.keys(), block_list = glist, make_copies = False)
SK.put_Sigma([Sigma_iw]) SK.set_Sigma([Sigma_iw])
Gloc=SK.extract_G_loc() Gloc=SK.extract_G_loc()
ar = HDFArchive('srvo3_Gloc.output.h5','w') ar = HDFArchive('srvo3_Gloc.output.h5','w')

View File

@ -34,7 +34,7 @@ SK = SumkDFTTools(hdf_file='SrVO3.h5', use_dft_blocks=True)
ar = HDFArchive('SrVO3_Sigma.h5', 'a') ar = HDFArchive('SrVO3_Sigma.h5', 'a')
Sigma = ar['dmft_transp_input']['Sigma_w'] Sigma = ar['dmft_transp_input']['Sigma_w']
SK.put_Sigma(Sigma_imp = [Sigma]) SK.set_Sigma([Sigma])
SK.chemical_potential = ar['dmft_transp_input']['chemical_potential'] SK.chemical_potential = ar['dmft_transp_input']['chemical_potential']
SK.dc_imp = ar['dmft_transp_input']['dc_imp'] SK.dc_imp = ar['dmft_transp_input']['dc_imp']
del ar del ar