-
Notifications
You must be signed in to change notification settings - Fork 575
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
Group quantum chemistry templates #1822
Group quantum chemistry templates #1822
Conversation
|
||
dev = qml.device('default.qubit', wires=5) | ||
|
||
@qml.qnode(dev) | ||
def circuit(weight, wires1=None, wires2=None): | ||
DoubleExcitationUnitary(weight, wires1=wires1, wires2=wires2) | ||
FermionicDoubleExcitation(weight, wires1=wires1, wires2=wires2) |
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.
quick comment @obliviateandsurrender: as of the upcoming PL release, we now support qml.TemplateName
directly, so will be rewriting all tutorials and examples. So here you could simply have
FermionicDoubleExcitation(weight, wires1=wires1, wires2=wires2) | |
qml.FermionicDoubleExcitation(weight, wires1=wires1, wires2=wires2) |
and remove the import above (and similarly, qml.templates.TemplateName
can be replaced with qml.TemplateName
where it appears)
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.
Hey, thanks for the update! I have incorporated this for the templates (and their unit tests) that are being modified in this PR. I hope that should be fine.
Codecov Report
@@ Coverage Diff @@
## master #1822 +/- ##
=======================================
Coverage 98.92% 98.92%
=======================================
Files 209 209
Lines 15744 15744
=======================================
Hits 15575 15575
Misses 169 169
Continue to review full report at Codecov.
|
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 amazing! Thank you for doing this @obliviateandsurrender
I'd just like to re-order the templates, otherwise good to go from my side
doc/introduction/templates.rst
Outdated
Quantum Chemistry templates | ||
--------------------------- | ||
|
||
Quantum chemistry templates define various heuristic ansätze used in variational algorithms |
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.
Quantum chemistry templates define various heuristic ansätze used in variational algorithms | |
Quantum chemistry templates define various quantum circuits used in variational algorithms |
Quantum chemistry templates define various heuristic ansätze used in variational algorithms | ||
like VQE to perform quantum chemistry simulations. | ||
|
||
.. customgalleryitem:: |
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.
Let's order them based on importance. I would suggest:
AllSinglesDoubles
GateFabric
UCCSD
k-UpGCCSD
PC1
PC2
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.
Would FermionicSingleExcitation
and FermionicDoubleExcitation
also belong 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.
I was considering the same. @ixfoduap, what do you think about it?
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.
I think these are better left as subroutines since they are not really templates you would use to build a circuit
doc/releases/changelog-dev.md
Outdated
* Templates `SingleExcitationUnitary` and `DoubleExcitationUnitary` have been renamed | ||
to `FermionicSingleExcitation` and `FermionicDoubleExcitation`, respectively. | ||
[(#1822)](https://github.com/PennyLaneAI/pennylane/pull/1822) |
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.
This item might fit into Breaking changes more. It breaks code that used to use templates before the renaming.
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.
I actually thought I wrote it under the Breaking changes. I have shifted it there now.
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 me! 💯
Context:
Group the templates related to quantum chemistry under a common header.
Description of the Change:
ParticleConservingU1
,ParticleConservingU2
,GateFabric
(from Layer templates section) andAllSinglesDoubles
,UCCSD
,k-UpCCGSD
(from Other subroutines section) to Quantum Chemistry templates section.SingleExcitationUnitary
andDoubleExcitationUnitary
toFermionicSingleExcitation
andFermionicDoubleExcitation
, respectively, since the term 'Unitary' seemed somewhat redundant.customgalleryitem
(defined by GALLERY_TEMPLATE variable) to solve the issue regarding the name of some templates overflowing to an additional line, hence breaking the grid design.Benefits:
Sends a clear message that Pennylane supports a dedicated collection of templates for quantum chemistry.
Possible Drawbacks:
None.
Related GitHub Issues:
None.