From 98ae1cf14ea6239a040517d04dea20edd908be2a Mon Sep 17 00:00:00 2001 From: Alyn James Date: Mon, 19 Jun 2023 14:34:47 +0100 Subject: [PATCH] doc, log and minor updates --- doc/ChangeLog.md | 6 + doc/guide/analysis.rst | 73 +----------- python/triqs_dft_tools/converters/elk.py | 7 +- python/triqs_dft_tools/sumk_dft_tools.py | 145 ++++++++++++++++------- test/python/srvo3_spectral.py | 3 - 5 files changed, 116 insertions(+), 118 deletions(-) diff --git a/doc/ChangeLog.md b/doc/ChangeLog.md index 1d1dc93e..d07460f3 100644 --- a/doc/ChangeLog.md +++ b/doc/ChangeLog.md @@ -4,6 +4,12 @@ ## unstable +* updated github work flow to match triqs unstable requisites +* sumk_dft_tools.py rewritten to have single routines to calculate DOS, spaghettis and (Elk specific for now) spectral contours +* occupied DOS can be calculated (sumk_dft_tools.occupations() is needed to be calculated first) +* analysis.rst and conv_elk.rst updated to improve routine descriptions and includes example figures +* updated Elk tests and rewritten test scripts (.h5 files remain unchanged) +* New converter routines to read in Elk data for sumk_dft_tools.spectral_contours() (Elk k-mesh generator and checker needs to be optimized as it's currently slow). commented out Elk "bandcharacter" conversion from Elk converter and Elk DFT+DMFT PDOS code which used it (this method needs to be checked) * SumK requires now to pass a mesh on init to clarify the mesh on which it operates * rename / unify name of `sumk.Sigma_imp_iw` and `sumk.Sigma_imp_w` -> `sumk.Sigma_imp` * remove `iw_or_w` arguments diff --git a/doc/guide/analysis.rst b/doc/guide/analysis.rst index 5713b110..93f4a707 100644 --- a/doc/guide/analysis.rst +++ b/doc/guide/analysis.rst @@ -88,40 +88,13 @@ where a brief description of all of the inputs are given in :meth:`density_of_st .. automethod:: triqs_dft_tools.sumk_dft_tools.SumkDFTTools.density_of_states :noindex: -Input parameter breakdown: - * `mu` (Optional, default is None): The `mu` input specifies the chemical potential to be used in the calculation. By default, this is automatically set to the chemical potential within the SK object. - * `broadening` (Optional, default 0.01 eV). Traditionally, a small imaginary part is included for a non-interacting spectral function to avoid any numerical artifacts. The user can specify this imaginary part with the `broadening` input. The default value of `0.01 eV` if there is no `broadening` or `mesh` input. - * `mesh` (Optional, default is None): The `mesh` input requires a real frequency MeshType variable to specificy the frequency on which the spectral function is evaluated on. If the real frequency self-energy is used, then the associated mesh of the self-energy will be used instead. However, this `mesh` input will superseed the SK.mesh real frequency MeshType if it exists. - * `with_Sigma` and `with_dc` (Optional, both set to True by default): These Boolean options determine whether to include the real frequency self-energy (`with_Sigma`) and double counting term (`with_dc`) from the DMFT calculation. To calculate the DFT+DMFT DOS, both options need to be set to True. If both are set to false, then the DFT DOS will be calculated instead. - * `proj_type` (Optional, default is None): The type of projection used for the orbital-projected DOS is specified by the optional `proj_type`. These projected spectral functions will be determined alongside the total spectral function. By default, no projected DOS type will be calculated (the corresponding projected arrays will be empty). A full description of the DFT-code dependent options is given below. - * `dosocc` (Optional, default is False): The occupied part of the spectral function can be generated by setting `dosocc` to True. As a prerequisite to using this option, the user must first calculate the band-resolved density matrix (or occupations) by calling :meth:`occupations ` with the Matsubara self-energy. - * `save_to_file` (Optional, default is True): To save the generated DOS from this routine, then the optional `save_to_file` must be set to True. - -Variables returned from this function: - * DOS - this is a dictionary of numpy arrays with the form of `DOS[spn][n_om]` where `spn` speficies the spin type of the calculation ('`up`, `down`, or combined `ud` which relates to calculations with spin-orbit coupling) and `n_om` is the number of real frequencies as specified by the real frequency MeshType used in the calculation. This array gives the total density of states - * DOSproj - A dictionary of numpy arrays with the form of `DOSproj[n_shells][spn][n_om]` where `spn` and `n_om` are given above and `n_shells` are the total number of correlated or uncorrelated shells (depending on the input `dos_type`). This array gives the trace of the orbital-projected density of states. - * DOSproj_orb - A dictionary of numpy arrays with the form of `DOSproj_orb[n_shells][spn][n_om,dim,dim]` where the variables are defined as given previously with `dim` specifying the orbital dimension of the correlated/uncorrelated shell (depending on the input `dos_type`). This array gives the orbital-projected density of states. - - -The output files (if `save_to_file = True`) have two (three in the orbital-resolved case) columns representing the frequency and real part of the DOS (and imaginary part of the DOS) in that order. - -The output files are as follows: - * `DOS_(sp).dat`: The total DOS, where `(dos_type)` and `(sp)` have been defined previously. - * `DOS_(proj_type)_(sp)_proj(i).dat`: The DOS projected to an orbital with index `(i)`. The index `(i)` refers to tprojindices given in ``SK.shells`` (or ``SK.corr_shells`` for `proj_type` = "wann"). - * `DOS_(proj_type)_(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. - - -The different DFT code interfaces read in different variables needed to generate other options for the string type `proj_type` are as follows: - * "wann" - calculates the Wannier projected DOS. - * "vasp" - calculates the projected DOS from the projectors generated within Vasp. - * "wien2k" - calculates the projected DOS from the theta projectors generated from dmftproj used to interface Wien2k with TRIQS. - .. image:: images_scripts/DFT_Tools_SVO_DFT_DOS.png :width: 600 :align: center The figure above shows the DFT SrVO\ :sub:`3`\ density of states generated from 2925 k-points in the irreducible Brillouin zone with the V t\ :sub:`2g`\ Wanner projectors generated within a correlated energy window of [-13.6, 13.6] eV. The `broadening` input has been set to the temperature (i.e., 1/Beta). The total, V t\ :sub:`2g`\ Wannier and occupied total density of states generated from the SK.density_of_states() routine are shown. Note that the noise in the density of states comes from the number of k-points used. This can be removed upon by either using more k-points or using a larger `broadening` value. + Band resolved density matrices ------------------------------ @@ -133,8 +106,6 @@ This is done by calling the following:: This is required to generate the occupied DOS in SK.density_of_states() when dosocc is set to True. The `save_occ` optional input (True by default) saves these density matrices to the HDF5 file within the misc_data subgroup. The other variables are the same as defined above. See :meth:`occupations ` - - Momentum resolved spectral function (with real-frequency self energy) --------------------------------------------------------------------- @@ -145,26 +116,8 @@ This spectral function is calculated by typing:: SK.spaghettis(mu, broadening, mesh, plot_shift, plot_range, shell_list, with_Sigma, with_dc, proj_type, save_to_file) -Input variables such as `mu`, `broadening` and so on have the same definition as given previously. - -The additional parameters are defined as follows: - * `plot_shift` (Optional, default is 0.0): An additional shift added as `(ik-1)*plot_shift`, where `ik` is the index of the `k` point. This is useful for plotting purposes. - * `plot_range` (Optional, default is None): A list with two entries, :math:`\omega_{min}` and :math:`\omega_{max}`, which set the plot range for the output. By default, the full momentum range as given in the self_energy.mesh, input mesh, or SK.mesh is used. - * `shell_list` (Optional, default is None): A list of integers denoting the shell indices onto which the spectral function is projected if `proj_type` is not None. The resulting function is saved in the files. By default, the projected spectral function is generated for all shells if `proj_type` is not None. Note for experts: The spectra are not rotated to the local coordinate system used in Wien2k. - * `proj_type` : This has the same definition as above but with only the "wann" and "wien2k" options implemented. - -Variables returned from this function: - * `Akw` - this is a dictionary of numpy arrays with the form of `Akw[spn][n_ik, n_om]` where `n_k` is the number of k-points used in the calculation. This array gives the total A(k, :math:`\omega`). - * `pAkw` - A dictionary of numpy arrays with the form of `pAkw[n_shells][spn][n_k, n_om]` where `spn`, `n_om` and `n_shells` have been defined previously. This array gives the trace of the orbital-projected A(k, :math:`\omega`). - * `pAkw_orb` - A dictionary of numpy arrays with the form of `pAkw_orb[n_shells][spn][n_om,dim,dim]` where the variables have been previously defined. This array gives the orbital-projected A(k, :math:`\omega`). - - -The output files (if `save_to_file = True`) have three columns representing the k-point index, frequency and A(k, :math:`\omega`) in that order. The output files are as follows: - * `Akw_(sp).dat`: The total A(k, :math:`\omega`). - * `Akw_(dos_type)_(sp)_proj(i).dat`: The A(k, :math:`\omega`) projected to shell with index `(i)` (same as defined in the DOS output files). - * `Akw_(dos_type)_(sp)_proj(i)_(m)_(n).dat`: As above, but printed as orbitally-resolved matrix in indices `(m)` and `(n)`. - -Also see :meth:`spaghettis `. +.. automethod:: triqs_dft_tools.sumk_dft_tools.SumkDFTTools.spaghettis + :noindex: .. image:: images_scripts/DFT_Tools_SVO_DFT_spaghettis.png :width: 1000 @@ -182,24 +135,8 @@ This routine calculates the k-resolved spectral function evaluated at the Fermi SK.spectral_contours(mu, broadening, mesh, plot_range, FS, with_Sigma, with_dc, proj_type, save_to_file) -Again, certain inputs in this routine have already been defined. Note that only proj_type="wann" has been implemented for this routine. - -Below gives a description of the other inputs used here: - * `FS` (Optional, default is True): If True, this outputs the spectral function evaluated at the Fermi level (or the frequency value closest to 0.0 eV in the given mesh). If false, then the spectral function is evaluated at the frequency values within the frequency mesh used (or within `plot_range` if specified). - -This routine returns the following: - * `Akw` - A dictionary of numpy arrays with the form of `Akw[spn][n_ik, n_om]` where `spn`, `n_k` and `n_om` being defined as given above. This array gives the total A(k, :math:`\omega`). - * `pAkw` - A dictionary of numpy arrays with the form of `pAkw[n_shells][spn][n_k, n_om]` (`n_shells` defined above). This array gives the trace of the orbital-projected A(k, :math:`\omega`). - * `pAkw_orb` - A dictionary of numpy arrays with the form of `pAkw_orb[n_shells][spn][n_om,dim,dim]` (`dim` defined above). This array gives the orbital-projected A(k, :math:`\omega`). - - -The output files will have the same extensions of `_(sp)_proj(i)_(m)_(n).dat`, `_(sp)_proj(i)_(m)_(n).dat` and `_(sp)_proj(i)_(m)_(n).dat` as described in the Spaghettis routine. - -The files are prepended with either of the following: - * For `FS` set to True : The output files' name are prepended with `Akw_FS` and these files contain four columns which are the `k`\ :sub:`x`\, `k`\ :sub:`y`\, `k`\ :sub:`z`\, and `Akw`. Here (`k`\ :sub:`x`\, `k`\ :sub:`y`\, `k`\ :sub:`z`\) are the cartesian reciprocal coordinates, - * For `FS` set to False : The output files' name are prepended with `Akw_omega_(iom)` (with `iom` being the frequency mesh index). These files also contain four columns as described above along with a comment at the top of the file which gives the :math:`\omega` frequency value at which the spectral function was evaluated. - -Also see :meth:`spectral_contours ` +.. automethod:: triqs_dft_tools.sumk_dft_tools.SumkDFTTools.spectral_contours + :noindex: .. image:: images_scripts/DFT_Tools_SVO_DFT_energy_contours.png :width: 1000 diff --git a/python/triqs_dft_tools/converters/elk.py b/python/triqs_dft_tools/converters/elk.py index b55b0697..082c5477 100644 --- a/python/triqs_dft_tools/converters/elk.py +++ b/python/triqs_dft_tools/converters/elk.py @@ -626,7 +626,12 @@ class ElkConverter(ConverterTools,Elk_tools,read_Elk): del ar mpi.report('Converted the Contours data') -#commented out for now - unsure using this produces DFT+DMFT PDOS. +# commented out for now - unsure using this produces DFT+DMFT PDOS. +# The data from BC.OUT are the band-resolved diagonal muffin-tin DFT density matrix elements used in Elk to calculate PDOS +# (the PDOS is calculated from the Trace over the bands indices). Although this is equivalent to using using projectors in DFT and is likely valid for DFT+DMFT, +# the equivalence needs to be thoroughly checked for DFT+DMFT, but would require theta (or similar) projectors from Elk to do so. +# code left here just in case. + # def dft_band_characters(self): # """ # Reads in the band-resolved muffin-tin density matrix (band characters) generated in Elk diff --git a/python/triqs_dft_tools/sumk_dft_tools.py b/python/triqs_dft_tools/sumk_dft_tools.py index add7def1..ca57e7f4 100644 --- a/python/triqs_dft_tools/sumk_dft_tools.py +++ b/python/triqs_dft_tools/sumk_dft_tools.py @@ -62,40 +62,58 @@ class SumkDFTTools(SumkDFT): ---------- mu : double, optional Chemical potential, overrides the one stored in the hdf5 archive. + By default, this is automatically set to the chemical potential within the SK object. broadening : double, optional - Lorentzian broadening of the spectra. - If not given, standard value of lattice_gf is used. + Lorentzian broadening of the spectra to avoid any numerical artifacts. + If not given, standard value of lattice_gf (0.001 eV) is used. mesh : real frequency MeshType, optional Omega mesh for the real-frequency Green's function. Given as parameter to lattice_gf. with_Sigma : boolean, optional If True, the self energy is used for the calculation. If false, the DOS is calculated without self energy. + Both with_Sigma and with_dc equal to True is needed for DFT+DMFT A(w) calculated. + Both with_Sigma and with_dc equal to false is needed for DFT A(w) calculated. with_dc : boolean, optional If True the double counting correction is used. proj_type : string, optional - Output the orbital-projected DOS type from the following options: + The type of projection used for the orbital-projected DOS. + These projected spectral functions will be determined alongside the total spectral function. + By default, no projected DOS type will be calculated (the corresponding projected arrays will be empty). + The following options are: + 'None' - Only total DOS calculated 'wann' - Wannier DOS calculated from the Wannier projectors 'vasp' - Vasp orbital-projected DOS only from Vasp inputs 'wien2k' - Wien2k orbital-projected DOS from the wien2k theta projectors - 'elk' - Elk orbital-projected DOS only from Elk inputs dosocc : boolean, optional If True, the occupied DOS, DOSproj and DOSproj_orb will be returned. The prerequisite of this option is to have calculated the band-resolved - density matrices generated by occupations(). + density matrices generated by the occupations() routine. save_to_file : boolean, optional If True, text files with the calculated data will be created. Returns ------- DOS : Dict of numpy arrays - Contains the full density of states. + Contains the full density of states with the form of DOS[spn][n_om] where "spn" speficies the spin type of the calculation ("up", "down", or combined "ud" which relates to calculations with spin-orbit coupling) and "n_om" is the number of real frequencies as specified by the real frequency MeshType used in the calculation. This array gives the total density of states. DOSproj : Dict of numpy arrays - DOS projected to atoms. Empty if proj_type = None - DOSproj_orb : Dict of numpy arrays - DOS projected to atoms and resolved into orbital contributions. + DOS projected to atom (shell) with the form of DOSproj[n_shells][spn][n_om] where "n_shells" is the total number of correlated or uncorrelated shells (depending on the input "proj_type"). This array gives the trace of the orbital-projected density of states. Empty if proj_type = None + DOSproj_orb : Dict of numpy arrays + Orbital-projected DOS projected to atom (shell) and resolved into orbital contributions with the form of DOSproj_orb[n_shells][spn][n_om,dim,dim] where "dim" specifies the orbital dimension of the correlated/uncorrelated shell (depending on the input "proj_type"). Empty if proj_type = None + + + The output files (if `save_to_file = True`) have two (three in the orbital-resolved case) columns representing the frequency and real part of the DOS (and imaginary part of the DOS) in that order. + + The output files are as follows: + DOS_(spn).dat : The total DOS. + DOS_(proj_type)_(spn)_proj(i).dat : The DOS projected to an orbital with index i which refers to the index given in SK.shells (or SK.corr_shells for proj_type = "wann"). + DOS_(proj_type)_(sp)_proj(i)_(m)_(n).dat: As above, but printed as orbitally-resolved matrix in indices "m" and "n". For example, for "d" orbitals, it gives the DOS separately for each orbital (e.g., "d_(xy)", "d_(x^2-y^2), and so on). """ + # Note the proj_type = 'elk' (- Elk orbital-projected DOS only from Elk inputs) is not included for now. + # Brief description to why can be found in the comment above the currently commented out dft_band_characters() routine + # in converters/elk.py. + # code left here just in case it will be reused. if (proj_type != None): # assert proj_type in ('wann', 'vasp','wien2k','elk'), "'proj_type' must be either 'wann', 'vasp', 'wien2k', or 'elk'" assert proj_type in ('wann', 'vasp', 'wien2k', @@ -281,15 +299,17 @@ class SumkDFTTools(SumkDFT): 'wann' - Wannier DOS calculated from the Wannier projectors 'vasp' - Vasp orbital-projected DOS only from Vasp inputs 'wien2k' - Wien2k orbital-projected DOS from the wien2k theta projectors - 'elk' - Elk orbital-projected DOS only from Elk inputs - + Returns ------- G_proj : Gf projected/downfolded lattice Green's function Contains the band-resolved density matrices per k-point. """ - + # Note the proj_type = 'elk' (- Elk orbital-projected DOS only from Elk inputs) is not included for now. + # Brief description to why can be found in the comment above the currently commented out dft_band_characters() routine + # in converters/elk.py. + # code left here just in case it will be reused. G_proj = G_inp.copy() if (proj_type == 'wann'): for bname, gf in G_proj: @@ -435,40 +455,62 @@ class SumkDFTTools(SumkDFT): ---------- mu : double, optional Chemical potential, overrides the one stored in the hdf5 archive. + By default, this is automatically set to the chemical potential within the SK object. broadening : double, optional - Lorentzian broadening of the spectra. - If not given, standard value of lattice_gf is used. + Lorentzian broadening of the spectra to avoid any numerical artifacts. + If not given, standard value of lattice_gf (0.001 eV) is used. mesh : real frequency MeshType, optional Omega mesh for the real-frequency Green's function. Given as parameter to lattice_gf. + plot_shift : double, optional + Offset [=(ik-1)*plot_shift, where ik is the index of the k-point] for each A(k,w) for stacked plotting of spectra. plot_range : list of double, optional - Sets the energy window for plotting to (plot_range[0],plot_range[1]). - If not provided, the min and max values of the energy mesh is used. + Sets the energy window for plotting to (plot_range[0],plot_range[1]). + If not provided, the min and max values of the energy mesh is used. FS : boolean Flag for calculating the spectral function at the Fermi level (omega ~ 0) If False, the spectral function will be generated for each frequency within - plot_range. + plot_range. with_Sigma : boolean, optional If True, the self energy is used for the calculation. If false, the DOS is calculated without self energy. + Both with_Sigma and with_dc equal to True is needed for DFT+DMFT A(k,w) calculated. + Both with_Sigma and with_dc equal to false is needed for DFT A(k,w) calculated. with_dc : boolean, optional If True the double counting correction is used. proj_type : string, optional - Output the orbital-projected A(k,w) type from the following: - 'wann' - Wannier A(k,w) calculated from the Wannier projectors + The type of projection used for the orbital-projected DOS. + These projected spectral functions will be determined alongside the total spectral function. + By default, no projected DOS type will be calculated (the corresponding projected arrays will be empty). + The following options are: + 'None' - Only total DOS calculated + 'wann' - Wannier DOS calculated from the Wannier projectors save_to_file : boolean, optional If True, text files with the calculated data will be created. - + Returns ------- Akw : Dict of numpy arrays - (Correlated) k-resolved spectral function - pAkw : Dict of numpy arrays - (Correlated) k-resolved spectral function projected to atoms. + (Correlated) k-resolved spectral function. + This dictionary has the form of `Akw[spn][n_k, n_om]` where spn, n_k and n_om are the spin, number of k-points, and number of frequencies used in the calculation. + pAkw : Dict of numpy arrays + (Correlated) k-resolved spectral function projected to atoms (i.e., the Trace of the orbital-projected A(k,w)). + This dictionary has the form of pAkw[n_shells][spn][n_k, n_om] where n_shells is the total number of correlated or uncorrelated shells. Empty if proj_type = None - pAkw_orb : Dict of numpy arrays - (Correlated) k-resolved spectral function projected to atoms and - resolved into orbital contributions. Empty if proj_type = None + pAkw_orb : Dict of numpy arrays + (Correlated) k-resolved spectral function projected to atoms and + resolved into orbital contributions. + This dictionary has the form of pAkw[n_shells][spn][n_k, n_om,dim,dim] where dim specifies the orbital dimension of the correlated/uncorrelated shell. + Empty if proj_type = None + + The output files have three columns representing the k-point index, frequency and A(k,w) in that order. The output files are as follows: + Akw_(sp).dat : The total A(k,w). + Akw_(proj_type)_(spn)_proj(i).dat: The A(k,w) projected to shell with index (i). + Akw_(proj_type)_(spn)_proj(i)_(m)_(n).dat`: As above, but for each (m) and (n) orbital contribution. + + The files are prepended with either of the following: + For `FS` set to True : The output files' name include _FS_ and these files contain four columns which are the cartesian reciprocal coordinates (kx, ky, kz) and Akw. + For `FS` set to False : The output files' name include _omega_(iom) (with `iom` being the frequency mesh index). These files also contain four columns as described above along with a comment at the top of the file which gives the frequency value at which the spectral function was evaluated. """ if (proj_type != None): assert proj_type in ('wann'), "'proj_type' must be 'wann' if not None" @@ -573,9 +615,6 @@ class SumkDFTTools(SumkDFT): dim = len(pAkw_orb[ish][sp][0, 0, 0, :]) for i in range(dim): for j in range(dim): - # For Elk with parproj - skip off-diagonal elements - if (proj_type == 'elk') and (i != j): - continue strng2 = strng + '_' + str(i) + '_' + str(j) # Open file for storage: f = open(strng2 + '.dat', 'w') @@ -596,14 +635,15 @@ class SumkDFTTools(SumkDFT): ---------- mu : double, optional Chemical potential, overrides the one stored in the hdf5 archive. + By default, this is automatically set to the chemical potential within the SK object. broadening : double, optional - Lorentzian broadening of the spectra. - If not given, standard value of lattice_gf is used. + Lorentzian broadening of the spectra to avoid any numerical artifacts. + If not given, standard value of lattice_gf (0.001 eV) is used. mesh : real frequency MeshType, optional - Omega mesh for the real-frequency Green's function. + Omega mesh for the real-frequency Green's function. Given as parameter to lattice_gf. plot_shift : double, optional - Offset for each A(k,w) for stacked plotting of spectra. + Offset [=(ik-1)*plot_shift, where ik is the index of the k-point] for each A(k,w) for stacked plotting of spectra. plot_range : list of double, optional Sets the energy window for plotting to (plot_range[0],plot_range[1]). If not provided, the min and max values of the energy mesh is used. @@ -612,28 +652,44 @@ class SumkDFTTools(SumkDFT): is calculated for. If shell_list = None and proj_type is not None, then the projected spectral function is calculated for all shells. + Note for experts: The spectra from Wien2k inputs are not rotated to the local coordinate system used in Wien2k. with_Sigma : boolean, optional - If True, the self energy is used for the calculation. + If True, the self energy is used for the calculation. If false, the DOS is calculated without self energy. + Both with_Sigma and with_dc equal to True is needed for DFT+DMFT A(k,w) calculated. + Both with_Sigma and with_dc equal to false is needed for DFT A(k,w) calculated. with_dc : boolean, optional If True the double counting correction is used. proj_type : string, optional - Output the orbital-projected A(k,w) type from the following: - 'wann' - Wannier A(k,w) calculated from the Wannier projectors - 'wien2k' - Wien2k orbital-projected A(k,w) from the wien2k theta projectors + The type of projection used for the orbital-projected DOS. + These projected spectral functions will be determined alongside the total spectral function. + By default, no projected DOS type will be calculated (the corresponding projected arrays will be empty). + The following options are: + 'None' - Only total DOS calculated + 'wann' - Wannier DOS calculated from the Wannier projectors + 'wien2k' - Wien2k orbital-projected DOS from the wien2k theta projectors save_to_file : boolean, optional If True, text files with the calculated data will be created. - + Returns ------- Akw : Dict of numpy arrays - (Correlated) k-resolved spectral function - pAkw : Dict of numpy arrays - (Correlated) k-resolved spectral function projected to atoms. + (Correlated) k-resolved spectral function. + This dictionary has the form of `Akw[spn][n_k, n_om]` where spn, n_k and n_om are the spin, number of k-points, and number of frequencies used in the calculation. + pAkw : Dict of numpy arrays + (Correlated) k-resolved spectral function projected to atoms (i.e., the Trace of the orbital-projected A(k,w)). + This dictionary has the form of pAkw[n_shells][spn][n_k, n_om] where n_shells is the total number of correlated or uncorrelated shells. Empty if proj_type = None - pAkw_orb : Dict of numpy arrays + pAkw_orb : Dict of numpy arrays (Correlated) k-resolved spectral function projected to atoms and - resolved into orbital contributions. Empty if proj_type = None + resolved into orbital contributions. + This dictionary has the form of pAkw[n_shells][spn][n_k, n_om,dim,dim] where dim specifies the orbital dimension of the correlated/uncorrelated shell. + Empty if proj_type = None + + The output files have three columns representing the k-point index, frequency and A(k,w) in that order. The output files are as follows: + Akw_(sp).dat : The total A(k,w). + Akw_(proj_type)_(spn)_proj(i).dat: The A(k,w) projected to shell with index (i). + Akw_(proj_type)_(spn)_proj(i)_(m)_(n).dat`: As above, but for each (m) and (n) orbital contribution. """ # initialisation @@ -714,9 +770,6 @@ class SumkDFTTools(SumkDFT): dim = len(pAkw_orb[ish][sp][0, 0, 0, :]) for i in range(dim): for j in range(dim): - # For Elk with parproj - skip off-diagonal elements - if(proj_type =='elk') and (i!=j): - continue # Open file for storage: f = open('Akw_' + proj_type + '_' + sp + '_proj' + str(jsh) + '_' + str(i) + '_' + str(j) + '.dat', 'w') diff --git a/test/python/srvo3_spectral.py b/test/python/srvo3_spectral.py index 30d975c7..0baa6c9b 100644 --- a/test/python/srvo3_spectral.py +++ b/test/python/srvo3_spectral.py @@ -13,11 +13,8 @@ SK.chemical_potential = chemical_potential SK.dc_imp = dc_imp SK.set_Sigma([Sigma]) -#dos_wannier = SK.dos_wannier_basis(broadening=0.01, with_Sigma=True, with_dc=True, save_to_file=False) -#dos_parproj = SK.dos_parproj_basis(broadening=0.01, with_Sigma=True, with_dc=True, save_to_file=False) dos_wannier = SK.density_of_states(broadening=0.01, with_Sigma=True, with_dc=True, proj_type='wann', save_to_file=False) dos_parproj = SK.density_of_states(broadening=0.01, with_Sigma=True, with_dc=True, proj_type='wien2k', save_to_file=False) -#spaghetti = SK.spaghettis(broadening=0.01, plot_shift=0.0, plot_range=(-1,1), ishell=None, save_to_file=False) [spaghetti, pAkw, pAkw_orb] = SK.spaghettis(broadening=0.01, plot_shift=0.0, plot_range=(-1,1), shell_list=None, save_to_file=False)