Skip to content

Conversation

Exferro
Copy link

@Exferro Exferro commented Aug 2, 2022

Before submitting

Please complete the following checklist when submitting a PR:

  • Ensure that your tutorial executes correctly, and conforms to the
    guidelines specified in the README.

  • Add a thumbnail link to your tutorial in beginner.rst, or if a
    QML implementation, in implementations.rst.

  • All QML tutorials conform to
    PEP8 standards.
    To auto format files, simply pip install black, and then
    run black -l 100 path/to/file.py.

When all the above are checked, delete everything above the dashed
line and fill in the pull request template.


Title: Quantum Phase Estimation for Molecular Ground State Energies

Summary:

Relevant references:

Possible Drawbacks:

Related GitHub Issues:

@github-actions
Copy link

github-actions bot commented Aug 2, 2022

Thank you for opening this pull request.

You can find the built site at this link.

Deployment Info:

  • Pull Request ID: 535
  • Deployment SHA: 6b0bb15e5e7879a66a3feed3bd558d94d2a2d4d1
    (The Deployment SHA refers to the latest commit hash the docs were built from)

Note: It may take several minutes for updates to this pull request to be reflected on the deployed site.

Copy link
Contributor

@KetpuntoG KetpuntoG left a comment

Choose a reason for hiding this comment

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

Here is a first round of comments. It looks good!
There are still things to correct 😄
be careful with taking for granted things that the reader does not have to know

@@ -0,0 +1,803 @@
"""
Title: Quantum Phase Estimation for molecular energies Date: 2022-07-25
Copy link
Contributor

Choose a reason for hiding this comment

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

The format is different from the how-tos, see this example
Captura de pantalla 2022-08-11 a las 13 25 17
:


######################################################################
# Hi! It seems that you were wandering around the PennyLane website and
# opened the demo called “Finding Ground State Energies via Quantum Phase
Copy link
Contributor

Choose a reason for hiding this comment

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

The name that appears in the website is "Relating energies to quantum phases". I think when you change the title format it will fix itself.

ax.set_xlabel("Readout bitstring index ($l$)")
ax.set_ylabel(r"Measurement probability ($\left|\alpha_l\right|^2$)")
ax.legend()

Copy link
Contributor

Choose a reason for hiding this comment

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

Write plt.show() to avoid warnings.

Copy link
Contributor

Choose a reason for hiding this comment

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

Also the xkcd fonts are not found and generating an error for me.

Copy link
Contributor

Choose a reason for hiding this comment

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

The orange line in this plot is hard to see

Copy link
Contributor

Choose a reason for hiding this comment

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

And the axis label is cut off.

# determinants with different number of electrons.
#
# Altogether all this completely spoils the estimate of the QPE circuit
# even for a simple system as H\ :math:`_3^{+}` :/. On the other hand the
Copy link
Contributor

Choose a reason for hiding this comment

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

you can use emojis if you want haha 🤨😮🤯

ax.set_yscale('log')


######################################################################
Copy link
Contributor

Choose a reason for hiding this comment

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

Image appears cropped

Copy link
Contributor

Choose a reason for hiding this comment

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

Perhaps connecting the dots with a line would make it clearer. The first time I didn't see the bottom dot 🙈

#

######################################################################
# [1] If not, no worries, but briefly yes, we hope that the
Copy link
Contributor

Choose a reason for hiding this comment

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

In the demos, the footers do not look good 😅 Try to insert them in the text or simply remove them



######################################################################
# {% from ‘author_bio.html’ import author_bio %} {{
Copy link
Contributor

Choose a reason for hiding this comment

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

the bio is put differently, look at this example. Also, for the authors the image is saved in another folder

Exferro and others added 17 commits August 17, 2022 13:37
Co-authored-by: Guillermo Alonso-Linaje <65235481+KetpuntoG@users.noreply.github.com>
Co-authored-by: Guillermo Alonso-Linaje <65235481+KetpuntoG@users.noreply.github.com>
Co-authored-by: Guillermo Alonso-Linaje <65235481+KetpuntoG@users.noreply.github.com>
Co-authored-by: Guillermo Alonso-Linaje <65235481+KetpuntoG@users.noreply.github.com>
Co-authored-by: Guillermo Alonso-Linaje <65235481+KetpuntoG@users.noreply.github.com>
Co-authored-by: Guillermo Alonso-Linaje <65235481+KetpuntoG@users.noreply.github.com>
Co-authored-by: Guillermo Alonso-Linaje <65235481+KetpuntoG@users.noreply.github.com>
@jen-dodd jen-dodd self-requested a review August 23, 2022 20:48
"""
######################################################################
#
# Hi! It seems that you were wandering around the PennyLane website and
Copy link
Contributor

Choose a reason for hiding this comment

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

I like a casual introduction but I think this will read a little oddly to most people who arrive here as only a minority get here from the website; most come via links from twitter and so on.

Copy link

Choose a reason for hiding this comment

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

Agree!

# 1. Quantum computers will make finding the ground state energies easier.
# 2. The quantum phase estimation (QPE) algorithm should be somehow involved there — and you are keen to learn how ground state energies and QPE go together.
#
# Well, in this case you
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
# Well, in this case you
#

# In the next section we will go greedy and will look at the accuracy
# improvements that we can get by adding more qubits in the readout
# register :3!
#
Copy link

Choose a reason for hiding this comment

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

I'm confused, why use QPE after VQE, if VQE already gave us something very precise? I don't understand the point of this whole exercise much! Could you clarify?

Choose a reason for hiding this comment

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

Hi @alvaro-at-xanadu! I've added a small explanation on this point. I agree that for this particular case it is pointless to use the QPE after the VQE which is already giving the exact answer. On the other hand for the demo should be clarifying because corresponds to the textbook case where we are using the exact eigenstate as input for the QPE.

Copy link

@ghost ghost left a comment

Choose a reason for hiding this comment

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

I learned a lot from this demo! 💯 But to be production-quality, it still needs several changes:

  • There's an incomplete section
  • Typos and grammar, acronyms
  • Some parts require more explanation. Mostly the initial QPE code, the use of QPE after VQE.
  • Code needs more comments

Please do not click on resolve conversation in any of the comments. Only reviewers will do this. If you need to implement a suggestion, click on commit suggestion. And if you've already fixed some of these locally, please don't forget to push the latest version as you do!

@KetpuntoG
Copy link
Contributor

I learned a lot from this demo! 💯 But to be production-quality, it still needs several changes:

  • There's an incomplete section
  • Typos and grammar, acronyms
  • Some parts require more explanation. Mostly the initial QPE code, the use of QPE after VQE.
  • Code needs more comments

Please do not click on resolve conversation in any of the comments. Only reviewers will do this. If you need to implement a suggestion, click on commit suggestion. And if you've already fixed some of these locally, please don't forget to push the latest version as you do!

@Exferro @davidecast , could you work on the requested changes?
Remark again, you will have to click on commit suggestion if you accept the change :)

davidecast and others added 5 commits November 7, 2022 17:00
Co-authored-by: alvaro-at-xanadu <91897656+alvaro-at-xanadu@users.noreply.github.com>
Co-authored-by: alvaro-at-xanadu <91897656+alvaro-at-xanadu@users.noreply.github.com>
Co-authored-by: alvaro-at-xanadu <91897656+alvaro-at-xanadu@users.noreply.github.com>
Co-authored-by: alvaro-at-xanadu <91897656+alvaro-at-xanadu@users.noreply.github.com>
@Exferro
Copy link
Author

Exferro commented Nov 12, 2022

Hey @KetpuntoG!
I know, this is long overdue, but I got buried under lots of academic/teaching obligations, I will get back to this demo when the Oxford term is over, i.e. on the week starting December 5.

Sorry for keeping postponing!

@KetpuntoG
Copy link
Contributor

Let's try to finish this soon in January :)

@KetpuntoG
Copy link
Contributor

@Exferro @davidecast please do not leave this

@davidecast
Copy link

Hi @KetpuntoG!

Sorry for replying late and that we are dragging our last fixes, I will work on the remaining changes requested in the next days and then @Exferro will go on from there.

davidecast and others added 14 commits January 22, 2023 15:49
Co-authored-by: Alvaro Ballon <91897656+alvaro-at-xanadu@users.noreply.github.com>
Co-authored-by: Alvaro Ballon <91897656+alvaro-at-xanadu@users.noreply.github.com>
Co-authored-by: Alvaro Ballon <91897656+alvaro-at-xanadu@users.noreply.github.com>
Co-authored-by: Alvaro Ballon <91897656+alvaro-at-xanadu@users.noreply.github.com>
Co-authored-by: Alvaro Ballon <91897656+alvaro-at-xanadu@users.noreply.github.com>
Co-authored-by: Alvaro Ballon <91897656+alvaro-at-xanadu@users.noreply.github.com>
Co-authored-by: Alvaro Ballon <91897656+alvaro-at-xanadu@users.noreply.github.com>
Co-authored-by: Alvaro Ballon <91897656+alvaro-at-xanadu@users.noreply.github.com>
Co-authored-by: Alvaro Ballon <91897656+alvaro-at-xanadu@users.noreply.github.com>
Co-authored-by: Alvaro Ballon <91897656+alvaro-at-xanadu@users.noreply.github.com>
Co-authored-by: Alvaro Ballon <91897656+alvaro-at-xanadu@users.noreply.github.com>
Co-authored-by: Alvaro Ballon <91897656+alvaro-at-xanadu@users.noreply.github.com>
Co-authored-by: Alvaro Ballon <91897656+alvaro-at-xanadu@users.noreply.github.com>
@KetpuntoG
Copy link
Contributor

A new QPE demo with the new PL features is on the way. I close this PR as it is not expected to be merged

@KetpuntoG KetpuntoG closed this Dec 6, 2023
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.

6 participants