Skip to content

Commit

Permalink
Add backwards-compatibility in constructor of block_strucutre
Browse files Browse the repository at this point in the history
  • Loading branch information
hschnait committed Mar 8, 2022
1 parent cbeb26c commit 33200f9
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions python/triqs_dft_tools/block_structure.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,22 @@ def __init__(self, gf_struct_sumk=None,
deg_shells=None,
corr_to_inequiv = None,
transformation=None):

# Ensure backwards-compatibility with pre-3.1.x gf_structs
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]))
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])

self.gf_struct_sumk = gf_struct_sumk
self.gf_struct_solver = gf_struct_solver

self.solver_to_sumk = solver_to_sumk
self.sumk_to_solver = sumk_to_solver
self.solver_to_sumk_block = solver_to_sumk_block
Expand Down

0 comments on commit 33200f9

Please sign in to comment.