Skip to content

Commit

Permalink
add test for molecule with xyzfile
Browse files Browse the repository at this point in the history
  • Loading branch information
damarkian committed Dec 15, 2023
1 parent 73ba683 commit aba6b76
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
4 changes: 2 additions & 2 deletions doc/source/getting-started/hamiltonian.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
Hamiltonian
===========

Central to quantum chemical calculations for molecules is the fermionic two-body Hamiltonian in second quantized form.
Central to quantum chemical calculations for molecules is the fermionic spin-free nonrelativistic two-body Hamiltonian in second quantized form in the absence of external fields.

TODO: spinfree, nonrelativistic, without external fields, without nuclear-repulsion energy
In most literature it is written as follows, neglecting terms for the nuclear repulsion energy which is a constant under the Born-Oppenheimer approximation:

.. math::
\hat{H} = \sum_{pq} h_{pq} a^\dagger_p a_q + \frac12 \sum_{pqrs} g_{pqrs} a^\dagger_p a^\dagger_r a_s a_q
Expand Down
4 changes: 4 additions & 0 deletions tests/lih.xyz
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
2
0 1
Li 0.0 0.0 0.0
H 0.0 0.0 1.2
10 changes: 10 additions & 0 deletions tests/test_molecule.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,16 @@ def test_run_pyscf():
assert h2.e_hf == pytest.approx(h2_ref_energy)
assert np.allclose(h2.hcore, h2_ref_hcore)

def test_run_pyscf_molecule_xyz():
"""Pyscf driver with xyz file"""

lih_ref_energy = -7.83561582555692
lih = Molecule(xyz_file="lih.xyz")
lih.run_pyscf()

assert lih.e_hf == pytest.approx(lih_ref_energy)



@pytest.mark.skip(reason="psi4 doesn't offer pip install, so needs to be installed through conda or manually.")
def test_run_psi4():
Expand Down

0 comments on commit aba6b76

Please sign in to comment.