TRIQS / triqs_0.x

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

off-diagonal term in GFstruct #72

Closed srbhp closed 12 years ago

srbhp commented 12 years ago

Hi, Is there a way to assign off-diagonal term in the non-interacting green function in the Solver class ? So what i want to say that if the non-interacting problem is not diagonal then how one can solve it in ctqmc . I was trying to do it from an example at http://ipht.cea.fr/triqs/doc/user_manual/solvers/aim.html

Regards

mferrero commented 12 years ago

Hi. Sure, you can define off-diagonal Green's functions by changing GFstruct. For example, if you have a 2-orbital problem with orbital off-diagonal terms, you can define

GFstruct = [ ('up',[1,2]), ('down',[1,2]) ]

In that case, you have to express the Hamiltonian in terms of operators

C('up',1), C('up',2), C('down',1), C('down',2)

What problem are you willing to solve? Maybe I can give you more hints and eventually put the example in the documentation.

srbhp commented 12 years ago

Thanks for the reply. Probably i am clear to you. Think of a situation you are working in one orbital problem and in AIM model you have a term t' C\dag('up',1)C('down',1) + h.c along with H_{AIM}. So the non-interacting green function become a 2*2 matrix

G0["up","up"] G0["up","down"] G0["down","up"] G0["down","down"]

where G0["up","down"] is defined as -T[C('up',1),C\dag('down',1)]

If t'=0 then non-interacting problem reduce to a diagonal one. And we can assign the solver.G0 as discussed in the example http://ipht.cea.fr/triqs/doc/user_manual/solvers/aim.html I want know if t` is not zero then how do we assign it .

mferrero commented 12 years ago

I see. Well in your case, up and down are no longer blocks in the Green's function. The corresponding GFstruct is then

GFstruct = [ ('imp',['up','down']) ]

It has just one block (here I call it 'imp' but you could chose any name) and the off-diagonal indices are up and down. Now the operators are

C('imp','up'), C('imp','down')

So that you will have to write the interaction Hamiltonian as

H_Local = U * N('imp','up') * N('imp','down')

Note, that all quadratic terms are obtained from G0 which becomes something like

for spin, g0 in S.G0 :
    g0 <<= inverse( iOmega_n - numpy.array([[e_f,-tp],[-tp,e_f]]) - V**2 * Wilson(D) )

In addition, the local Hamiltonian does not commute with all the number operators of the problem. Therefore the segment picture cannot be used. Last but not least, the only conserved quantum number is the total number of particles. If you put all this together the script becomes

from pytriqs.Base.GF_Local import *
from pytriqs.Solvers.Operators import *
from pytriqs.Solvers.HybridizationExpansion import Solver
import numpy

D, V, U = 1.0, 0.2, 4.0
e_f, Beta = -U/2.0, 50
tp = 0.5

# The impurity solver
S = Solver(Beta = Beta,                                   # inverse temperature
           GFstruct = [ ('imp',['up','down']) ],          # Structure of the Green's function
           H_Local = U * N('imp','up') * N('imp','down'), # Local Hamiltonian
           Quantum_Numbers = {                            # Quantum Numbers
               'N' : N('imp','up')+N('imp','down') },     # (operators commuting with H_Local)
           N_Cycles  = 500000,                            # Number of QMC cycles
           Length_Cycle = 200,                            # Length of one cycle
           N_Warmup_Cycles = 10000,                       # Warmup cycles
           N_Legendre_Coeffs = 50,                        # Number of Legendre coefficients
           Random_Generator_Name = 'mt19937',             # Name of the random number generator
           Use_Segment_Picture = False                    # Use the segment picture
           )

# Initialize the non-interacting Green's function S.G0
for spin, g0 in S.G0 :
    g0 <<= inverse( iOmega_n - numpy.array([[e_f,-tp],[-tp,e_f]]) - V**2 * Wilson(D) )

# Run the solver. The result will be in S.G
S.Solve()

# Save the results in an hdf5 file (only on the master node)
from pytriqs.Base.Archive import HDF_Archive
import pytriqs.Base.Utility.MPI as MPI
if MPI.IS_MASTER_NODE():
  Results = HDF_Archive("solution.h5",'a')
  Results["G"] = S.G
  Results["Gl"] = S.G_Legendre

Hope this helps!

srbhp commented 12 years ago

Ok, It will solve my problem. Thanks

srbhp commented 12 years ago

Hi,

If I replace the following line

for spin, g0 in S.G0:
    g0 <<= inverse( iOmega_n - numpy.array([[e_f,-tp],[-tp,e_f]]) - V**2 * Wilson(D) )

by

for spin, g0 in S.G0 :
       g0['up','up'] = iOmega_n  - e_f - ( Wilson(1.0) )
       g0['up','down'] = -tp + 0.0*iOmega_n
       g0['up','down'] = -tp + 0.0*iOmega_n
       g0['down','down'] = iOmega_n  - e_f - ( Wilson(1.0) )
g0.invert()

what's wrong i am doing ? It's not clear how to specify each element of the green function. There is a similar example in the page

http://ipht.cea.fr/triqs/doc/user_manual/green/tutorial.html#a-slightly-more-complicated-example

Actually i want to g0['up','up'] to be different form g0['down','down'] . i.e.,

g0['down','down'] = iOmega_n  - e_f - ( Wilson(1.0) )
g0['up','up'] = iOmega_n  - e_f - Epl                   # Epl is a constant.

It would be better if you put a more generic example(it might not be simple one) .

Thanking You Saurabh

mferrero commented 12 years ago

Hi. Well I tried your code and it worked just fine here. Can you tell me want goes wrong? Do you get an error message?

srbhp commented 12 years ago

Hi, Results from your code and my code are different. I mean if i plot the green function they look different.

On 6 July 2012 00:55, Michel Ferrero < reply@reply.github.com

wrote:

Hi. Well I tried your code and it worked just fine here. Can you tell me want goes wrong? Do you get an error message?


Reply to this email directly or view it on GitHub: https://github.com/TRIQS/TRIQS/issues/72#issuecomment-6788103

Saurabh

mferrero commented 12 years ago

I see the problem. There are a couple of typos in your example that I have corrected without realizing: 1) you were setting twice the same off-diagonal element 'up','down' so the 'down','up' was left empty 2) you forgot the factor V**2 in front of Wilson(1.0). I got the same answer with this script

from pytriqs.Base.GF_Local import *
from pytriqs.Solvers.Operators import *
from pytriqs.Solvers.HybridizationExpansion import Solver
import numpy

D, V, U = 1.0, 0.2, 4.0
e_f, Beta = -U/2.0, 50
tp = 0.5

# The impurity solver
S = Solver(Beta = Beta,                                   # inverse temperature
           GFstruct = [ ('imp',['up','down']) ],          # Structure of the Green's function
           H_Local = U * N('imp','up') * N('imp','down'), # Local Hamiltonian
           Quantum_Numbers = {                            # Quantum Numbers
               'N' : N('imp','up')+N('imp','down') },     # (operators commuting with H_Local)
           N_Cycles  = 500000,                            # Number of QMC cycles
           Length_Cycle = 200,                            # Length of one cycle
           N_Warmup_Cycles = 10000,                       # Warmup cycles
           N_Legendre_Coeffs = 50,                        # Number of Legendre coefficients
           Random_Generator_Name = 'mt19937',             # Name of the random number generator
           Use_Segment_Picture = False                    # Use the segment picture
           )

# Initialize the non-interacting Green's function S.G0
for spin, g0 in S.G0 :
    g0['up','up'] = iOmega_n - e_f - V**2 * Wilson(D)
    g0['up','down'] = tp
    g0['down','up'] = tp
    g0['down','down'] = iOmega_n - e_f - V**2 * Wilson(D)
g0.invert()

# Run the solver. The result will be in S.G
S.Solve()

# Save the results in an hdf5 file (only on the master node)
from pytriqs.Base.Archive import HDF_Archive
import pytriqs.Base.Utility.MPI as MPI
if MPI.IS_MASTER_NODE():
  Results = HDF_Archive("solution.h5",'a')
  Results["G"] = S.G
  Results["Gl"] = S.G_Legendre
srbhp commented 12 years ago

Ok. I didn't notice it properly ... Thanks . I am closing it.

augustinsky commented 11 years ago

Could you please explain me why is it not possible to use the segment representation when the hybridization function is off-diagonal, but the interaction Hamiltonian has still the density-density form as you claim above?

mferrero commented 11 years ago

In the discussion above, the local Hamiltonian does not have a pure density-density form. While its quartic part is indeed density-density, it also has a quadratic term that connects the up and down spin components. As such, the local Hamiltonian does not commute with the number operator for all species. This is a necessary condition for being able to use the segment representation and this is why it cannot be used in the situation described above.

augustinsky commented 11 years ago

Maybe we are used to a different terminology.. Lets say that the Hamiltonian can be written as H = H_bath + H_hyb + H_loc and we expand in H_hyb. Then Hloc here is of a purely density-density type. Terms like c{k,up} d^\dagger_down belong to the hybridization part of the Hamiltonian. But then the segment representation should still be valid since the trace in expansion of Z decouples to a product of two traces and the local trace is zero unless d_i(\tau) and d^dagger_i(\tau) appear in the alternating order. Is this correct, or have I missed anything?

mferrero commented 11 years ago

What you are describing is a bit different from what we were discussing above. If off-diagonal terms do not appear in the local Hamiltonian, but only in the hybridization terms, then the segment representation is still valid. In that case indeed H_loc still commutes with all number operaotrs.

augustinsky commented 11 years ago

Oh, then I do not understand what is the model of interest. In the first contribution, the "off-diagonal term in the non-interacting green function" is mentioned. Therefore, the hybridization must be off-diagonal. And the input python script says that "H_Local = U * N('imp','up') * N('imp','down'), # Local Hamiltonian". So, is there any other term that belongs to H_Local but it is not explicitly mentioned?

mferrero commented 11 years ago

Hi. Actually, the non-interacting Green's function can be off-diagonal even if the hybridization itself is diagonal. This happens if there is a local hopping. To set the idea, think of a two Anderson impurity model where each impurity is connected to its own conduction bath. In that case, the non-interacting Green's function is off-diagonal but the hybridization is diagonal. This is the kind of model that was discussed above.

In the ctqmc solver, you have to specify H_Local which contains only the quartic part of the Hamiltonian (some more details in the documentation: http://ipht.cea.fr/triqs/doc/user_manual/solvers/settingparameters.html). The quadratic terms of the local Hamiltonian will be deduced from the knowledge of the non-interacting Green's function. Indeed the quadratic terms of the local Hamiltonian are nothing but the constant (in omega) term of the inverse of the non-interacting Green's function. In other word, just looking at H_Local does not tell you if there are local hoppings, you need to inspect G0 too. In the example above, the inspection of G0 shows that there are local hoppings and therefore the segment picture cannot be used.