def test_poschl_teller(self, lam, a, center): grids = np.linspace(-10, 10, 1001) vp = single_electron.poschl_teller(grids, lam, a, center) # Potential should have same shape with grids. self.assertTrue(vp.shape, grids.shape) # Potential should be zero at two ends of the grids. self.assertAlmostEqual(vp[0], 0) self.assertAlmostEqual(vp[-1], 0) # Minimum of the potential at x=center. self.assertAlmostEqual(grids[np.argmin(vp)], center)
def test_poschl_teller_invalid_lam(self): with self.assertRaisesRegexp( ValueError, 'lam is expected to be positive but got -1.50'): single_electron.poschl_teller(np.linspace(-10, 10, 1001), lam=-1.5)