Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade qchem to use fermionic operators #4336

Merged
merged 32 commits into from Jul 19, 2023
Merged

Upgrade qchem to use fermionic operators #4336

merged 32 commits into from Jul 19, 2023

Conversation

soranjh
Copy link
Contributor

@soranjh soranjh commented Jul 7, 2023

Context:
The qchem module is upgraded to use the fermionic operators of the fermi module.

Description of the Change:
The function fermionic_observable is modified to optionally return a FermiSentence.
The function qubit_observable is modified to optionally accept a FermiSentence as input.

Benefits:

Possible Drawbacks:

Related GitHub Issues:

@github-actions
Copy link
Contributor

github-actions bot commented Jul 7, 2023

Hello. You may have forgotten to update the changelog!
Please edit doc/releases/changelog-dev.md with:

  • A one-to-two sentence description of the change. You may include a small working example for new features.
  • A link back to this PR.
  • Your name (or GitHub username) in the contributors section.

@codecov
Copy link

codecov bot commented Jul 10, 2023

Codecov Report

Merging #4336 (101bd33) into master (d28df54) will increase coverage by 0.00%.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##           master    #4336   +/-   ##
=======================================
  Coverage   99.77%   99.77%           
=======================================
  Files         351      351           
  Lines       32411    32435   +24     
=======================================
+ Hits        32338    32362   +24     
  Misses         73       73           
Impacted Files Coverage Δ
pennylane/qchem/hamiltonian.py 100.00% <100.00%> (ø)
pennylane/qchem/observable_hf.py 100.00% <100.00%> (ø)
pennylane/qchem/tapering.py 99.51% <100.00%> (-0.01%) ⬇️

Copy link
Contributor

@lillian542 lillian542 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @soranjh! Looks like things are working and the demo notebooks run without warnings. 🚀

I left a few comments/questions, and I was wondering if a few more tests would be in order :)

pennylane/qchem/tapering.py Outdated Show resolved Hide resolved
pennylane/qchem/hamiltonian.py Outdated Show resolved Hide resolved
pennylane/qchem/hamiltonian.py Show resolved Hide resolved
pennylane/qchem/observable_hf.py Show resolved Hide resolved
pennylane/qchem/observable_hf.py Show resolved Hide resolved
pennylane/qchem/observable_hf.py Outdated Show resolved Hide resolved
tests/qchem/test_hamiltonians.py Show resolved Hide resolved
Copy link
Contributor

@trbromley trbromley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @soranjh! Please could you add an entry to the deprecations page, as I've realized that this upgrade effectively contains a deprecation of the old behaviour.

Copy link
Contributor

@Jaybsoni Jaybsoni left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just some small changes, looks good overall.

Since we are deprecating the default functionality, we should also make sure to test that the warnings we raise are actually being raised. This might be a bit overkill as the warning will be removed soon aswell, but shouldn't take too long

pennylane/qchem/hamiltonian.py Show resolved Hide resolved
pennylane/qchem/hamiltonian.py Show resolved Hide resolved
pennylane/qchem/tapering.py Outdated Show resolved Hide resolved
tests/qchem/test_hamiltonians.py Outdated Show resolved Hide resolved
tests/qchem/test_hamiltonians.py Show resolved Hide resolved
tests/qchem/test_observable_hf.py Outdated Show resolved Hide resolved
@soranjh
Copy link
Contributor Author

soranjh commented Jul 17, 2023

Just some small changes, looks good overall.

Since we are deprecating the default functionality, we should also make sure to test that the warnings we raise are actually being raised. This might be a bit overkill as the warning will be removed soon aswell, but shouldn't take too long

Added tests for warnings.

Copy link
Contributor

@lillian542 lillian542 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me! Thanks @soranjh 🚀

Copy link
Contributor

@Jaybsoni Jaybsoni left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!

@soranjh soranjh merged commit 275a905 into master Jul 19, 2023
43 checks passed
@soranjh soranjh deleted the qchem_uses_fermi branch July 19, 2023 14:11
@trbromley
Copy link
Contributor

[SC-39865]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants