diff --git a/.github/workflows/push_event_workflow.yml b/.github/workflows/push_event_workflow.yml new file mode 100644 index 0000000..5550066 --- /dev/null +++ b/.github/workflows/push_event_workflow.yml @@ -0,0 +1,18 @@ +name: Push Event Workflow 🐍 + +on: push + +jobs: + unit-testing: + runs-on: ubuntu-latest + + steps: + - name : Checkout code + uses : actions/checkout@v4 + + - name : Install Packages + run : pip install -r requirements.txt + + - name : Run tests hamiltonians + run : pytest tests/test.py + diff --git a/requirements.txt b/requirements.txt index 842bf0c..87db180 100644 --- a/requirements.txt +++ b/requirements.txt @@ -9,8 +9,8 @@ pennylane-qiskit qiskit_ibm_provider pyyaml networkx -basis-set-exchange ipykernel pennylane-lightning jaxopt -optax \ No newline at end of file +optax +pytest diff --git a/tests/__init__.py b/tests/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/test.py b/tests/test.py new file mode 100644 index 0000000..54a7988 --- /dev/null +++ b/tests/test.py @@ -0,0 +1,16 @@ +import pennylane as qml +from pennylane import numpy as np +from quantumsim.variational.vqe import vqe_spin, vqe_fermihubbard, vqe_molecular + +#Test the hamiltonian of the h2 molecule +def test_hamiltonian_molecule(): + #pennylane hamiltonian + elements=["H", "H"] + coord=np.array([0.0, 0.0, 0.0, 0.0, 0.0, 1.0]) + H,q = qml.qchem.molecular_hamiltonian(elements, coord) + + #vqepy class + Hvqe = vqe_molecular(elements, coord, {}) + assert H.compare(Hvqe.hamiltonian) + +