Skip to content

Commit

Permalink
Update SumkDFT for new gf_struct
Browse files Browse the repository at this point in the history
  • Loading branch information
hschnait committed Mar 8, 2022
1 parent 9ae739a commit a833881
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions python/triqs_dft_tools/sumk_dft.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,10 +138,10 @@ def __init__(self, hdf_file, h_field=0.0, use_dft_blocks=False,
# GF structure used for the local things in the k sums
# Most general form allowing for all hybridisation, i.e. largest
# blocks possible
self.gf_struct_sumk = [[(sp, list(range(self.corr_shells[icrsh]['dim']))) for sp in self.spin_block_names[self.corr_shells[icrsh]['SO']]]
self.gf_struct_sumk = [[(sp, self.corr_shells[icrsh]['dim']) for sp in self.spin_block_names[self.corr_shells[icrsh]['SO']]]
for icrsh in range(self.n_corr_shells)]
# First set a standard gf_struct solver:
self.gf_struct_solver = [dict([(sp, list(range(self.corr_shells[self.inequiv_to_corr[ish]]['dim'])))
self.gf_struct_solver = [dict([(sp, self.corr_shells[self.inequiv_to_corr[ish]]['dim'])
for sp in self.spin_block_names[self.corr_shells[self.inequiv_to_corr[ish]]['SO']]])
for ish in range(self.n_inequiv_shells)]
# Set standard (identity) maps from gf_struct_sumk <->
Expand All @@ -151,9 +151,9 @@ def __init__(self, hdf_file, h_field=0.0, use_dft_blocks=False,
self.solver_to_sumk_block = [{}
for ish in range(self.n_inequiv_shells)]
for ish in range(self.n_inequiv_shells):
for block, inner_list in self.gf_struct_sumk[self.inequiv_to_corr[ish]]:
for block, inner_dim in self.gf_struct_sumk[self.inequiv_to_corr[ish]]:
self.solver_to_sumk_block[ish][block] = block
for inner in inner_list:
for inner in range(inner_dim):
self.sumk_to_solver[ish][
(block, inner)] = (block, inner)
self.solver_to_sumk[ish][
Expand Down Expand Up @@ -743,13 +743,13 @@ def extract_G_loc(self, mu=None, iw_or_w='iw', with_Sigma=True, with_dc=True, br
G_loc = [self.Sigma_imp_iw[icrsh].copy() for icrsh in range(
self.n_corr_shells)] # this list will be returned
beta = G_loc[0].mesh.beta
G_loc_inequiv = [BlockGf(name_block_generator=[(block, GfImFreq(indices=inner, mesh=G_loc[0].mesh)) for block, inner in self.gf_struct_solver[ish].items()],
G_loc_inequiv = [BlockGf(name_block_generator=[(block, GfImFreq(target_shape=(block_dim, block_dim), mesh=G_loc[0].mesh)) for block, block_dim in self.gf_struct_solver[ish].items()],
make_copies=False) for ish in range(self.n_inequiv_shells)]
elif iw_or_w == "w":
G_loc = [self.Sigma_imp_w[icrsh].copy() for icrsh in range(
self.n_corr_shells)] # this list will be returned
mesh = G_loc[0].mesh
G_loc_inequiv = [BlockGf(name_block_generator=[(block, GfReFreq(indices=inner, mesh=mesh)) for block, inner in self.gf_struct_solver[ish].items()],
G_loc_inequiv = [BlockGf(name_block_generator=[(block, GfReFreq(target_shape=(block_dim, block_dim), mesh=mesh)) for block, block_dim in self.gf_struct_solver[ish].items()],
make_copies=False) for ish in range(self.n_inequiv_shells)]

for icrsh in range(self.n_corr_shells):
Expand Down Expand Up @@ -911,7 +911,7 @@ def analyse_block_structure(self, threshold=0.00001, include_shells=None, dm=Non
for i in range(num_blocs):
blocs[i].sort()
self.gf_struct_solver[ish].update(
[('%s_%s' % (sp, i), list(range(len(blocs[i]))))])
[('%s_%s' % (sp, i), len(blocs[i]))])

# Construct sumk_to_solver taking (sumk_block, sumk_index) --> (solver_block, solver_inner)
# and solver_to_sumk taking (solver_block, solver_inner) -->
Expand All @@ -930,12 +930,12 @@ def analyse_block_structure(self, threshold=0.00001, include_shells=None, dm=Non

# Now calculate degeneracies of orbitals
dm = {}
for block, inner in self.gf_struct_solver[ish].items():
for block, block_dim in self.gf_struct_solver[ish].items():
# get dm for the blocks:
dm[block] = numpy.zeros(
[len(inner), len(inner)], numpy.complex_)
for ind1 in inner:
for ind2 in inner:
[block_dim, block_dim], numpy.complex_)
for ind1 in range(block_dim):
for ind2 in range(block_dim):
block_sumk, ind1_sumk = self.solver_to_sumk[
ish][(block, ind1)]
block_sumk, ind2_sumk = self.solver_to_sumk[
Expand Down Expand Up @@ -1100,7 +1100,7 @@ def analyse_block_structure_from_gf(self, G, threshold=1.e-5, include_shells=Non
for i in range(num_blocs):
blocs[i].sort()
self.gf_struct_solver[ish].update(
[('%s_%s' % (sp, i), list(range(len(blocs[i]))))])
[('%s_%s' % (sp, i), len(blocs[i]))])

# Construct sumk_to_solver taking (sumk_block, sumk_index) --> (solver_block, solver_inner)
# and solver_to_sumk taking (solver_block, solver_inner) -->
Expand Down Expand Up @@ -1420,7 +1420,7 @@ def calculate_diagonalization_matrix(self, prop_to_be_diagonal='eal', calc_in_so
"calculate_diagonalization_matrix: Choices for prop_to_be_diagonal are 'eal' or 'dm'.")
return 0

trans = [{block: numpy.eye(len(indices)) for block, indices in gfs} for gfs in self.gf_struct_sumk]
trans = [{block: numpy.eye(block_dim) for block, block_dim in gfs} for gfs in self.gf_struct_sumk]

for ish in shells:
trafo = {}
Expand Down

0 comments on commit a833881

Please sign in to comment.