mirror of
https://github.com/triqs/dft_tools
synced 2024-12-22 20:34:38 +01:00
Update unit tests and bugfixes in BlockStructure
This commit is contained in:
parent
bd228de768
commit
9bc4643fdf
@ -446,7 +446,7 @@ class BlockStructure(object):
|
||||
gf_struct[k] = range(len(gf_struct[k]))
|
||||
self.gf_struct_solver[ish] = gf_struct
|
||||
|
||||
def adapt_deg_shells(gf_struct, ish=0):
|
||||
def adapt_deg_shells(self, gf_struct, ish=0):
|
||||
""" Adapts the deg_shells to a new gf_struct
|
||||
Internally called when using pick_gf_struct and map_gf_struct
|
||||
"""
|
||||
@ -598,7 +598,7 @@ class BlockStructure(object):
|
||||
if not k in su2so:
|
||||
su2so[k] = (None, None)
|
||||
|
||||
adapt_deg_shells(gf_struct, ish)
|
||||
self.adapt_deg_shells(gf_struct, ish)
|
||||
|
||||
self.gf_struct_solver[ish] = gf_struct
|
||||
self.solver_to_sumk[ish] = so2su
|
||||
@ -816,7 +816,6 @@ class BlockStructure(object):
|
||||
'The parameter ish in convert_gf is deprecated. Use ish_from and ish_to instead.')
|
||||
ish_from = ish
|
||||
ish_to = ish
|
||||
|
||||
return self._convert_gf_or_matrix(G, G_struct, ish_from, ish_to,
|
||||
show_warnings, G_out, space_from, space_to, **kwargs)
|
||||
|
||||
@ -866,7 +865,6 @@ class BlockStructure(object):
|
||||
|
||||
def _convert_gf_or_matrix(self, G, G_struct=None, ish_from=0, ish_to=None, show_warnings=True,
|
||||
G_out=None, space_from='solver', space_to='solver', **kwargs):
|
||||
|
||||
if ish_to is None:
|
||||
ish_to = ish_from
|
||||
|
||||
@ -955,8 +953,10 @@ class BlockStructure(object):
|
||||
else:
|
||||
maxdiff = G_back[name] - G[name]
|
||||
|
||||
if space_to == 'solver': # do comparison in solver (ignore diff. in ignored orbitals)
|
||||
maxdiff = G_struct._convert_gf_or_matrix({'ud':maxdiff}, self, ish_from=ish_from,
|
||||
if space_to == 'solver' and self == G_struct: # do comparison in solver (ignore diff. in ignored orbitals)
|
||||
tmp = self.create_matrix(space='sumk')
|
||||
tmp[name] = maxdiff
|
||||
maxdiff = G_struct._convert_gf_or_matrix(tmp, self, ish_from=ish_from,
|
||||
ish_to=ish_to,
|
||||
show_warnings=False,
|
||||
space_from=space_from, space_to=space_to, **kwargs)
|
||||
|
@ -1090,9 +1090,9 @@ class SumkDFT(object):
|
||||
G_transformed = [
|
||||
self.block_structure.convert_gf(G[ish],
|
||||
full_structure, ish, mesh=G[ish].mesh.copy(), show_warnings=threshold,
|
||||
gf_function=type(G[ish]._first()))
|
||||
gf_function=type(G[ish]._first()), space_from='sumk', space_to='solver')
|
||||
for ish in range(self.n_inequiv_shells)]
|
||||
|
||||
#print 'c'
|
||||
if analyse_deg_shells:
|
||||
self.analyse_deg_shells(G_transformed, threshold, include_shells)
|
||||
return G_transformed
|
||||
|
@ -26,7 +26,6 @@ G = SK.extract_G_loc()
|
||||
|
||||
# the original block structure
|
||||
block_structure1 = SK.block_structure.copy()
|
||||
|
||||
G_new = SK.analyse_block_structure_from_gf(G)
|
||||
|
||||
# the new block structure
|
||||
@ -163,9 +162,9 @@ for conjugate in conjugate_values:
|
||||
G_new = SK.analyse_block_structure_from_gf(G, 1.e-7)
|
||||
|
||||
# transform G_noisy etc. to the new block structure
|
||||
G_noisy = SK.block_structure.convert_gf(G_noisy, block_structure1, beta = G_noisy.mesh.beta)
|
||||
G_pre_transform = SK.block_structure.convert_gf(G_pre_transform, block_structure1, beta = G_noisy.mesh.beta)
|
||||
G_noisy_pre_transform = SK.block_structure.convert_gf(G_noisy_pre_transform, block_structure1, beta = G_noisy.mesh.beta)
|
||||
G_noisy = SK.block_structure.convert_gf(G_noisy, block_structure1, beta = G_noisy.mesh.beta, space_from='sumk')
|
||||
G_pre_transform = SK.block_structure.convert_gf(G_pre_transform, block_structure1, beta = G_noisy.mesh.beta, space_from='sumk')
|
||||
G_noisy_pre_transform = SK.block_structure.convert_gf(G_noisy_pre_transform, block_structure1, beta = G_noisy.mesh.beta, space_from='sumk')
|
||||
|
||||
assert len(SK.deg_shells[0]) == 2, "wrong number of equivalent groups found"
|
||||
assert sorted([len(d) for d in SK.deg_shells[0]]) == [2,3], "wrong number of members in the equivalent groups found"
|
||||
|
Loading…
Reference in New Issue
Block a user