Giter Site home page Giter Site logo

renatawong / classical-shadow-vqe Goto Github PK

View Code? Open in Web Editor NEW
7.0 2.0 1.0 4.11 MB

Qiskit implementation of classical shadow formalism with VQE for calculating ground state energies of molecules

License: Apache License 2.0

Jupyter Notebook 99.68% Python 0.32%
classical-shadow quantum-algorithms variational-quantum-circuits variational-quantum-eigensolver vqe qiskit quantum-computing quantum-machine-learning ground-state-energy electronic-structure-problem

classical-shadow-vqe's Introduction

Electronic structure problem (estimating ground state energy) with VQE and classical shadows

The notebooks implement the idea in [1] (see the experiments therein) and extend the application of classical shadows to each iteration of VQE.

Status

The notebooks are complete.

How to use the notebooks

Requires the package predicting-quantum-properties from [2].

There are a total of six files that calculate the electronic structure problem:

  1. electronic_structure_problem_dcs.ipynb : Electronic structure problem with shadow (derandomized) applied on the optimal set of angles only. This is the original idea in [1].
  2. electronic_structure_problem_rcs.ipynb : Electronic structure problem with shadow (randomized) applied on the optimal set of angles only.

The below files on the other hand apply classical shadow in each cost function evaluation of VQE:

  1. vqe_rcs_qiskit.ipynb : Electronic structure problem using VQE with the vanilla classical shadow (i.e. randomised basis change).
  2. vqe_rcs_qiskit_optimized.ipynb: As above but with optimization.
  3. vqe_dcs_qiskit.ipynb : Electronic structure problem using VQE with ``derandomised'' classical shadow (i.e. derandomised Hamiltonian used for basis change).
  4. vqe_dcs_qiskit_optimized.ipynb : As above but with time optimization.

Calculations using the optimized versions take significantly less time than with the non-optimised versions.

File modified_derandomization.py contains a modified version of the file 'data_acquisition_shadow.py' in the package 'predicting-quantum-properties' [2]. This modification allows the user to specify the number of derandomised operators to be generated. In the original version [2], the user had to specify the number of evaluations per observable, which did not allow for control over the total number of generated operators.

The folder experimental-results contains the experimental results for the molecules $H_2$, $LiH$, $BeH_2$, $H_2O$, and $NH_3$. Note that [1] doesn't specify how to obtain a required number of derandomized operators, instead it one must pass a number of evaluations per observable. This results in the number of required operators being either unergenerated or overgenerated. Hence, in order to be able to verify the results of [1], we do a postprocessing on the method for generating derandomized operators from [2]. Essentially, we pass the parameter '50' to 'derandomized_classical_shadow.py' as the number of evaluations per observable, and then we either add operators to the output or decrease the number of operators in the output, depending on how many operators are needed for each test. Our method works for the tested molecules, but no guarantee is given for the general case.

Acknowledgements

The notebooks are based on the theory described in [1].

The code was written by Renata Wong (https://renatawong.github.io/).

This work benefited greatly from discussions with Prof. Hsi-Sheng Goan (National Taiwan University), Prof. Hao-Chung Cheng (National Taiwan University), Prof. Jyh-Pin Chou (National Changhua University of Education), Michał Stęchły (PsiQuantum), and Hsin Yuan (Robert) Huang (California Institute of Technology). All remaining deficiencies are my own.

References

[1] Hsin-Yuan Huang, Richard Kueng, and John Preskill, Efficient estimation of Pauli observables by derandomization, https://journals.aps.org/prl/abstract/10.1103/PhysRevLett.127.030503

[2] Hsin-Yuan Huang, Predicting quantum properties, https://github.com/hsinyuan-huang/predicting-quantum-properties

License Apache License 2.0

classical-shadow-vqe's People

Contributors

renatawong avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

pacomegnt

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.