Пример #1
0
    def test_dHdpos2D(self):
        x_range = [0, 1]
        y_max = 10
        y_min = 0
        positions = [(0, 0), (1, 2), (1, 10)]
        potential = pot.flat_well(x_range=x_range, y_max=y_max, y_min=y_min)
        expected_result = np.array([(0, 0), (0, 0), (0, 0)])

        energies = potential.dhdpos(positions)
        self.assertEqual(
            type(expected_result),
            type(energies),
            msg=
            "returnType of potential was not correct! it should be an np.array"
        )
        np.testing.assert_almost_equal(desired=list(expected_result),
                                       actual=list(energies),
                                       err_msg="The results of " +
                                       potential.name + " are not correct!",
                                       decimal=8)
Пример #2
0
    def test_energies2D(self):
        x_range = [0, 1]
        y_max = 10
        y_min = 0
        positions = [(-1, -1), (1, 0.5), (1, 10)]
        expected_result = np.array([(10, 10), (0, 0), (0, 10)])

        potential = pot.flat_well(x_range=x_range, y_max=y_max, y_min=y_min)

        energies = potential.ene(positions)
        #print("HA",energies)
        self.assertEqual(
            type(expected_result),
            type(energies),
            msg=
            "returnType of potential was not correct! it should be an np.array"
        )
        np.testing.assert_almost_equal(desired=expected_result,
                                       actual=energies,
                                       err_msg="The results of " +
                                       potential.name + " are not correct!",
                                       decimal=8)
Пример #3
0
 def test_constructor(self):
     pot.flat_well()