def test_getPartitionFunction(self): """ Test the getPartitionFunction() method. """ Tlist = numpy.array([300,500,1000,1500,2000]) Qexplist = numpy.array([208.8907, 347.9285, 695.5234, 1043.118, 1390.713]) for T, Qexp in zip(Tlist, Qexplist): Qact = getPartitionFunction(T, self.energy, self.degeneracy, self.n0) self.assertAlmostEqual(Qexp / Qact, 1.0, 4, '{0} != {1} within 4 figures'.format(Qexp, Qact))
def test_getPartitionFunction(self): """ Test the getPartitionFunction() method. """ Tlist = numpy.array([300,500,1000,1500,2000]) Qexplist = numpy.array([208.8907, 347.9285, 695.5234, 1043.118, 1390.713]) for T, Qexp in zip(Tlist, Qexplist): Qact = getPartitionFunction(T, self.energy, self.degeneracy, self.n0) self.assertAlmostEqual(Qexp / Qact, 1.0, 4, '{0} != {1} within 4 figures'.format(Qexp, Qact))
def test_getDensityOfStates(self): """ Test the getDensityOfStates() method. """ Tlist = numpy.array([300,400,500,600]) Elist = numpy.arange(0, 40000., 20.) for T in Tlist: densStates = getDensityOfStates(Elist, self.energy, self.degeneracy, self.n0) Qact = numpy.sum(densStates * numpy.exp(-Elist / constants.R / T)) Qexp = getPartitionFunction(T, self.energy, self.degeneracy, self.n0) self.assertAlmostEqual(Qexp / Qact, 1.0, 2, '{0} != {1} within 2 figures'.format(Qexp, Qact))
def test_getDensityOfStates(self): """ Test the getDensityOfStates() method. """ Tlist = numpy.array([300,400,500,600]) Elist = numpy.arange(0, 40000., 20.) for T in Tlist: densStates = getDensityOfStates(Elist, self.energy, self.degeneracy, self.n0) Qact = numpy.sum(densStates * numpy.exp(-Elist / constants.R / T)) Qexp = getPartitionFunction(T, self.energy, self.degeneracy, self.n0) self.assertAlmostEqual(Qexp / Qact, 1.0, 2, '{0} != {1} within 2 figures'.format(Qexp, Qact))
def getPartitionFunction(self, T): return schrodinger.getPartitionFunction(T,self.energy,nmax=len(self.evals))