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

Add spin and particle number observables to hf #2197

Merged
merged 13 commits into from
Feb 23, 2022

Conversation

soranjh
Copy link
Contributor

@soranjh soranjh commented Feb 11, 2022

Context:
This PR modifies the spin and particle number observable functions to use qml.hf fermionic-to-qubit transformation.

Description of the Change:
The existing qml.qchem functions spin2, spinz, and particle_number are modified.

Benefits:
Removes dependency to OpenFermion for computing the spin and particle number observables.

Possible Drawbacks:
Users can only use the Jordan–Wigner transformation because other transformations are not yet supported in PennyLane.

Related GitHub Issues:
NA

@soranjh soranjh added WIP 🚧 Work-in-progress qchem ⚛️ Related to the QChem package labels Feb 11, 2022
@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 Feb 11, 2022

Codecov Report

Merging #2197 (8ef681f) into qchem_refactor (f5910fb) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@               Coverage Diff               @@
##           qchem_refactor    #2197   +/-   ##
===============================================
  Coverage           99.26%   99.27%           
===============================================
  Files                 232      234    +2     
  Lines               18350    18412   +62     
===============================================
+ Hits                18216    18278   +62     
  Misses                134      134           
Impacted Files Coverage Δ
pennylane/hf/__init__.py 100.00% <100.00%> (ø)
pennylane/hf/particle_number.py 100.00% <100.00%> (ø)
pennylane/hf/spin.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f5910fb...8ef681f. Read the comment docs.

pennylane/hf/spin.py Outdated Show resolved Hide resolved
@soranjh soranjh changed the title [WIP] add spin and particle number observables to hf Add spin and particle number observables to hf Feb 14, 2022
@soranjh soranjh removed the WIP 🚧 Work-in-progress label Feb 14, 2022
@soranjh soranjh marked this pull request as ready for review February 14, 2022 19:14
Copy link
Contributor

@agran2018 agran2018 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 good! Note that the name of the module is spin even though it also contains a function to build the particle number operator.

Copy link
Contributor

@obliviateandsurrender obliviateandsurrender left a comment

Choose a reason for hiding this comment

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

Look good to go! Just thinking about @agran2018's comment on the particle_number function.

@soranjh
Copy link
Contributor Author

soranjh commented Feb 18, 2022

Thanks @soranjh . Looks good! Note that the name of the module is spin even though it also contains a function to build the particle number operator.

Separated.

@soranjh
Copy link
Contributor Author

soranjh commented Feb 18, 2022

Look good to go! Just thinking about @agran2018's comment on the particle_number function.

Separated.

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 go! Just a few small clarifications 💯

pennylane/hf/spin.py Show resolved Hide resolved
pennylane/hf/particle_number.py Outdated Show resolved Hide resolved
pennylane/hf/particle_number.py Outdated Show resolved Hide resolved
pennylane/hf/particle_number.py Outdated Show resolved Hide resolved
tests/hf/test_spin.py Show resolved Hide resolved
pennylane/hf/spin.py Outdated Show resolved Hide resolved
pennylane/hf/spin.py Outdated Show resolved Hide resolved
@soranjh soranjh merged commit c3ba701 into qchem_refactor Feb 23, 2022
@soranjh soranjh deleted the qchem_spin_observable branch February 23, 2022 21:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
qchem ⚛️ Related to the QChem package
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants