TRIQS / triqs_0.x

DEPRECATED -- This is the repository of the older versions of TRIQS
Other
11 stars 9 forks source link

error #137

Closed fatima2000 closed 10 years ago

fatima2000 commented 11 years ago

Hi, I would like to use the Hubbard-I solver on SrVO3 .I tried using Ce-gamma.py script.

this is the script I used for SrVO3.indmftpr

3 ! Nsort

1 1 I would like to use the Hubbard-I solver on SrVO3 .I tried using Ce-gamma.py script.3 !Mult(isrt)

3 ! lmax

complex

1 0 0 0 ! l included for each sort

0 0 0 0 ! l included for each sort

cubic

1 1 2 0 ! l included for each sort

0 0 2 0 ! l included for each sort

01 ! t2g Wannier function will be constructed

0 ! no spin-orbit

cubic

1 1 0 0 ! l included for each sort

0 0 0 0 ! l included for each sort

-0.075 0.14 ! Energy window relative to E_f

0.59953

and this is the script I used for SrVO3.py:

from pytriqs.Wien2k.SumK_LDA import from pytriqs.Wien2k.SumK_LDA_Wien2k_input import from pytriqs.Solvers.HubbardI.Solver_HubbardI import Solver_HubbardI

LDAFilename = 'SrVO3' Beta = 40 Uint = 2.70 JHund = 0.70 Loops = 3 # Number of DMFT sc-loops Mix = 0.7 # Mixing factor in QMC DC_type = 0 # 0...FLL, 1...Held, 2... AMF, 3...Lichtenstein DC_Mix = 1.0 # 1.0 ... all from imp; 0.0 ... all from Gloc

useBlocs = False # use bloc structure from LDA input useMatrix = True # use the U matrix calculated from Slater coefficients instead of (U+2J, U, U-J)

HDFfilename = LDAFilename+'.h5'

Convert DMFT input:

Can be commented after the first run

Converter = SumK_LDA_Wien2k_input(Filename=LDAFilename,repacking=False) Converter.convert_DMFT_input()

check if there are previous runs:

previous_runs = 0 previous_present = False

if MPI.IS_MASTER_NODE(): ar = HDF_Archive(HDFfilename,'a') if 'iterations' in ar: previous_present = True previous_runs = ar['iterations'] else: previous_runs = 0 previous_present = False del ar

MPI.barrier() previous_runs = MPI.bcast(previous_runs) previous_present = MPI.bcast(previous_present)

Init the SumK class

SK=SumK_LDA(HDFfile=LDAFilename+'.h5',UseLDABlocs=False)

Norb = SK.corr_shells[0][3] l = SK.corr_shells[0][2]

Init the Solver:

S = Solver_HubbardI(Beta = Beta, Uint = Uint, JHund = JHund, l = l, Verbosity=2) S.Nmoments=10

if (previous_present):

load previous data:

MPI.report("Using stored data for initialisation") if (MPI.IS_MASTER_NODE()): ar = HDF_Archive(HDFfilename,'a') S.Sigma <<= ar['SigmaF'] del ar S.Sigma = MPI.bcast(S.Sigma) SK.load()

DMFT loop:

for Iteration_Number in range(1,Loops+1): itn = Iteration_Number + previous_runs

# put Sigma into the SumK class:
SK.put_Sigma(Sigmaimp = [ S.Sigma ])

# Compute the SumK, possibly fixing mu by dichotomy
if SK.Density_Required and (Iteration_Number > 0):
    Chemical_potential = SK.find_mu( precision = 0.000001 )
else:
    MPI.report("No adjustment of chemical potential\nTotal density  = %.3f"%SK.total_density(mu=Chemical_potential))

# Density:
S.G <<= SK.extract_Gloc()[0]
MPI.report("Total charge of Gloc : %.6f"%S.G.total_density())
dm = S.G.density()

if ((Iteration_Number==1)and(previous_present==False)):

SK.SetDoubleCounting( dm, U_interact = Uint, J_Hund = JHund, orb = 0, useDCformula = DC_type)

# set atomic levels:
eal = SK.eff_atomic_levels()[0]
S.set_atomic_levels( eal = eal )

# update hdf5
if (MPI.IS_MASTER_NODE()):
    ar = HDF_Archive(HDFfilename,'a')
    ar['Chemical_Potential%s'%itn] = Chemical_potential
    del ar

# solve it:
S.Solve()

if (MPI.IS_MASTER_NODE()):
    ar = HDF_Archive(HDFfilename)
    ar['iterations'] = itn

# Now mix Sigma and G:
if ((itn>1)or(previous_present)):
    if (MPI.IS_MASTER_NODE()):
        MPI.report("Mixing Sigma and G with factor %s"%Mix)
        if ('SigmaF' in ar):
            S.Sigma <<= Mix * S.Sigma + (1.0-Mix) * ar['SigmaF']
        if ('GF' in ar):
            S.G <<= Mix * S.G + (1.0-Mix) * ar['GF']

    S.G = MPI.bcast(S.G)
    S.Sigma = MPI.bcast(S.Sigma)

if (MPI.IS_MASTER_NODE()):
    ar['SigmaF'] = S.Sigma
    ar['GF'] = S.G

# after the Solver has finished, set new double counting: 
dm = S.G.density()
SK.SetDoubleCounting( dm, U_interact = Uint, J_Hund = JHund, orb = 0, useDCformula = DC_type )
# correlation energy calculations:
correnerg = 0.5 * (S.G * S.Sigma).total_density()
MPI.report("Corr. energy = %s"%correnerg)
if (MPI.IS_MASTER_NODE()):
    ar['correnerg%s'%itn] = correnerg
    ar['DCenerg%s'%itn] = SK.DCenerg
    del ar

#Save stuff:
SK.save()
if (MPI.IS_MASTER_NODE()):
    print 'DC after solver: ',SK.dc_imp[SK.invshellmap[0]]

# do some analysis:
MPI.report("Orbital densities of impurity Green function:")
dm1 = S.G.density()
for s in dm1:
    MPI.report("Block %s: "%s)
    for ii in range(len(dm1[s])):
        str = ''
        for jj in range(len(dm1[s])):
            if (dm1[s][ii,jj].real>0):
                str += "   %.4f"%(dm1[s][ii,jj].real)
            else:
                str += "  %.4f"%(dm1[s][ii,jj].real)
        MPI.report(str)
MPI.report("Total charge of impurity problem : %.6f"%S.G.total_density())

find exact chemical potential

if (SK.Density_Required): SK.Chemical_potential = SK.find_mu( precision = 0.000001 ) dN,d = SK.calc_DensityCorrection(Filename = LDAFilename+'.qdmft')

MPI.report("Trace of Density Matrix: %s"%d)

correlation energy:

if (MPI.IS_MASTER_NODE()): ar = HDF_Archive(HDFfilename) itn = ar['iterations'] correnerg = ar['correnerg%s'%itn] DCenerg = ar['DCenerg%s'%itn] del ar correnerg -= DCenerg[0] f=open(LDAFilename+'.qdmft','a') f.write("%.16f\n"%correnerg) f.close()

The error message I got is:

Starting on 1 Nodes at : 2013-05-14 06:10:38.033072

Reading input from SrVO3.ctqmcout...

Reading symmetry input from SrVO3.symqmc...

Traceback (most recent call last):

File "SrVO3.py", line 67, in

SK.put_Sigma(Sigmaimp = [ S.Sigma ]) 

File

"/usr/local/codes/dmftproj/triqs_build/INSTALL_DIR/lib/python2.7/site-packages/pytriqs/Wien2k/SumK_LDA.py",

line 806, in put_Sigma

self.Sigmaimp[icrsh][self.mapinv[s][bl]][ind1,ind2] <<= Sigmaimp[s][bl][ind1,ind2]

File

"/usr/local/codes/dmftproj/triqs_build/INSTALL_DIR/lib/python2.7/site-packages/pytriqs/Base/GF_Local/GF.py",

line 227, in getitem

raise IndexError, "bloc index '" + repr(key) + "' incorrect. Possible indices are : "+

repr(self.__Indices)

IndexError: bloc index ''up0'' incorrect. Possible indices are : ['up', 'down']

can you help me?

thank you

leopo commented 11 years ago

I think this has already been discussed before, you may want to check the discussion here:

https://github.com/TRIQS/TRIQS/issues/92

fatima2000 commented 11 years ago

Dear Leonid, Thanks for your previous helps, As you said I deleted the old .h5 before restarting calculations with the new script but again I confronted another error. The error is: Solver has not yet converged Mixing Sigma and G with factor 0.7 DC for shell 0 and block up = 2.991580 DC for shell 0 and block down = 2.991580 DC energy for shell 0 = 1.69139343302 Traceback (most recent call last):
File "SrVO3.py", line 122, in
correnerg = 0.5 * (S.G \
S.Sigma).total_density()
File "/usr/local/codes/dmftproj/triqs_build/INSTALL_DIR/lib/python2.7/site-packages/pytriqs/Base/GF_Local/GF.py", line 356, in total_density
return sum([ g.total_density() for i,g in self ]).real File "/usr/local/codes/dmftproj/triqs_build/INSTALL_DIR/lib/python2.7/site-packages/pytriqs/Base/GF_Local/_GFBloc_concept_impl.py", line 157, in total_density
return numpy.trace(self.density()) RuntimeError: Triqs runtime error at /usr/local/codes/dmftproj/TRIQS-TRIQS-6f4c392/pytriqs/Base/GF_Local/C++/GF_Bloc_ImFreq.cpp : 47

Trace is: /usr/local/codes/dmftproj/triqs_build/pytriqs/Base/GF_Local/libLocalGreenFunction_c.so GF_Bloc_ImFreq::density() const 0x19f8 [0x2b40642133b8] /usr/local/codes/dmftproj/triqs_build/INSTALL_DIR/lib/python2.7/site-packages/pytriqs/Base/GF_Local/_pytriqs_GF.so boost::python::objects::caller_py_function_implboost::python::detail::caller<PyArray<std::complex<double, 2> (GF_BlocImFreq::)() const, boost::python::default_call_policies, boost::mpl::vector2<PyArray<std::complex, 2>, GF_Bloc_ImFreq &> > >::operator()(object, object) 0x39 [0x2b4061198969]
/usr/local/codes/dmftproj/triqs_build/foreignlibs/boost/libboost_for_triqs.so boost::python::objects::function::call(object, object) const 0x1af [0x2b4061763edf] /usr/local/codes/dmftproj/triqs_build/foreignlibs/boost/libboost_for_triqs.so 0xe6138 [0x2b4061764138] /usr/local/codes/dmftproj/triqs_build/foreignlibs/boost/libboost_for_triqs.so boost::python::detail::exception_handler::operator()(boost::function0 const &) const 0x43 [0x2b406174f3b3] /usr/local/codes/dmftproj/triqs_build/INSTALL_DIR/lib/python2.7/site-packages/pytriqs/boost/mpi.so boost::detail::function::function_obj_invoker2<boost::_bi::bind_t<bool, boost::python::detail::translate_exception<boost::mpi::python::object_without_skeleton, boost::mpi::python::translate_exception >, boost::_bi::list3boost::arg<1, boost::arg<2>, boost::_bi::valueboost::mpi::python::translate_exception > >, bool, boost::python::detail::exception_handler const &, boost::function0 const &>::invoke(boost::detail::function::function_buffer &, boost::python::detail::exception_handler const &, boost::function0 const &) 0x1c [0x2b40674fe69c] /usr/local/codes/dmftproj/triqs_build/foreignlibs/boost/libboost_for_triqs.so boost::python::detail::exception_handler::operator()(boost::function0 const &) const 0x26 [0x2b406174f396] /usr/local/codes/dmftproj/triqs_build/INSTALL_DIR/lib/python2.7/site-packages/pytriqs/boost/mpi.so boost::detail::function::function_obj_invoker2<boost::_bi::bind_t<bool, boost::python::detail::translate_exception<boost::mpi::exception, boost::mpi::python::translate_exception >, boost::_bi::list3boost::arg<1, boost::arg<2>, boost::_bi::valueboost::mpi::python::translate_exception > >, bool, boost::python::detail::exception_handler const &, boost::function0 const &>::invoke(boost::detail::function::function_buffer &, boost::python::detail::exception_handler const &, boost::function0 const &) 0x1c [0x2b40674f58cc] /usr/local/codes/dmftproj/triqs_build/foreignlibs/boost/libboost_for_triqs.so boost::python::detail::exception_handler::operator()(boost::function0 const &) const 0x26 [0x2b406174f396] /usr/local/codes/dmftproj/triqs_build/INSTALL_DIR/lib/python2.7/site-packages/pytriqs/Base/GF_Local/_pytriqs_GF.so boost::detail::function::function_obj_invoker2<boost::_bi::bind_t<bool, boost::python::detail::translateexception<std::string ()(std::string const &)>, boost::_bi::list3boost::arg<1, boost::arg<2>, boost::_bi::value<void (*)(std::string const &)> > >, bool, boost::python::detail::exception_handler const &, boost::function0 const &>::invoke(boost::detail::function::function_buffer &, boost::python::detail::exception_handler const &, boost::function0 const &) 0x13 [0x2b4061187933] /usr/local/codes/dmftproj/triqs_build/foreignlibs/boost/libboost_for_triqs.so boost::python::handle_exception_impl(boost::function0) 0x29 [0x2b406174f199] /usr/local/codes/dmftproj/triqs_build/foreignlibs/boost/libboost_for_triqs.so 0xe43d4 [0x2b40617623d4] /usr/lib64/libpython2.7.so.1.0 PyObject_Call 0x53 [0x3f14249383] /usr/lib64/libpython2.7.so.1.0 PyEval_EvalFrameEx 0x3cd5 [0x3f142debb5] /usr/lib64/libpython2.7.so.1.0 PyEval_EvalFrameEx 0x587e [0x3f142e075e] /usr/lib64/libpython2.7.so.1.0 PyEval_EvalFrameEx 0x587e [0x3f142e075e] /usr/lib64/libpython2.7.so.1.0 PyEval_EvalCodeEx 0x855 [0x3f142e19a5] /usr/lib64/libpython2.7.so.1.0 PyEval_EvalCode 0x32 [0x3f142e1ad2] /usr/lib64/libpython2.7.so.1.0 [0x3f142fbd5c] /usr/lib64/libpython2.7.so.1.0 PyRun_FileExFlags 0x90 [0x3f142fcb60] /usr/lib64/libpython2.7.so.1.0 PyRun_SimpleFileExFlags 0xdf [0x3f142fd5df] /usr/lib64/libpython2.7.so.1.0 Py_Main 0xbe5 [0x3f1430ef15] /lib64/libc.so.6 __libc_start_main 0xed [0x3f01c2169d] /usr/bin/python [0x400651] GF_Bloc_ImFreq::density : Green Function is not as 1/omega or less !!!

what should I do now? Thank you for your help.

leopo commented 11 years ago

It seems your Green's function does not have a correct asymptotic behavior. If you still have the problem could you post here the actual script you have been using?

fatima2000 commented 11 years ago

Thanks for your previous guidance, Note that, I've done LDA + DMFT calculation for the Ce-gamma with Hubbard-I solver, now want to do LDA + DMFT calculations for combination SrVO3 with CT-QMC solver but Unfortunately, the script is not correct for SrVO3.py And is not fully executed. Do I need to have another script or procedures of the Ce-gamma calculations with the Hubbard-I solver is done differently? and this is the script I used for SrVO3.py:

from pytriqs.Wien2k.SumK_LDA import from pytriqs.Wien2k.SumK_LDA_Wien2k_input import from pytriqs.Wien2k.Solver_MultiBand import from pytriqs.Base.GF_Local import from pytriqs.Base.Archive.HDF_Archive import * LDAFilename='srvo3' U = 2.7 J = 0.65 Beta = 40 Loops = 10 # Number of DMFT sc-loops Mix = 1.0 # Mixing factor of Sigma after solution of the AIM DeltaMix = 1.0 # Mixing factor of Delta as input for the AIM DC_type = 1 # DC type: 0 FLL, 1 Held, 2 AMF useBlocs = True # use bloc structure from LDA input useMatrix = False # True: Slater parameters, False: Kanamori parameters U+2J, U, U-J use_spinflip = False # use the full rotational invariant interaction? prec_mu = 0.0001 QMCcycles = 20000 Length_cycle = 200 Warming_iterations = 2000 Converter = SumK_LDA_Wien2k_input(Filename=LDAFilename,repacking=True) Converter.convert_DMFT_input() MPI.barrier() previous_runs = 0 previous_present = False if MPI.IS_MASTER_NODE(): ar = HDF_Archive(LDAFilename+'.h5','a') if 'iterations' in ar: previous_present = True previous_runs = ar['iterations'] del ar previous_runs = MPI.bcast(previous_runs) previous_present = MPI.bcast(previous_present)

if previous runs are present, no need for recalculating the bloc structure:

calc_blocs = useBlocs and (not previous_present) SK=SumK_LDA(HDFfile=LDAFilename+'.h5',UseLDABlocs=calc_blocs)

Norb = SK.corr_shells[0][3] l = SK.corr_shells[0][2] S=Solver_MultiBand(Beta=Beta,U_interact=U,J_Hund=J,Norb=Norb,useMatrix=useMatrix, T=SK.T[0] ,GFStruct=SK.GFStruct_Solver[0],map=SK.map[0], l=l, deg_orbs=SK.deg_shells[0], use_spinflip=use_spinflip)

S.N_Cycles = QMCcycles S.Length_Cycle = Length_cycle S.N_Warmup_Cycles = Warming_iterations if (previous_present): if (MPI.IS_MASTER_NODE()): ar = HDF_Archive(LDAFilename+'.h5','a') S.Sigma <<= ar['SigmaF'] del ar S.Sigma = MPI.bcast(S.Sigma) for IterationNumber in range(1,Loops+1) :

  SK.symm_deg_GF(S.Sigma,orb=0)                           # symmetrise Sigma
  SK.put_Sigma(Sigmaimp = [ S.Sigma ])                    # put Sigma into the SumK class:

  Chemical_potential = SK.find_mu( precision = prec_mu )  # find the chemical potential
  S.G <<= SK.extract_Gloc()[0]                            # calculation of the local Green function
  MPI.report("Total charge of Gloc : %.6f"%S.G.total_density())

  if ((IterationNumber==1)and(previous_present==False)):
      # Init the DC term and the real part of Sigma, if no previous run was found:
      dm = S.G.density()
      SK.SetDoubleCounting( dm, U_interact = U, J_Hund = J, orb = 0, useDCformula = DC_type)
      S.Sigma <<= GF_Initializers.Const(SK.dc_imp[0]['up'][0,0])

  # now calculate new G0:
  if (MPI.IS_MASTER_NODE()):
      # We can do a mixing of Delta in order to stabilize the DMFT iterations:
      S.G0 <<= S.Sigma + inverse(S.G)
      ar = HDF_Archive(LDAFilename+'.h5','a')
      if ((IterationNumber>1) or (previous_present)):
          MPI.report("Mixing input Delta with factor %s"%DeltaMix)
          Delta = (DeltaMix * S.G0.Delta()) + (1.0-DeltaMix) * ar['DeltaF']
          S.G0 <<= S.G0 + S.G0.Delta() - Delta

      ar['DeltaF'] = S.G0.Delta()
      S.G0 <<= inverse(S.G0)
      del ar

  S.G0 = MPI.bcast(S.G0)

  # Solve the impurity problem:
  S.Solve()

  # solution done, do the post-processing:
  MPI.report("Total charge of impurity problem : %.6f"%S.G.total_density())

  # Now mix Sigma and G with factor Mix, if wanted:
  if ((IterationNumber>1) or (previous_present)):
      if (MPI.IS_MASTER_NODE()):
          ar = HDF_Archive(LDAFilename+'.h5','a')
          MPI.report("Mixing Sigma and G with factor %s"%Mix)
          S.Sigma <<= Mix * S.Sigma + (1.0-Mix) * ar['SigmaF']
          S.G <<= Mix * S.G + (1.0-Mix) * ar['GF']
          del ar
      S.G = MPI.bcast(S.G)
      S.Sigma = MPI.bcast(S.Sigma)

  # Write the final Sigma and G to the hdf5 archive:
  if (MPI.IS_MASTER_NODE()):
      ar = HDF_Archive(LDAFilename+'.h5','a')
      ar['iterations'] = previous_runs + IterationNumber
      ar['SigmaF'] = S.Sigma
      ar['GF'] = S.G
      del ar

  # Now set new double counting:
  dm = S.G.density()
  SK.SetDoubleCounting( dm, U_interact = U, J_Hund = J, orb = 0, useDCformula = DC_type)

  #Save stuff:
  SK.save()

Kind regards.

aichhorn commented 11 years ago

The script looks fine. What does it mean, 'is not correct' and 'is not fully executed'. Where is the problem?

parcollet commented 10 years ago

No answer for 2 months. Closing.,