def test_quantum_harmonic_oscillator(self): grids = np.linspace(-5, 5, 501) dx = single_electron.get_dx(grids) # Exact ground state density of the quantum harmonic oscillator (k=1): # \pi^(-1/2) \exp(-x^2) density = np.sqrt(1 / np.pi) * np.exp(-grids**2) # Its corresponding kinetic energy is 0.25. np.testing.assert_allclose(single_electron.vw_grid(density, dx), 0.25, atol=1e-7)
def test_get_dx(self): np.testing.assert_allclose( single_electron.get_dx(np.linspace(0, 1, 11)), 0.1)