mirror of
https://github.com/triqs/dft_tools
synced 2024-12-23 04:43:42 +01:00
block_structure: add corr_to_inequiv
This commit is contained in:
parent
2d48119876
commit
bc78560ee1
@ -107,6 +107,7 @@ class BlockStructure(object):
|
||||
sumk_to_solver=None,
|
||||
solver_to_sumk_block=None,
|
||||
deg_shells=None,
|
||||
corr_to_inequiv = None,
|
||||
transformation=None):
|
||||
self.gf_struct_sumk = gf_struct_sumk
|
||||
self.gf_struct_solver = gf_struct_solver
|
||||
@ -114,6 +115,7 @@ class BlockStructure(object):
|
||||
self.sumk_to_solver = sumk_to_solver
|
||||
self.solver_to_sumk_block = solver_to_sumk_block
|
||||
self.deg_shells = deg_shells
|
||||
self.corr_to_inequiv = corr_to_inequiv
|
||||
self.transformation = transformation
|
||||
|
||||
@property
|
||||
@ -187,6 +189,24 @@ class BlockStructure(object):
|
||||
return [{block: indices for block, indices in gfs}
|
||||
for gfs in self.gf_struct_sumk]
|
||||
|
||||
@property
|
||||
def inequiv_to_corr(self):
|
||||
if self.corr_to_inequiv is None:
|
||||
return None
|
||||
N_solver = len(np.unique(self.corr_to_inequiv))
|
||||
if self.gf_struct_solver is not None:
|
||||
assert N_solver == len(self.gf_struct_solver)
|
||||
assert sorted(np.unique(self.corr_to_inequiv)) == range(N_solver),\
|
||||
"an inequivalent shell is missing in corr_to_inequiv"
|
||||
return [self.corr_to_inequiv.index(icrsh)
|
||||
for icrsh in range(N_solver)]
|
||||
|
||||
@inequiv_to_corr.setter
|
||||
def inequiv_to_corr(self, value):
|
||||
if value is None:
|
||||
return
|
||||
assert self.inequiv_to_corr == value, "Trying to set incompatible inequiv_to_corr"
|
||||
|
||||
@property
|
||||
def effective_transformation_sumk(self):
|
||||
trans = copy.deepcopy(self.transformation)
|
||||
@ -285,7 +305,8 @@ class BlockStructure(object):
|
||||
solver_to_sumk = copy.deepcopy(solver_to_sumk),
|
||||
sumk_to_solver = solver_to_sumk,
|
||||
solver_to_sumk_block = s2sblock,
|
||||
deg_shells = [[] for ish in range(len(gf_struct))])
|
||||
deg_shells = [[] for ish in range(len(gf_struct))],
|
||||
corr_to_inequiv = corr_to_inequiv)
|
||||
|
||||
def pick_gf_struct_solver(self,new_gf_struct):
|
||||
""" Pick selected orbitals within blocks.
|
||||
@ -716,7 +737,7 @@ class BlockStructure(object):
|
||||
|
||||
for prop in [ "gf_struct_sumk", "gf_struct_solver",
|
||||
"solver_to_sumk", "sumk_to_solver", "solver_to_sumk_block",
|
||||
"deg_shells","transformation"]:
|
||||
"deg_shells","transformation", "corr_to_inequiv"]:
|
||||
if not compare(getattr(self,prop),getattr(other,prop)):
|
||||
return False
|
||||
return True
|
||||
@ -730,8 +751,10 @@ class BlockStructure(object):
|
||||
ret = {}
|
||||
for element in [ "gf_struct_sumk", "gf_struct_solver",
|
||||
"solver_to_sumk_block","deg_shells",
|
||||
"transformation"]:
|
||||
"transformation", "corr_to_inequiv"]:
|
||||
ret[element] = getattr(self,element)
|
||||
if ret[element] is None:
|
||||
ret[element] = 'None'
|
||||
|
||||
if ret["transformation"] is None:
|
||||
ret["transformation"] = "None"
|
||||
@ -761,8 +784,9 @@ class BlockStructure(object):
|
||||
d[ish][literal_eval(k)] = literal_eval(v)
|
||||
return d
|
||||
|
||||
if 'transformation' in D and D['transformation'] == "None":
|
||||
D['transformation'] = None
|
||||
for elem in D:
|
||||
if D[elem]=="None":
|
||||
D[elem] = None
|
||||
|
||||
D['solver_to_sumk']=reconstruct_mapping(D['solver_to_sumk'])
|
||||
D['sumk_to_solver']=reconstruct_mapping(D['sumk_to_solver'])
|
||||
@ -770,7 +794,8 @@ class BlockStructure(object):
|
||||
|
||||
def __str__(self):
|
||||
s=''
|
||||
s+= "gf_struct_sumk "+str( self.gf_struct_sumk)+'\n'
|
||||
s+= "corr_to_inequiv "+str(self.corr_to_inequiv)+'\n'
|
||||
s+= "gf_struct_sumk "+str(self.gf_struct_sumk)+'\n'
|
||||
s+= "gf_struct_solver "+str(self.gf_struct_solver)+'\n'
|
||||
s+= "solver_to_sumk_block "+str(self.solver_to_sumk_block)+'\n'
|
||||
for el in ['solver_to_sumk','sumk_to_solver']:
|
||||
|
@ -98,6 +98,8 @@ class SumkDFT(object):
|
||||
self.misc_data = misc_data
|
||||
self.h_field = h_field
|
||||
|
||||
self.block_structure = BlockStructure()
|
||||
|
||||
# Read input from HDF:
|
||||
things_to_read = ['energy_unit', 'n_k', 'k_dep_projection', 'SP', 'SO', 'charge_below', 'density_required',
|
||||
'symm_op', 'n_shells', 'shells', 'n_corr_shells', 'corr_shells', 'use_rotations', 'rot_mat',
|
||||
@ -123,8 +125,6 @@ class SumkDFT(object):
|
||||
self.spin_names_to_ind[iso][
|
||||
self.spin_block_names[iso][isp]] = isp * self.SP
|
||||
|
||||
self.block_structure = BlockStructure()
|
||||
|
||||
# GF structure used for the local things in the k sums
|
||||
# Most general form allowing for all hybridisation, i.e. largest
|
||||
# blocks possible
|
||||
@ -187,7 +187,7 @@ class SumkDFT(object):
|
||||
# initialise variables on all nodes to ensure mpi broadcast works at
|
||||
# the end
|
||||
for it in things_to_read:
|
||||
setattr(self, it, 0)
|
||||
setattr(self, it, None)
|
||||
subgroup_present = 0
|
||||
|
||||
if mpi.is_master_node():
|
||||
@ -2145,3 +2145,15 @@ class SumkDFT(object):
|
||||
@property
|
||||
def gf_struct_sumk_dict(self):
|
||||
return self.block_structure.gf_struct_sumk_dict
|
||||
|
||||
def __get_corr_to_inequiv(self):
|
||||
return self.block_structure.corr_to_inequiv
|
||||
def __set_corr_to_inequiv(self, value):
|
||||
self.block_structure.corr_to_inequiv = value
|
||||
corr_to_inequiv = property(__get_corr_to_inequiv, __set_corr_to_inequiv)
|
||||
|
||||
def __get_inequiv_to_corr(self):
|
||||
return self.block_structure.inequiv_to_corr
|
||||
def __set_inequiv_to_corr(self, value):
|
||||
self.block_structure.inequiv_to_corr = value
|
||||
inequiv_to_corr = property(__get_inequiv_to_corr, __set_inequiv_to_corr)
|
||||
|
Binary file not shown.
Binary file not shown.
@ -45,7 +45,8 @@ sk_pick1 = BlockStructure(gf_struct_sumk=SK.gf_struct_sumk,
|
||||
solver_to_sumk=SK.solver_to_sumk,
|
||||
sumk_to_solver=SK.sumk_to_solver,
|
||||
solver_to_sumk_block=SK.solver_to_sumk_block,
|
||||
deg_shells=SK.deg_shells)
|
||||
deg_shells=SK.deg_shells,
|
||||
corr_to_inequiv=SK.corr_to_inequiv)
|
||||
assert sk_pick1 == pick1, 'constructing block structure from SumkDFT properties failed'
|
||||
|
||||
cmp(pick1.effective_transformation_sumk,
|
||||
|
Binary file not shown.
Loading…
Reference in New Issue
Block a user