mirror of
https://github.com/triqs/dft_tools
synced 2024-12-21 20:03:41 +01:00
Write shell equivalency information directly into h5 at conversion
* changed shellmap and invshellmap to corr_to_inequiv and inequiv_to_corr * update_archive now calculates and stores these quantities for old archives
This commit is contained in:
parent
b672839f83
commit
518cbccd8c
@ -18,7 +18,9 @@ n_spin_blocks_gf -> n_spin_blocks
|
||||
block_names -> spin_block_names
|
||||
a_list -> block_ind_list
|
||||
a,al -> block,inner
|
||||
|
||||
shellmap -> corr_to_inequiv
|
||||
invshellmap -> inequiv_to_corr
|
||||
n_inequiv_corr_shells -> n_inequiv_shells
|
||||
**********
|
||||
* changed default h5 subgroup names
|
||||
|
||||
|
@ -49,30 +49,29 @@ class ConverterTools:
|
||||
subprocess.call(["mv","-f","temphgfrt.h5","%s"%self.hdf_file])
|
||||
|
||||
|
||||
def inequiv_shells(self,lst):
|
||||
def det_shell_equivalence(self,lst):
|
||||
"""
|
||||
The number of inequivalent shells is calculated from lst, and a mapping is given as
|
||||
map(i_corr_shells) = i_inequiv_corr_shells
|
||||
invmap(i_inequiv_corr_shells) = i_corr_shells
|
||||
The number of inequivalent shells is determined from lst, and a mapping is given as
|
||||
corr_to_inequiv(i_corr_shells) = i_inequiv_corr_shells
|
||||
inequiv_to_corr(i_inequiv_corr_shells) = i_corr_shells
|
||||
in order to put the self energies to all equivalent shells, and for extracting Gloc
|
||||
"""
|
||||
|
||||
tmp = []
|
||||
self.shellmap = [0 for i in range(len(lst))]
|
||||
self.invshellmap = [0]
|
||||
self.n_inequiv_corr_shells = 1
|
||||
tmp.append( lst[0][1:3] )
|
||||
|
||||
corr_to_inequiv = [0 for i in range(len(lst))]
|
||||
inequiv_to_corr = [0]
|
||||
n_inequiv_shells = 1
|
||||
tmp = [ lst[0][1:3] ]
|
||||
if (len(lst)>1):
|
||||
for i in range(len(lst)-1):
|
||||
|
||||
fnd = False
|
||||
for j in range(self.n_inequiv_corr_shells):
|
||||
for j in range(n_inequiv_shells):
|
||||
if (tmp[j]==lst[i+1][1:3]):
|
||||
fnd = True
|
||||
self.shellmap[i+1] = j
|
||||
corr_to_inequiv[i+1] = j
|
||||
if (fnd==False):
|
||||
self.shellmap[i+1] = self.n_inequiv_corr_shells
|
||||
self.n_inequiv_corr_shells += 1
|
||||
corr_to_inequiv[i+1] = n_inequiv_shells
|
||||
n_inequiv_shells += 1
|
||||
tmp.append( lst[i+1][1:3] )
|
||||
self.invshellmap.append(i+1)
|
||||
inequiv_to_corr.append(i+1)
|
||||
|
||||
return [n_inequiv_shells, corr_to_inequiv, inequiv_to_corr]
|
||||
|
@ -82,24 +82,25 @@ class HkConverter(ConverterTools):
|
||||
# now read the information about the shells:
|
||||
corr_shells = [ [ int(R.next()) for i in range(6) ] for icrsh in range(n_corr_shells) ] # reads iatom, sort, l, dim, SO flag, irep
|
||||
|
||||
ConverterTools.inequiv_shells(self,corr_shells) # determine the number of inequivalent correlated shells, needed for further reading
|
||||
# determine the number of inequivalent correlated shells and maps, needed for further reading
|
||||
[n_inequiv_shells, corr_to_inequiv, inequiv_to_corr] = ConverterTools.det_shell_equivalence(self,corr_shells)
|
||||
|
||||
use_rotations = 0
|
||||
rot_mat = [numpy.identity(corr_shells[icrsh][3],numpy.complex_) for icrsh in xrange(n_corr_shells)]
|
||||
rot_mat_time_inv = [0 for i in range(n_corr_shells)]
|
||||
|
||||
# Representative representations are read from file
|
||||
n_reps = [1 for i in range(self.n_inequiv_corr_shells)]
|
||||
dim_reps = [0 for i in range(self.n_inequiv_corr_shells)]
|
||||
n_reps = [1 for i in range(n_inequiv_shells)]
|
||||
dim_reps = [0 for i in range(n_inequiv_shells)]
|
||||
T = []
|
||||
for icrsh in range(self.n_inequiv_corr_shells):
|
||||
for icrsh in range(n_inequiv_shells):
|
||||
n_reps[icrsh] = int(R.next()) # number of representatives ("subsets"), e.g. t2g and eg
|
||||
dim_reps[icrsh] = [int(R.next()) for i in range(n_reps[icrsh])] # dimensions of the subsets
|
||||
|
||||
# The transformation matrix:
|
||||
# is of dimension 2l+1, it is taken to be standard d (as in Wien2k)
|
||||
ll = 2*corr_shells[self.invshellmap[icrsh]][2]+1
|
||||
lmax = ll * (corr_shells[self.invshellmap[icrsh]][4] + 1)
|
||||
ll = 2*corr_shells[inequiv_to_corr[icrsh]][2]+1
|
||||
lmax = ll * (corr_shells[inequiv_to_corr[icrsh]][4] + 1)
|
||||
T.append(numpy.zeros([lmax,lmax],numpy.complex_))
|
||||
|
||||
T[icrsh] = numpy.array([[0.0, 0.0, 1.0, 0.0, 0.0],
|
||||
@ -196,6 +197,7 @@ class HkConverter(ConverterTools):
|
||||
if not (self.lda_subgrp in ar): ar.create_group(self.lda_subgrp)
|
||||
things_to_save = ['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',
|
||||
'rot_mat_time_inv','n_reps','dim_reps','T','n_orbitals','proj_mat','bz_weights','hopping']
|
||||
'rot_mat_time_inv','n_reps','dim_reps','T','n_orbitals','proj_mat','bz_weights','hopping',
|
||||
'n_inequiv_shells', 'corr_to_inequiv', 'inequiv_to_corr']
|
||||
for it in things_to_save: ar[self.lda_subgrp][it] = locals()[it]
|
||||
del ar
|
||||
|
@ -90,7 +90,8 @@ class Wien2kConverter(ConverterTools):
|
||||
# now read the information about the shells:
|
||||
corr_shells = [ [ int(R.next()) for i in range(6) ] for icrsh in range(n_corr_shells) ] # reads iatom, sort, l, dim, SO flag, irep
|
||||
|
||||
ConverterTools.inequiv_shells(self,corr_shells) # determine the number of inequivalent correlated shells, needed for further reading
|
||||
# determine the number of inequivalent correlated shells and maps, needed for further reading
|
||||
[n_inequiv_shells, corr_to_inequiv, inequiv_to_corr] = ConverterTools.det_shell_equivalence(self,corr_shells)
|
||||
|
||||
use_rotations = 1
|
||||
rot_mat = [numpy.identity(corr_shells[icrsh][3],numpy.complex_) for icrsh in xrange(n_corr_shells)]
|
||||
@ -110,17 +111,17 @@ class Wien2kConverter(ConverterTools):
|
||||
rot_mat_time_inv[icrsh] = int(R.next())
|
||||
|
||||
# Read here the info for the transformation of the basis:
|
||||
n_reps = [1 for i in range(self.n_inequiv_corr_shells)]
|
||||
dim_reps = [0 for i in range(self.n_inequiv_corr_shells)]
|
||||
n_reps = [1 for i in range(n_inequiv_shells)]
|
||||
dim_reps = [0 for i in range(n_inequiv_shells)]
|
||||
T = []
|
||||
for icrsh in range(self.n_inequiv_corr_shells):
|
||||
for icrsh in range(n_inequiv_shells):
|
||||
n_reps[icrsh] = int(R.next()) # number of representatives ("subsets"), e.g. t2g and eg
|
||||
dim_reps[icrsh] = [int(R.next()) for i in range(n_reps[icrsh])] # dimensions of the subsets
|
||||
|
||||
# The transformation matrix:
|
||||
# is of dimension 2l+1 without SO, and 2*(2l+1) with SO!
|
||||
ll = 2*corr_shells[self.invshellmap[icrsh]][2]+1
|
||||
lmax = ll * (corr_shells[self.invshellmap[icrsh]][4] + 1)
|
||||
ll = 2*corr_shells[inequiv_to_corr[icrsh]][2]+1
|
||||
lmax = ll * (corr_shells[inequiv_to_corr[icrsh]][4] + 1)
|
||||
T.append(numpy.zeros([lmax,lmax],numpy.complex_))
|
||||
|
||||
# now read it from file:
|
||||
@ -192,7 +193,8 @@ class Wien2kConverter(ConverterTools):
|
||||
# The subgroup containing the data. If it does not exist, it is created. If it exists, the data is overwritten!
|
||||
things_to_save = ['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',
|
||||
'rot_mat_time_inv','n_reps','dim_reps','T','n_orbitals','proj_mat','bz_weights','hopping']
|
||||
'rot_mat_time_inv','n_reps','dim_reps','T','n_orbitals','proj_mat','bz_weights','hopping',
|
||||
'n_inequiv_shells', 'corr_to_inequiv', 'inequiv_to_corr']
|
||||
for it in things_to_save: ar[self.lda_subgrp][it] = locals()[it]
|
||||
del ar
|
||||
|
||||
|
@ -55,18 +55,14 @@ class SumkLDA:
|
||||
# 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',
|
||||
'rot_mat_time_inv','n_reps','dim_reps','T','n_orbitals','proj_mat','bz_weights','hopping']
|
||||
'rot_mat_time_inv','n_reps','dim_reps','T','n_orbitals','proj_mat','bz_weights','hopping',
|
||||
'n_inequiv_shells', 'corr_to_inequiv', 'inequiv_to_corr']
|
||||
self.subgroup_present, self.value_read = self.read_input_from_hdf(subgrp = self.lda_data, things_to_read = things_to_read)
|
||||
|
||||
if (self.SO) and (abs(self.h_field)>0.000001):
|
||||
self.h_field=0.0
|
||||
mpi.report("For SO, the external magnetic field is not implemented, setting it to 0!")
|
||||
|
||||
# FIXME -- REMOVE THIS, WRITE DATA IN CONVERTER
|
||||
# determine the number of inequivalent correlated shells (self.n_inequiv_corr_shells)
|
||||
# and related maps (self.shellmap, self.invshellmap)
|
||||
self.inequiv_shells(self.corr_shells)
|
||||
|
||||
self.spin_block_names = [ ['up','down'], ['ud'] ]
|
||||
self.n_spin_blocks = [2,1]
|
||||
# convert spin_block_names to indices -- if spin polarized, differentiate up and down blocks
|
||||
@ -87,16 +83,16 @@ class SumkLDA:
|
||||
optional_things = optional_things)
|
||||
if (not self.subgroup_present) or (not self.value_read['gf_struct_solver']):
|
||||
# No gf_struct was stored in HDF, so first set a standard one:
|
||||
self.gf_struct_solver = [ dict([ (b, range(self.corr_shells[self.invshellmap[i]][3]) )
|
||||
for b in self.spin_block_names[self.corr_shells[self.invshellmap[i]][4]] ])
|
||||
for i in range(self.n_inequiv_corr_shells)
|
||||
self.gf_struct_solver = [ dict([ (b, range(self.corr_shells[self.inequiv_to_corr[i]][3]) )
|
||||
for b in self.spin_block_names[self.corr_shells[self.inequiv_to_corr[i]][4]] ])
|
||||
for i in range(self.n_inequiv_shells)
|
||||
]
|
||||
# Set standard (identity) maps from gf_struct_sumk <-> gf_struct_solver
|
||||
self.sumk_to_solver = [ {} for ish in range(self.n_inequiv_corr_shells) ]
|
||||
self.solver_to_sumk = [ {} for ish in range(self.n_inequiv_corr_shells) ]
|
||||
self.solver_to_sumk_block = [ {} for ish in range(self.n_inequiv_corr_shells) ]
|
||||
for ish in range(self.n_inequiv_corr_shells):
|
||||
for block,inner_list in self.gf_struct_sumk[self.invshellmap[ish]]:
|
||||
self.sumk_to_solver = [ {} for ish in range(self.n_inequiv_shells) ]
|
||||
self.solver_to_sumk = [ {} for ish in range(self.n_inequiv_shells) ]
|
||||
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]]:
|
||||
self.solver_to_sumk_block[ish][block] = block
|
||||
for inner in inner_list:
|
||||
self.sumk_to_solver[ish][(block,inner)] = (block,inner)
|
||||
@ -109,7 +105,7 @@ class SumkLDA:
|
||||
self.chemical_potential = mu
|
||||
|
||||
if (not self.subgroup_present) or (not self.value_read['deg_shells']):
|
||||
self.deg_shells = [ [] for i in range(self.n_inequiv_corr_shells)]
|
||||
self.deg_shells = [ [] for i in range(self.n_inequiv_shells)]
|
||||
#-----
|
||||
|
||||
if self.symm_op:
|
||||
@ -412,19 +408,19 @@ class SumkLDA:
|
||||
|
||||
if dm is None: dm = self.simple_point_dens_mat()
|
||||
|
||||
dens_mat = [dm[self.invshellmap[ish]] for ish in xrange(self.n_inequiv_corr_shells) ]
|
||||
dens_mat = [dm[self.inequiv_to_corr[ish]] for ish in xrange(self.n_inequiv_shells) ]
|
||||
|
||||
self.sumk_to_solver = [ {} for ish in range(self.n_inequiv_corr_shells) ]
|
||||
self.solver_to_sumk = [ {} for ish in range(self.n_inequiv_corr_shells) ]
|
||||
self.solver_to_sumk_block = [ {} for ish in range(self.n_inequiv_corr_shells) ]
|
||||
self.sumk_to_solver = [ {} for ish in range(self.n_inequiv_shells) ]
|
||||
self.solver_to_sumk = [ {} for ish in range(self.n_inequiv_shells) ]
|
||||
self.solver_to_sumk_block = [ {} for ish in range(self.n_inequiv_shells) ]
|
||||
|
||||
if include_shells is None: include_shells=range(self.n_inequiv_corr_shells)
|
||||
if include_shells is None: include_shells=range(self.n_inequiv_shells)
|
||||
for ish in include_shells:
|
||||
|
||||
self.gf_struct_solver[ish] = {}
|
||||
gf_struct_temp = []
|
||||
|
||||
block_ind_list = [block for block,inner in self.gf_struct_sumk[self.invshellmap[ish]] ]
|
||||
block_ind_list = [block for block,inner in self.gf_struct_sumk[self.inequiv_to_corr[ish]] ]
|
||||
for block in block_ind_list:
|
||||
dm = dens_mat[ish][block]
|
||||
dmbool = (abs(dm) > threshold) # gives an index list of entries larger that threshold
|
||||
@ -511,25 +507,25 @@ class SumkLDA:
|
||||
for bl in degsh: ss += gf_to_symm[bl] / (1.0*Ndeg)
|
||||
for bl in degsh: gf_to_symm[bl] << ss
|
||||
|
||||
# for simply dft input, get crystal field splittings.
|
||||
# for simple dft input, get crystal field splittings.
|
||||
def eff_atomic_levels(self):
|
||||
"""Calculates the effective atomic levels needed as input for the Hubbard I Solver."""
|
||||
|
||||
# define matrices for inequivalent shells:
|
||||
eff_atlevels = [ {} for ish in range(self.n_inequiv_corr_shells) ]
|
||||
for ish in range(self.n_inequiv_corr_shells):
|
||||
for bn in self.spin_block_names[self.corr_shells[self.invshellmap[ish]][4]]:
|
||||
eff_atlevels[ish][bn] = numpy.identity(self.corr_shells[self.invshellmap[ish]][3], numpy.complex_)
|
||||
eff_atlevels = [ {} for ish in range(self.n_inequiv_shells) ]
|
||||
for ish in range(self.n_inequiv_shells):
|
||||
for bn in self.spin_block_names[self.corr_shells[self.inequiv_to_corr[ish]][4]]:
|
||||
eff_atlevels[ish][bn] = numpy.identity(self.corr_shells[self.inequiv_to_corr[ish]][3], numpy.complex_)
|
||||
|
||||
# Chemical Potential:
|
||||
for ish in xrange(self.n_inequiv_corr_shells):
|
||||
for ish in xrange(self.n_inequiv_shells):
|
||||
for ii in eff_atlevels[ish]: eff_atlevels[ish][ii] *= -self.chemical_potential
|
||||
|
||||
# double counting term:
|
||||
#if hasattr(self,"dc_imp"):
|
||||
for ish in xrange(self.n_inequiv_corr_shells):
|
||||
for ish in xrange(self.n_inequiv_shells):
|
||||
for ii in eff_atlevels[ish]:
|
||||
eff_atlevels[ish][ii] -= self.dc_imp[self.invshellmap[ish]][ii]
|
||||
eff_atlevels[ish][ii] -= self.dc_imp[self.inequiv_to_corr[ish]][ii]
|
||||
|
||||
# sum over k:
|
||||
if not hasattr(self,"Hsumk"):
|
||||
@ -567,9 +563,9 @@ class SumkLDA:
|
||||
self.rot_mat[icrsh] )
|
||||
|
||||
# add to matrix:
|
||||
for ish in xrange(self.n_inequiv_corr_shells):
|
||||
for ish in xrange(self.n_inequiv_shells):
|
||||
for bn in eff_atlevels[ish]:
|
||||
eff_atlevels[ish][bn] += self.Hsumk[self.invshellmap[ish]][bn]
|
||||
eff_atlevels[ish][bn] += self.Hsumk[self.inequiv_to_corr[ish]][bn]
|
||||
|
||||
|
||||
return eff_atlevels
|
||||
@ -599,7 +595,7 @@ class SumkLDA:
|
||||
|
||||
for icrsh in xrange(self.n_corr_shells):
|
||||
|
||||
iorb = self.shellmap[icrsh] # iorb is the index of the inequivalent shell corresponding to icrsh
|
||||
iorb = self.corr_to_inequiv[icrsh] # iorb is the index of the inequivalent shell corresponding to icrsh
|
||||
|
||||
if (iorb==orb):
|
||||
# do this orbital
|
||||
@ -681,7 +677,7 @@ class SumkLDA:
|
||||
"""Puts the impurity self energies for inequivalent atoms into the class, respects the multiplicity of the atoms."""
|
||||
|
||||
assert isinstance(Sigma_imp,list), "Sigma_imp has to be a list of Sigmas for the correlated shells, even if it is of length 1!"
|
||||
assert len(Sigma_imp)==self.n_inequiv_corr_shells, "give exactly one Sigma for each inequivalent corr. shell!"
|
||||
assert len(Sigma_imp)==self.n_inequiv_shells, "give exactly one Sigma for each inequivalent corr. shell!"
|
||||
|
||||
# init self.Sigma_imp:
|
||||
if all(type(gf) == GfImFreq for bname,gf in Sigma_imp[0]):
|
||||
@ -697,7 +693,7 @@ class SumkLDA:
|
||||
|
||||
# transform the CTQMC blocks to the full matrix:
|
||||
for icrsh in xrange(self.n_corr_shells):
|
||||
ish = self.shellmap[icrsh] # ish is the index of the inequivalent shell corresponding to icrsh
|
||||
ish = self.corr_to_inequiv[icrsh] # ish is the index of the inequivalent shell corresponding to icrsh
|
||||
|
||||
for block,inner in self.gf_struct_solver[ish].iteritems():
|
||||
for ind1 in inner:
|
||||
@ -821,15 +817,15 @@ class SumkLDA:
|
||||
|
||||
# transform to CTQMC blocks:
|
||||
Glocret = [ BlockGf( name_block_generator = [ (block,GfImFreq(indices = inner, mesh = Gloc[0].mesh)) for block,inner in self.gf_struct_solver[ish].iteritems() ],
|
||||
make_copies = False) for ish in xrange(self.n_inequiv_corr_shells) ]
|
||||
for ish in xrange(self.n_inequiv_corr_shells):
|
||||
make_copies = False) for ish in xrange(self.n_inequiv_shells) ]
|
||||
for ish in xrange(self.n_inequiv_shells):
|
||||
|
||||
for block,inner in self.gf_struct_solver[ish].iteritems():
|
||||
for ind1 in inner:
|
||||
for ind2 in inner:
|
||||
block_imp,ind1_imp = self.solver_to_sumk[ish][(block,ind1)]
|
||||
block_imp,ind2_imp = self.solver_to_sumk[ish][(block,ind2)]
|
||||
Glocret[ish][block][ind1,ind2] << Gloc[self.invshellmap[ish]][block_imp][ind1_imp,ind2_imp]
|
||||
Glocret[ish][block][ind1,ind2] << Gloc[self.inequiv_to_corr[ish]][block_imp][ind1_imp,ind2_imp]
|
||||
|
||||
# return only the inequivalent shells:
|
||||
return Glocret
|
||||
@ -925,7 +921,7 @@ class SumkLDA:
|
||||
|
||||
if (orb is None):
|
||||
dens = 0.0
|
||||
for ish in range(self.n_inequiv_corr_shells):
|
||||
for ish in range(self.n_inequiv_shells):
|
||||
dens += gnonint[ish].total_density()
|
||||
else:
|
||||
dens = gnonint[orb].total_density()
|
||||
@ -1014,34 +1010,3 @@ class SumkLDA:
|
||||
atomlst = [ lst[i][0] for i in range(len(lst)) ]
|
||||
atoms = len(set(atomlst))
|
||||
return atoms
|
||||
|
||||
##############################
|
||||
# DUPLICATED, NEED TO REMOVE #
|
||||
##############################
|
||||
def inequiv_shells(self,lst):
|
||||
"""
|
||||
The number of inequivalent shells is calculated from lst, and a mapping is given as
|
||||
shellmap(i_corr_shells) = i_inequiv_corr_shells
|
||||
invshellmap(i_inequiv_corr_shells) = i_corr_shells
|
||||
in order to put the Self energies to all equivalent shells, and for extracting Gloc
|
||||
"""
|
||||
|
||||
tmp = []
|
||||
self.shellmap = [0 for i in range(len(lst))]
|
||||
self.invshellmap = [0]
|
||||
self.n_inequiv_corr_shells = 1
|
||||
tmp.append( lst[0][1:3] )
|
||||
|
||||
if (len(lst)>1):
|
||||
for i in range(len(lst)-1):
|
||||
|
||||
fnd = False
|
||||
for j in range(self.n_inequiv_corr_shells):
|
||||
if (tmp[j]==lst[i+1][1:3]):
|
||||
fnd = True
|
||||
self.shellmap[i+1] = j
|
||||
if (fnd==False):
|
||||
self.shellmap[i+1] = self.n_inequiv_corr_shells
|
||||
self.n_inequiv_corr_shells += 1
|
||||
tmp.append( lst[i+1][1:3] )
|
||||
self.invshellmap.append(i+1)
|
||||
|
@ -155,11 +155,11 @@ class SumkLDATools(SumkLDA):
|
||||
for bn in self.spin_block_names[self.SO]:
|
||||
DOS[bn] = numpy.zeros([n_om],numpy.float_)
|
||||
|
||||
DOSproj = [ {} for icrsh in range(self.n_inequiv_corr_shells) ]
|
||||
DOSproj_orb = [ {} for icrsh in range(self.n_inequiv_corr_shells) ]
|
||||
for icrsh in range(self.n_inequiv_corr_shells):
|
||||
for bn in self.spin_block_names[self.corr_shells[self.invshellmap[icrsh]][4]]:
|
||||
dl = self.corr_shells[self.invshellmap[icrsh]][3]
|
||||
DOSproj = [ {} for icrsh in range(self.n_inequiv_shells) ]
|
||||
DOSproj_orb = [ {} for icrsh in range(self.n_inequiv_shells) ]
|
||||
for icrsh in range(self.n_inequiv_shells):
|
||||
for bn in self.spin_block_names[self.corr_shells[self.inequiv_to_corr[icrsh]][4]]:
|
||||
dl = self.corr_shells[self.inequiv_to_corr[icrsh]][3]
|
||||
DOSproj[icrsh][bn] = numpy.zeros([n_om],numpy.float_)
|
||||
DOSproj_orb[icrsh][bn] = numpy.zeros([n_om,dl,dl],numpy.float_)
|
||||
|
||||
@ -197,8 +197,8 @@ class SumkLDATools(SumkLDA):
|
||||
for bname,gf in Gloc[icrsh]: Gloc[icrsh][bname] << self.rotloc(icrsh,gf,direction='toLocal')
|
||||
|
||||
# Gloc can now also be used to look at orbitally resolved quantities
|
||||
for ish in range(self.n_inequiv_corr_shells):
|
||||
for bname,gf in Gloc[self.invshellmap[ish]]: # loop over spins
|
||||
for ish in range(self.n_inequiv_shells):
|
||||
for bname,gf in Gloc[self.inequiv_to_corr[ish]]: # loop over spins
|
||||
for iom in range(n_om): DOSproj[ish][bname][iom] += gf.data[iom,:,:].imag.trace()/(-3.1415926535)
|
||||
|
||||
DOSproj_orb[ish][bname][:,:,:] += gf.data[:,:,:].imag/(-3.1415926535)
|
||||
@ -210,13 +210,13 @@ class SumkLDATools(SumkLDA):
|
||||
for i in range(n_om): f.write("%s %s\n"%(om_mesh[i],DOS[bn][i]))
|
||||
f.close()
|
||||
|
||||
for ish in range(self.n_inequiv_corr_shells):
|
||||
for ish in range(self.n_inequiv_shells):
|
||||
f=open('DOS%s_proj%s.dat'%(bn,ish),'w')
|
||||
for i in range(n_om): f.write("%s %s\n"%(om_mesh[i],DOSproj[ish][bn][i]))
|
||||
f.close()
|
||||
|
||||
for i in range(self.corr_shells[self.invshellmap[ish]][3]):
|
||||
for j in range(i,self.corr_shells[self.invshellmap[ish]][3]):
|
||||
for i in range(self.corr_shells[self.inequiv_to_corr[ish]][3]):
|
||||
for j in range(i,self.corr_shells[self.inequiv_to_corr[ish]][3]):
|
||||
Fname = 'DOS'+bn+'_proj'+str(ish)+'_'+str(i)+'_'+str(j)+'.dat'
|
||||
f=open(Fname,'w')
|
||||
for iom in range(n_om): f.write("%s %s\n"%(om_mesh[iom],DOSproj_orb[ish][bn][iom,i,j]))
|
||||
|
@ -63,7 +63,7 @@ class TransBasis:
|
||||
gfrotated = BlockGf( name_block_generator = [ (block,GfImFreq(indices = inner, mesh = gf_to_rot.mesh)) for block,inner in self.SK.gf_struct_sumk[0] ], make_copies = False)
|
||||
|
||||
# transform the CTQMC blocks to the full matrix:
|
||||
ish = self.SK.shellmap[0] # ish is the index of the inequivalent shell corresponding to icrsh
|
||||
ish = self.SK.corr_to_inequiv[0] # ish is the index of the inequivalent shell corresponding to icrsh
|
||||
for block, inner in self.gf_struct_solver[ish].iteritems():
|
||||
for ind1 in inner:
|
||||
for ind2 in inner:
|
||||
|
@ -1,3 +1,4 @@
|
||||
from pytriqs.archive import HDFArchive
|
||||
import h5py
|
||||
import sys
|
||||
import numpy
|
||||
@ -14,6 +15,27 @@ Please keep a copy of your old archive as this script is
|
||||
If you encounter any problem please report it on github!
|
||||
"""
|
||||
|
||||
def det_shell_equivalence(lst):
|
||||
corr_to_inequiv = [0 for i in range(len(lst))]
|
||||
inequiv_to_corr = [0]
|
||||
n_inequiv_shells = 1
|
||||
tmp = [ lst[0][1:3] ]
|
||||
if (len(lst)>1):
|
||||
for i in range(len(lst)-1):
|
||||
fnd = False
|
||||
for j in range(n_inequiv_shells):
|
||||
if (tmp[j]==lst[i+1][1:3]):
|
||||
fnd = True
|
||||
corr_to_inequiv[i+1] = j
|
||||
if (fnd==False):
|
||||
corr_to_inequiv[i+1] = n_inequiv_shells
|
||||
n_inequiv_shells += 1
|
||||
tmp.append( lst[i+1][1:3] )
|
||||
inequiv_to_corr.append(i+1)
|
||||
return [n_inequiv_shells, corr_to_inequiv, inequiv_to_corr]
|
||||
|
||||
### Main ###
|
||||
|
||||
filename = sys.argv[1]
|
||||
A = h5py.File(filename)
|
||||
|
||||
@ -38,6 +60,14 @@ for obj in move_to_output:
|
||||
A.copy('lda_input/'+obj,'lda_output/'+obj)
|
||||
del(A['lda_input'][obj])
|
||||
|
||||
# Add shell equivalency quantities
|
||||
B = A['lda_input']
|
||||
corr_shells = HDFArchive(filename,'r')['lda_input']['corr_shells']
|
||||
equiv_shell_info = det_shell_equivalence(corr_shells)
|
||||
B['n_inequiv_shells'] = equiv_shell_info[0]
|
||||
B['corr_to_inequiv'] = equiv_shell_info[1]
|
||||
B['inequiv_to_corr'] = equiv_shell_info[2]
|
||||
|
||||
# Rename variables
|
||||
groups = ['lda_symmcorr_input','lda_symmpar_input']
|
||||
|
||||
|
BIN
test/SrVO3.h5
BIN
test/SrVO3.h5
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue
Block a user