IBM-Quantum-Technical-Enablement / quantum-enablement

IBM Quantum Engineering and Enabling Technologies
Apache License 2.0
26 stars 8 forks source link

docs(notebooks): add ADAPT-VQE tutorial #22

Closed MeltemTolunay closed 3 months ago

MeltemTolunay commented 3 months ago

Summary

Add ADAPT-VQE tutorial.

Details and comments

This tutorial uses Qiskit Pattern formalism and does not rely on any application packages such as Qiskit Nature. LiH ground state computation is chosen as an example in this tutorial. Functions to build the problem Hamiltonian, the initial Hartree-Fock state, the single and double excitation operators under the Jordan-Wigner transform and the gradient are all explicitly written.

coveralls commented 3 months ago

Pull Request Test Coverage Report for Build 8489904237

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details


Totals Coverage Status
Change from base Build 8481137071: 0.0%
Covered Lines: 290
Relevant Lines: 290

💛 - Coveralls
pedrorrivero commented 3 months ago

@haimeng-zhang let's try to have this reviewed by end of day tomorrow so that @MeltemTolunay can act on the feedback and we can merge by Friday.

haimeng-zhang commented 3 months ago

The notebook looks great! Here are a few suggestions:

  1. update to EstimatorV2
  2. Not sure if this is the latest version, but cell 32, which runs VQE on the hardware, does not terminate with the full results.

Some more thoughts below (I think we can discuss and address them in a later version)

  1. I think it is worthwhile to spend 1-2 more sentences explaining technical terms, e.g., the UCC ansatz and Cholesky decomposition, to help guide readers with less background knowledge.
  2. I found the printout messages helpful, e.g., the accuracy of Cholesky decomposition, the number of opeators in the opool. I think it will be helpful to add 1-2 sentences explaining to the readers how the information is relevant to the VQE implementation.
  1. It will be helpful to call out the considerations for setting the Options() class for the Estimator() (for example, noise resilience level and shots). Side question: are 2000 shots enough for this type of task?
  1. For places that use URLs, I found it more readable to use markdown [link discriptor](https://link-url-here.org) instead of displaying the plain URL.
  2. In cell 8, try hf_circuit.draw(output="mpl", style="iqp"); it may suppress the warning message.
MeltemTolunay commented 3 months ago

I made the following changes per @haimeng-zhang's review:

  1. updated to EstimatorV2 for hardware runs
  2. set options to EstimatorV2 and increased the number of shots to 10000
  3. cleaned the URLs
  4. insert style="iqp" to suppress the error messages for circuit drawings

Later we can also discuss inserting more explanation for the chemistry background. Since a regular VQE tutorial will soon be made available on the Learning Platform where these information are already available, I think we can omit these in this tutorial for now.

MeltemTolunay commented 3 months ago

Thank you for the comments @pedrorrivero! I made the requested changes.

  1. I currently added pyscf as a dependency. I'm actually not familiar with issues on other operating systems, I can confirm with quantum chemistry colleagues.
  2. All estimator primitives are V2, gradient and cost functions are updated accordingly.
  3. Latex typo is now fixed.
  4. There are multiple optimizers that we can indeed use. I didn't explain this in detail here, because it has been covered in the regular VQE tutorial that will be made public on the Learning Platform. In that sense, this notebook complements that course.