From f93fd828c07a71228efc308ae92186656df1262c Mon Sep 17 00:00:00 2001 From: Priyanka Seth Date: Mon, 2 Nov 2015 11:42:47 +0100 Subject: [PATCH] Added a wrapper function set_Sigma for more standard API --- dft_dmft_cthyb.py | 2 +- doc/guide/analysis.rst | 8 ++++---- doc/guide/dftdmft_selfcons.rst | 2 +- doc/guide/dftdmft_singleshot.rst | 4 ++-- doc/guide/images_scripts/Ce-gamma.py | 2 +- doc/guide/images_scripts/Ce-gamma_DOS.py | 2 +- doc/guide/images_scripts/dft_dmft_cthyb.py | 2 +- doc/guide/images_scripts/dft_dmft_cthyb_slater.py | 2 +- doc/guide/transport.rst | 2 +- python/sumk_dft.py | 3 ++- test/sigma_from_file.py | 2 +- test/srvo3_Gloc.py | 2 +- test/srvo3_transp.py | 2 +- 13 files changed, 18 insertions(+), 17 deletions(-) diff --git a/dft_dmft_cthyb.py b/dft_dmft_cthyb.py index 59ad7212..be87a74d 100644 --- a/dft_dmft_cthyb.py +++ b/dft_dmft_cthyb.py @@ -77,7 +77,7 @@ 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.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 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()) diff --git a/doc/guide/analysis.rst b/doc/guide/analysis.rst index e2cea32c..b22fea9e 100644 --- a/doc/guide/analysis.rst +++ b/doc/guide/analysis.rst @@ -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 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:: @@ -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 `(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 --------------- @@ -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 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) which calculates the partial charges using the self energy, double counting, and chemical potential as set in the diff --git a/doc/guide/dftdmft_selfcons.rst b/doc/guide/dftdmft_selfcons.rst index 952968f4..bbd2ffac 100644 --- a/doc/guide/dftdmft_selfcons.rst +++ b/doc/guide/dftdmft_selfcons.rst @@ -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:: # 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 ) dN, d = SK.calc_density_correction(filename = dft_filename+'.qdmft') SK.save(['chemical_potential','dc_imp','dc_energ']) diff --git a/doc/guide/dftdmft_singleshot.rst b/doc/guide/dftdmft_singleshot.rst index f2cef4c6..5b6a99f7 100644 --- a/doc/guide/dftdmft_singleshot.rst +++ b/doc/guide/dftdmft_singleshot.rst @@ -50,7 +50,7 @@ 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 + 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 @@ -239,7 +239,7 @@ refinements:: if mpi.is_master_node(): print "Iteration = ", iteration_number 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 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()) diff --git a/doc/guide/images_scripts/Ce-gamma.py b/doc/guide/images_scripts/Ce-gamma.py index b0bc20e5..35ae85a7 100644 --- a/doc/guide/images_scripts/Ce-gamma.py +++ b/doc/guide/images_scripts/Ce-gamma.py @@ -65,7 +65,7 @@ for iteration_number in range(1,Loops+1): itn = iteration_number + previous_runs # 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 chemical_potential = SK.calc_mu( precision = 0.000001 ) diff --git a/doc/guide/images_scripts/Ce-gamma_DOS.py b/doc/guide/images_scripts/Ce-gamma_DOS.py index b9b92aae..1f5907cd 100644 --- a/doc/guide/images_scripts/Ce-gamma_DOS.py +++ b/doc/guide/images_scripts/Ce-gamma_DOS.py @@ -47,7 +47,7 @@ S.set_atomic_levels( eal = eal ) # 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) -SK.put_Sigma(Sigma_imp = [S.Sigma]) +SK.set_Sigma([S.Sigma]) # compute DOS SK.dos_parproj_basis(broadening=broadening) diff --git a/doc/guide/images_scripts/dft_dmft_cthyb.py b/doc/guide/images_scripts/dft_dmft_cthyb.py index 2de25a3e..39221eb9 100644 --- a/doc/guide/images_scripts/dft_dmft_cthyb.py +++ b/doc/guide/images_scripts/dft_dmft_cthyb.py @@ -82,7 +82,7 @@ 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.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 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()) diff --git a/doc/guide/images_scripts/dft_dmft_cthyb_slater.py b/doc/guide/images_scripts/dft_dmft_cthyb_slater.py index 5d7d95e2..14129055 100644 --- a/doc/guide/images_scripts/dft_dmft_cthyb_slater.py +++ b/doc/guide/images_scripts/dft_dmft_cthyb_slater.py @@ -83,7 +83,7 @@ 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.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 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()) diff --git a/doc/guide/transport.rst b/doc/guide/transport.rst index 030939cd..0ef2e244 100644 --- a/doc/guide/transport.rst +++ b/doc/guide/transport.rst @@ -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:: 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']) SK.set_mu(chemical_potential) SK.set_dc(dc_imp,dc_energ) diff --git a/python/sumk_dft.py b/python/sumk_dft.py index a2a2557f..b837cdf7 100644 --- a/python/sumk_dft.py +++ b/python/sumk_dft.py @@ -510,6 +510,8 @@ class SumkDFT: return G_latt + def set_Sigma(self,Sigma_imp): + self.put_Sigma(Sigma_imp) def put_Sigma(self, Sigma_imp): r""" @@ -557,7 +559,6 @@ class SumkDFT: for icrsh in range(self.n_corr_shells): 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): r""" Extracts the local downfolded Green function by the Brillouin-zone integration of the lattice Green's function. diff --git a/test/sigma_from_file.py b/test/sigma_from_file.py index fb5ffd82..57dede2e 100644 --- a/test/sigma_from_file.py +++ b/test/sigma_from_file.py @@ -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] 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.save(['Sigma_imp_w']) diff --git a/test/srvo3_Gloc.py b/test/srvo3_Gloc.py index fb5be147..f6d295f6 100644 --- a/test/srvo3_Gloc.py +++ b/test/srvo3_Gloc.py @@ -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()] 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() ar = HDFArchive('srvo3_Gloc.output.h5','w') diff --git a/test/srvo3_transp.py b/test/srvo3_transp.py index def2d164..8ea79e8f 100644 --- a/test/srvo3_transp.py +++ b/test/srvo3_transp.py @@ -34,7 +34,7 @@ SK = SumkDFTTools(hdf_file='SrVO3.h5', use_dft_blocks=True) ar = HDFArchive('SrVO3_Sigma.h5', 'a') 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.dc_imp = ar['dmft_transp_input']['dc_imp'] del ar