Esempio n. 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)
Esempio n. 2
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)