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

Operator Arithmetic support to qubit_observable() in qchem #4138

Merged
merged 17 commits into from Jun 13, 2023

Conversation

Jaybsoni
Copy link
Contributor

Context:
Now that the new operator arithmetic machinery is integrated with pennylane (via enable_new_opmath()), we want to start making use of it across the codebase, specifically in the qchem module.

Description of the Change:
Update the qubit_observable() function in observable_hf.py to use operator arithmetic when active_new_opmath() is True.

Benefits:
We are slowly moving away from Hamiltonian and adopting the new machinery we have!

@Jaybsoni Jaybsoni requested a review from soranjh May 17, 2023 15:04
@github-actions
Copy link
Contributor

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 May 17, 2023

Codecov Report

Merging #4138 (49aa27c) into master (09f0af3) will increase coverage by 0.00%.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##           master    #4138   +/-   ##
=======================================
  Coverage   99.77%   99.77%           
=======================================
  Files         347      347           
  Lines       31416    31442   +26     
=======================================
+ Hits        31345    31371   +26     
  Misses         71       71           
Impacted Files Coverage Δ
pennylane/ops/qubit/attributes.py 100.00% <ø> (ø)
pennylane/__init__.py 100.00% <100.00%> (ø)
pennylane/fermi/__init__.py 100.00% <100.00%> (ø)
pennylane/fermi/fermionic.py 100.00% <100.00%> (ø)
pennylane/ops/op_math/exp.py 100.00% <100.00%> (ø)
pennylane/qchem/observable_hf.py 98.93% <100.00%> (+0.09%) ⬆️

@Jaybsoni
Copy link
Contributor Author

[sc-38630]

pennylane/qchem/observable_hf.py Outdated Show resolved Hide resolved
tests/qchem/test_observable_hf.py Show resolved Hide resolved
tests/qchem/test_observable_hf.py Outdated Show resolved Hide resolved
@Jaybsoni Jaybsoni requested a review from soranjh June 12, 2023 13:11
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! 🚀

Suggested a correction to an outdated example output, and one question :)

pennylane/qchem/observable_hf.py Outdated Show resolved Hide resolved
pennylane/qchem/observable_hf.py Show resolved Hide resolved
pennylane/qchem/observable_hf.py Outdated Show resolved Hide resolved
@timmysilv timmysilv added this to the v0.31 milestone Jun 12, 2023
@Jaybsoni Jaybsoni requested a review from lillian542 June 12, 2023 20:04
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.

Nice! 🎉

@Jaybsoni Jaybsoni enabled auto-merge (squash) June 12, 2023 20:08
@Jaybsoni Jaybsoni merged commit 64aa437 into master Jun 13, 2023
43 checks passed
@Jaybsoni Jaybsoni deleted the observable_hf_op_math branch June 13, 2023 05:44
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

5 participants