Commit 43734dc6 authored by Jacob August Davison's avatar Jacob August Davison
Browse files

added imaginary time generator

parent 949d5917
......@@ -784,4 +784,86 @@ class BrillouinGenerator(Generator):
eta2B[i,j,a,b] = -val
return (eta1B, eta2B)
class ImTimeGenerator(Generator):
"""Calculate Imaginary time generator for a normal ordered Hamiltonian."""
def __init__(self, h):
assert isinstance(h, Hamiltonian), "Arg 0 must be Hamiltonian object"
self.f = h.f
self.G = h.G
self._holes = h.holes
self._particles = h.particles
self._sp_basis = h.sp_basis
def f(self):
f -- one-body tensor elements (initialized by Hamiltonian object)"""
return self._f
def G(self):
f -- two-body tensor elements (initialized by Hamiltonian object)"""
return self._G
def f(self, f):
"""Sets the one-body tensor."""
self._f = f
def G(self, G):
"""Sets the two-body tensor."""
self._G = G
def calc_eta(self):
bas1B = self._sp_basis
holes = self._holes
particles = self._particles
f = self.f
G = self.G
eta1B = np.zeros_like(f)
eta2B = np.zeros_like(G)
for a in particles:
for i in holes:
dE = f[a,a] - f[i,i] + G[a,i,a,i]
val = np.sign(dE)*f[a,i]
eta1B[a, i] = val
eta1B[i, a] = -val
for a in particles:
for b in particles:
for i in holes:
for j in holes:
dE = (
f[a,a] + f[b,b] - f[i,i] - f[j,j]
+ G[a,b,a,b]
+ G[i,j,i,j]
- G[a,i,a,i]
- G[a,j,a,j]
- G[b,i,b,i]
- G[b,j,b,j]
val = np.sign(dE)*G[a,b,i,j]
eta2B[a,b,i,j] = val
eta2B[i,j,a,b] = -val
return (eta1B, eta2B)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment