-
Notifications
You must be signed in to change notification settings - Fork 603
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 openfermion conversion module to qml.qchem #2371
Conversation
Hello. You may have forgotten to update the changelog!
|
Codecov Report
@@ Coverage Diff @@
## master #2371 +/- ##
=======================================
Coverage 99.42% 99.42%
=======================================
Files 244 244
Lines 18360 18300 -60
=======================================
- Hits 18254 18195 -59
+ Misses 106 105 -1
Continue to review full report at Codecov.
|
qchem/tests/test_convert.py
Outdated
from pennylane import numpy as np | ||
from pennylane import qchem | ||
|
||
pytest.importorskip("openfermion") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does the order matter for the lines
from openfermion import QubitOperator
and pytest.importorskip("openfermion")
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As far as I understand the pytest docs, I think the pytest.importorskip("openfermion")
should come before attempting to import QubitOperator
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Modified it to openfermion = pytest.importorskip("openfermion")
and then used openfermion.QubitOperator
everywhere.
qchem/tests/test_convert.py
Outdated
from pennylane import numpy as np | ||
from pennylane import qchem | ||
|
||
pytest.importorskip("openfermion") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As far as I understand the pytest docs, I think the pytest.importorskip("openfermion")
should come before attempting to import QubitOperator
.
Looks great @soranjh. Just left a couple of minor comments. |
…nyLaneAI/pennylane into qchem_openfermion_conversion
pennylane/__init__.py
Outdated
from pennylane.ops import convert | ||
from pennylane.ops.convert import import_operator |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The module convert.py
which hosts functions for converting openfermion operator objects to pennylane objects is moved from qml.qchem
to qml.ops
because of the generality of the module.
tests/ops/test_convert.py
Outdated
openfermion = pytest.importorskip("openfermion") | ||
|
||
|
||
@pytest.fixture( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved from qml.qchem.tests.conftest
to here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good
There was a problem hiding this 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 please check the failing codecov test.
…nyLaneAI/pennylane into qchem_openfermion_conversion
Context:
This PR unifies the functions needed for converting openfermion objects to pennylane observables, also see here.
Description of the Change:
The
qml.hf.convert
module is moved insideqml.qchem
and other functions are modified to adapt with this change.Benefits:
Helps with decreasing external dependencies.
Possible Drawbacks:
NA
Related GitHub Issues:
NA