def test_hf_state_plane_wave_basis_lowest_single_determinant_state(self):
grid_length = 7
dimension = 1
spinless = True
n_particles = 4
length_scale = 2.0
grid = Grid(dimension, grid_length, length_scale)
hamiltonian = jellium_model(grid, spinless)
hamiltonian_sparse = get_sparse_operator(hamiltonian)
hf_state = hartree_fock_state_jellium(grid, n_particles,
spinless, plane_wave=True)
HF_energy = expectation(hamiltonian_sparse, hf_state)
for occupied_orbitals in permutations(
[1] * n_particles + [0] * (grid_length - n_particles)):
state_index = numpy.sum(2 ** numpy.array(occupied_orbitals))
HF_competitor = csr_matrix(([1.0], ([state_index], [0])),
shape=(2 ** grid_length, 1))
self.assertLessEqual(
HF_energy, expectation(hamiltonian_sparse, HF_competitor))
_jellium_hf_state_test.py 文件源码
python
阅读 25
收藏 0
点赞 0
评论 0
评论列表
文章目录