3
0
mirror of https://github.com/triqs/dft_tools synced 2024-11-01 03:33:50 +01:00
dft_tools/doc/tutorials/python/ipt_solver.py
Michel Ferrero 28140f14fb Work on documentation
Mainly on the python part. I had a quick browse through to check if
the scripts were still working.
2013-09-17 14:55:55 +02:00

27 lines
706 B
Python

from pytriqs.gf.local import *
class IPTSolver:
def __init__(self, **params):
self.U = params['U']
self.beta = params['beta']
# Matsubara frequency
self.g = GfImFreq(indices=[0], beta=self.beta)
self.g0 = self.g.copy()
self.sigma = self.g.copy()
# Imaginary time
self.g0t = GfImTime(indices=[0], beta = self.beta)
self.sigmat = self.g0t.copy()
def solve(self):
self.g0t <<= InverseFourier(self.g0)
self.sigmat <<= (self.U**2) * self.g0t * self.g0t * self.g0t
self.sigma <<= Fourier(self.sigmat)
# Dyson equation to get G
self.g <<= self.g0 * inverse(1.0 - self.sigma * self.g0)