3
0
mirror of https://github.com/triqs/dft_tools synced 2024-12-21 11:53:41 +01:00

Fix bugs in sumk_lda.py

This is a merge of fixes by Markus and Leonid. Hopefully it's OK.

  modified:   python/sumk_lda.py
This commit is contained in:
Michel Ferrero 2014-01-21 16:25:44 +01:00
parent 3d82fafda8
commit 2d5cf0abc7

View File

@ -651,17 +651,17 @@ class SumkLDA:
use_dc_formula=0: LDA+U FLL double counting, use_dc_formula=1: Held's formula.
use_dc_formula=2: AMF
Be sure that you use the correct interaction Hamiltonian!"""
#if (not hasattr(self,"dc_imp")): self.__init_dc()
dm = [ {} for i in xrange(self.n_corr_shells)]
for i in xrange(self.n_corr_shells):
l = self.corr_shells[i][3] #*(1+self.corr_shells[i][4])
for j in xrange(len(self.gf_struct_corr[i])):
dm[i]['%s'%self.gf_struct_corr[i][j][0]] = numpy.zeros([l,l],numpy.float_)
#dm = [ {} for i in xrange(self.n_corr_shells)]
#for i in xrange(self.n_corr_shells):
# l = self.corr_shells[i][3] #*(1+self.corr_shells[i][4])
# for j in xrange(len(self.gf_struct_corr[i])):
# dm[i]['%s'%self.gf_struct_corr[i][j][0]] = numpy.zeros([l,l],numpy.float_)
for icrsh in xrange(self.n_corr_shells):
@ -676,10 +676,14 @@ class SumkLDA:
self.dc_imp[icrsh]['%s'%self.gf_struct_corr[icrsh][j][0]] = numpy.identity(l,numpy.float_)
blname = self.gf_struct_corr[icrsh][j][0]
Ncr[blname] = 0.0
for bl in self.map[iorb][blname]:
Ncr[blname] += dens_mat[bl].real.trace()
for a,al in self.gf_struct_solver[iorb]:
#for bl in self.map[iorb][blname]:
bl = self.map_inv[iorb][a]
#print 'bl, valiue = ',bl,dens_mat[a].real.trace()
Ncr[bl] += dens_mat[a].real.trace()
#print 'Ncr=',Ncr
M = self.corr_shells[icrsh][3]
Ncrtot = 0.0
@ -780,10 +784,11 @@ class SumkLDA:
# init self.Sigma_imp:
if type(Sigma_imp[0]) == GfReFreq:
if Sigma_imp[0].note == 'ReFreq':
# Real frequency Sigma:
self.Sigma_imp = [ BlockGf( name_block_generator = [ (a,GfReFreq(indices = al, mesh = Sigma_imp[0].mesh)) for a,al in self.gf_struct_corr[i] ],
make_copies = False) for i in xrange(self.n_corr_shells) ]
for i in xrange(self.n_corr_shells): self.Sigma_imp[i].note='ReFreq'
else:
# Imaginary frequency Sigma:
self.Sigma_imp = [ BlockGf( name_block_generator = [ (a,GfImFreq(indices = al, mesh = Sigma_imp[0].mesh)) for a,al in self.gf_struct_corr[i] ],