Example #1
0
    def test_dHdpos(self):
        Vmax = 100
        a = 0
        b = 8

        positions = [0, 0.1, 0.2, 0.5, 1, 2, 3, 6]
        expected_result = np.array([
            0, -0.62490234, -1.24921875, -3.11279297, -6.15234375, -11.71875,
            -16.11328125, -16.40625
        ])

        potential = pot.doubleWellPot(Vmax=Vmax, a=a, b=b)
        energies = potential.dhdpos(positions)

        #print(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=2)
Example #2
0
    def test_energies(self):
        Vmax = 100
        a = 0
        b = 8

        positions = np.linspace(-10, 10, num=5)
        expected_result = np.array(
            [31.640625, 37.13378906, 100, 37.13378906, 31.640625])

        potential = pot.doubleWellPot(Vmax=Vmax, a=a, b=b)
        energies = potential.ene(positions)

        #print(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=2)
Example #3
0
 def test_constructor(self):
     potential = pot.doubleWellPot()