TRIQS / dft_tools

Interface to DFT codes
https://triqs.github.io/dft_tools
Other
40 stars 38 forks source link

Bug: extract_G_loc crashes when Sigma_imp is not set even for with_Sigma=False #233

Closed merkelm closed 1 year ago

merkelm commented 1 year ago

Description

When executing SumkDFT.extract_G_loc, it always uses self.Sigma_imp to initialize the Green's function object G_loc. Therefore, if self.Sigma_imp has not been set, it crashes. This probably should not happen when using with_Sigma=False, now that SumkDFT has its own mesh object.

The error message is the following:

File "/triqs/lib/python3.10/site-packages/triqs_dft_tools/sumk_dft.py", line 761, in extract_G_loc
    G_loc = [self.Sigma_imp[icrsh].copy() for icrsh in range(
  File "/triqs/lib/python3.10/site-packages/triqs_dft_tools/sumk_dft.py", line 761, in <listcomp>
    G_loc = [self.Sigma_imp[icrsh].copy() for icrsh in range(
AttributeError: 'SumkDFT' object has no attribute 'Sigma_imp'

Versions

This happens on the branch unstable and is probably not relevant for 3.1.x. I run on commit a072a54.

the-hampel commented 1 year ago

Thank you @merkelm for reporting this! PR #234 should fix this. @merkelm could you take a look if this makes sense and works for your case? The code is now simpler. I hope this still covers all use cases. Tests are passing here and in solid_dmft. If you agree I will merge it.

merkelm commented 1 year ago

The code changes look good and it worked in the one test I did. Thanks for fixing this!

the-hampel commented 1 year ago

fixed merging #234