3
0
mirror of https://github.com/triqs/dft_tools synced 2024-07-17 00:20:39 +02:00

Issue a Warning when old gf_struct is provided

This commit is contained in:
Hermann Schnait 2022-03-09 12:23:26 +01:00
parent 4c44dbe2af
commit 23d689f8f7

View File

@ -122,18 +122,22 @@ class BlockStructure(object):
transformation=None):
# Ensure backwards-compatibility with pre-3.1.x gf_structs
# on second thought: would be better with gf_struct_flatten i guess... #TODO!
show_gf_struct_warning = False
if gf_struct_sumk != None:
for gf_struct in gf_struct_sumk:
for i, block in enumerate(gf_struct):
if isinstance(block[1], (list, np.ndarray)):
gf_struct[i] = (block[0], len(block[1]))
show_gf_struct_warning = True
if gf_struct_solver != None:
for gf_struct in gf_struct_solver:
for block in gf_struct:
if isinstance(gf_struct[block], (list, np.ndarray)):
gf_struct[block] = len(gf_struct[block])
show_gf_struct_warning = True
if show_gf_struct_warning:
warn('Old (pre 3.1.x) form of gf_struct provided! The structure will be updated to the new convention!')
self.gf_struct_sumk = gf_struct_sumk
self.gf_struct_solver = gf_struct_solver