Exemple #1
0
 def runGrandcanonicalHubbardDimer(self):
     h = Hubbard([[0, -1], [-1, 0]], 1)
     ensemble = GrandcanonicalEnsemble(h, 1, .5)
     ensemble.calcOccupation()
     self.assertEqual(ensemble.getTotalOccupation(), 2)
     for state in h.orderedSingleParticleStates:
         self.assertAlmostEqual(ensemble.occupation.getExpectationValue(state), .5)
Exemple #2
0
 def runG1Calculation(self):
     h = Hubbard([[0, -1], [-1, 0]], 1)
     ensemble = GrandcanonicalEnsemble(h, 1, .5)
     statePair = (('up', 1),('up', 1))
     ensemble.calcG1([statePair])
     ensemble.g1.setMesh(100, -2, 2)
     ensemble.g1.setRetarded(numpy.pi)
     a = ensemble.g1.getSpectralFunction(statePair)
     ensemble.g1.setMatsubaraMesh(20, 1)
     ensemble.g1.setMatsubara()
     giw = ensemble.g1.getMatsubara(statePair)
Exemple #3
0
import numpy as np
from EasyED.ensembles import GrandcanonicalEnsemble
from EasyED.hamiltonians import Hubbard, Hubbard2
from EasyED.util import report
from reduceddensitymatrix import ReducedDensityMatrix as RDM


beta = 10
t = -1
tp = 0
u = 3
mu = u*.5

hop = [[0,t,t,tp],[t,0,tp,t],[t,tp,0,t],[tp,t,t,0]]
hamiltonian = Hubbard2(hop, u)
plaq = GrandcanonicalEnsemble(hamiltonian, beta, mu)
plaq.calcEigensystem()
e0 = plaq.hamiltonian.getGroundStateEnergy()
energies = plaq.hamiltonian.eigenEnergies
eigenstates = plaq.hamiltonian.eigenStates.toarray()
rho_dim = RDM(beta, eigenstates, energies, 4, 4, [], [0])
rho_dim.calculate()
print rho_dim.get_entanglement_spectrum()
print rho_dim.get_entanglement_entropy()

hamiltonian = Hubbard(hop, u)
print hamiltonian.singleParticleBasis
plaq = GrandcanonicalEnsemble(hamiltonian, beta, mu)
plaq.calcEigensystem()
e0 = plaq.hamiltonian.getGroundStateEnergy()
energies = plaq.hamiltonian.eigenEnergies
Exemple #4
0
 def runMuByFillingEstimation(self):
     h = Hubbard([[0, -1], [-1, 0]], 1)
     ensemble = GrandcanonicalEnsemble(h, 1, 0)
     ensemble.setMuByFilling(2, .4, .6)
     self.assertEqual(ensemble.getTotalOccupation(), 2)
     self.assertEqual(ensemble.mu, .5)