示例#1
0
 def test_get_partition_function(self):
     """
     Test the get_partition_function() method.
     """
     t_list = np.array([300, 500, 1000, 1500, 2000])
     q_exp_list = np.array([208.8907, 347.9285, 695.5234, 1043.118, 1390.713])
     for temperature, q_exp in zip(t_list, q_exp_list):
         q_act = get_partition_function(temperature, self.energy, self.degeneracy, self.n0)
         self.assertAlmostEqual(q_exp / q_act, 1.0, 4)
示例#2
0
 def test_get_density_of_states(self):
     """
     Test the get_density_of_states() method.
     """
     t_list = np.array([300, 400, 500, 600])
     e_list = np.arange(0, 40000., 20.)
     for temperature in t_list:
         dens_states = get_density_of_states(e_list, self.energy, self.degeneracy, self.n0)
         q_act = np.sum(dens_states * np.exp(-e_list / constants.R / temperature))
         q_exp = get_partition_function(temperature, self.energy, self.degeneracy, self.n0)
         self.assertAlmostEqual(q_exp / q_act, 1.0, 2)
示例#3
0
 def get_partition_function(self, T):
     return schrodinger.get_partition_function(T,
                                               self.energy,
                                               nmax=len(self.evals))