Skip to content

Commit

Permalink
Test module and github action
Browse files Browse the repository at this point in the history
  • Loading branch information
javinoram committed May 8, 2024
1 parent 7bc93c5 commit f293b34
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 4 deletions.
18 changes: 18 additions & 0 deletions .github/workflows/push_event_workflow.yml
Original file line number Diff line number Diff line change
@@ -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

3 changes: 1 addition & 2 deletions quantumsim/variational/vqe/molecular.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,5 @@ def __init__(self, symbols, coordinates, params= None):
basis= self.basis,
method= self.method,
active_electrons=self.active_electrons,
active_orbitals=self.active_orbitals,
load_data=True)
active_orbitals=self.active_orbitals)

4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ pennylane-qiskit
qiskit_ibm_provider
pyyaml
networkx
basis-set-exchange
ipykernel
pennylane-lightning
jaxopt
optax
optax
pytest
Empty file added tests/__init__.py
Empty file.
16 changes: 16 additions & 0 deletions tests/test.py
Original file line number Diff line number Diff line change
@@ -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)


0 comments on commit f293b34

Please sign in to comment.