Skip to content
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

Initial state preparation demo #950

Merged
merged 76 commits into from
Oct 20, 2023
Merged
Show file tree
Hide file tree
Changes from 51 commits
Commits
Show all changes
76 commits
Select commit Hold shift + click to select a range
ae28709
first draft of initial state demo
Chiffafox Oct 5, 2023
0224d75
very rough draft of the initial state demo
Chiffafox Oct 5, 2023
c6adb66
wip on the VQE part of demo
Chiffafox Oct 13, 2023
ab25ec1
new draft of initial state demo
Chiffafox Oct 13, 2023
4bd11b6
add header for vqe section
Chiffafox Oct 13, 2023
d37e40d
Merge branch 'dev' into qml_isp_demo
Chiffafox Oct 13, 2023
a04ff4b
[skip ci] text edits
Chiffafox Oct 13, 2023
eb8ccb0
Merge branch 'qml_isp_demo' of github.com:PennyLaneAI/qml into qml_is…
Chiffafox Oct 13, 2023
b24b4e7
trigger build
Chiffafox Oct 13, 2023
f532439
fixes to metadata
Chiffafox Oct 13, 2023
f817918
fixes to metadata
Chiffafox Oct 13, 2023
6345c47
fix metadata and add author data
Chiffafox Oct 13, 2023
7795c36
turn dmrg part into a note to avoid dependency
Chiffafox Oct 13, 2023
2a2c17c
final dmrg reference removed
Chiffafox Oct 13, 2023
cb01d13
fix previewimage metadata
Chiffafox Oct 13, 2023
9fc415d
remove printing from vqe execution and fix images not showing up
Chiffafox Oct 13, 2023
eacbc99
update demos qchem rst file
Chiffafox Oct 13, 2023
df9dcb2
update demos qchem rst file
Chiffafox Oct 13, 2023
b93c675
rearrange text and code
soranjh Oct 13, 2023
cbe6db2
Merge branch 'qml_isp_demo' of https://github.com/PennyLaneAI/qml int…
soranjh Oct 13, 2023
19b7b7e
Update _static/authors/stepan_fomichev.txt
Chiffafox Oct 16, 2023
270d876
typos
Chiffafox Oct 16, 2023
e5dafb2
Merge branch 'qml_isp_demo' of github.com:PennyLaneAI/qml into qml_is…
Chiffafox Oct 16, 2023
13d4faa
typos and use StatePrep
Chiffafox Oct 16, 2023
7582f2d
fix italicize
Chiffafox Oct 16, 2023
220891d
update block2 install, new release has all funcs we need
Chiffafox Oct 16, 2023
fa4a97b
visual edits
Chiffafox Oct 16, 2023
25c4657
links for all external packages
Chiffafox Oct 16, 2023
88dbacf
improve the overlap section
Chiffafox Oct 16, 2023
cb3576e
light style edits and changed to h3+ example with printing
Chiffafox Oct 17, 2023
8da4859
style edits
Chiffafox Oct 17, 2023
4c3ab86
move tol description higher
Chiffafox Oct 17, 2023
0c231de
style edits
Chiffafox Oct 17, 2023
696808a
style edits from code review
Chiffafox Oct 17, 2023
4d711a4
clarify dmrg code block
Chiffafox Oct 17, 2023
7204149
add dmrg and shci output as text
Chiffafox Oct 17, 2023
561824c
added text output for shci and dmrg
Chiffafox Oct 17, 2023
f458913
final stylistic edits and finish h3+
Chiffafox Oct 17, 2023
f2be96f
print tot iterations and generate figure
Chiffafox Oct 17, 2023
7250f50
modify overlap section to reflect new example
Chiffafox Oct 17, 2023
3aa940c
remove pre-computed figures
Chiffafox Oct 17, 2023
4c0debd
replace header image
Chiffafox Oct 17, 2023
4bb2738
point to new image
Chiffafox Oct 17, 2023
f8f5e18
stylistic edits
Chiffafox Oct 17, 2023
addba50
style edits
Chiffafox Oct 17, 2023
c2408fa
style edits
Chiffafox Oct 17, 2023
55a63a6
style edits to overlap output
Chiffafox Oct 17, 2023
acb039f
style edits
Chiffafox Oct 17, 2023
905eeee
final stylistic changes
Chiffafox Oct 17, 2023
b583155
Apply suggestions from code review
Chiffafox Oct 17, 2023
f50d1db
Update demonstrations/tutorial_initial_state_preparation.py
KetpuntoG Oct 18, 2023
f8c5e20
thumbnails + black
KetpuntoG Oct 18, 2023
b58d9bc
Merge branch 'qml_isp_demo' of https://github.com/PennyLaneAI/qml int…
KetpuntoG Oct 18, 2023
fb01731
random space in the name
KetpuntoG Oct 18, 2023
afcd9b5
fixing uri
KetpuntoG Oct 18, 2023
75e909d
stylistic edits
Chiffafox Oct 18, 2023
823c3b9
style edits
Chiffafox Oct 18, 2023
fa4f1b9
comments on best initial state options
Chiffafox Oct 18, 2023
23d5f67
Merge branch 'dev' into qml_isp_demo
Chiffafox Oct 18, 2023
cd9c239
shci and application:vqe headers style edit
Chiffafox Oct 18, 2023
5bae116
bold text edit
Chiffafox Oct 18, 2023
1d1e118
final style edits
Chiffafox Oct 18, 2023
6cf7cc4
Apply suggestions from code review
Chiffafox Oct 18, 2023
c360578
Merge branch 'qml_isp_demo' of github.com:PennyLaneAI/qml into qml_is…
Chiffafox Oct 18, 2023
04fa37d
Apply suggestions from code review
Chiffafox Oct 18, 2023
6583bac
final visual edits
Chiffafox Oct 18, 2023
7dd1aa7
combine with github edits
Chiffafox Oct 18, 2023
4bb9e26
remove blank lines
soranjh Oct 19, 2023
b0793f1
style edits
Chiffafox Oct 19, 2023
57e0732
Merge branch 'qml_isp_demo' of github.com:PennyLaneAI/qml into qml_is…
Chiffafox Oct 19, 2023
3fb43db
remove bold font
Chiffafox Oct 19, 2023
d91252a
Merge branch 'dev' into qml_isp_demo
Chiffafox Oct 19, 2023
bb2679a
CCSD header fix
Chiffafox Oct 19, 2023
a884e30
cisd paragraph render error
Chiffafox Oct 19, 2023
145c7b3
split big VQE codeblock
Chiffafox Oct 20, 2023
0620b90
final text edits and typo fixes
Chiffafox Oct 20, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added _static/authors/stepan_fomichev.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions _static/authors/stepan_fomichev.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.. bio:: Stepan Fomichev
:photo: ../_static/authors/stepan_fomichev.jpg


Stepan Fomichev is a quantum scientist working at Xanadu. His background is in condensed matter physics, with a focus on lattice vibrations and electron-phonon coupling. As part of the Algorithms team, he focuses on researching and developing prospective applications for quantum algorithms.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
39 changes: 39 additions & 0 deletions demonstrations/tutorial_initial_state_preparation.metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"title": "Initial State Preparation for Quantum Chemistry",
"authors": [
{
"id": "stepan_fomichev"
}
],
"dateOfPublication": "2023-10-20T00:00:00+00:00",
"dateOfLastModification": "2023-10-20T00:00:00+00:00",
"categories": [
"Quantum Chemistry"
],
"tags": [],
"previewImages": [
{
"type": "thumbnail",
"uri": "/_images/NOON.png"
}
],
"seoDescription": "Prepare initial states for quantum algorithms from output of traditional quantum chemistry methods.",
"doi": "",
"canonicalURL": "/qml/demos/tutorial_initial_state_preparation",
"references": [
],
"basedOnPapers": [],
"referencedByPapers": [],
"relatedContent": [
{
"type": "demonstration",
"id": "tutorial_quantum_chemistry",
"weight": 1.0
},
{
"type": "demonstration",
"id": "tutorial_vqe",
"weight": 1.0
}
]
}
333 changes: 333 additions & 0 deletions demonstrations/tutorial_initial_state_preparation.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,333 @@
r"""

Initial state preparation for quantum chemistry
===============================================

.. meta::
:property="og:description": Understand the concept of the initial state, and learn how to prepare it with PennyLane
:property="og:image": https://pennylane.ai/qml/_images/thumbnail_tutorial_initial_state_preparation.png

.. related::
tutorial_quantum_chemistry Building molecular Hamiltonians
tutorial_vqe A brief overview of VQE

*Author: Stepan Fomichev — Posted: 20 October 2023. Last updated: 20 October 2023.*
Chiffafox marked this conversation as resolved.
Show resolved Hide resolved

A high-quality initial state can significantly reduce the runtime of many quantum algorithms. From
the variational quantum eigensolver (VQE) to quantum phase estimation (QPE) and even the recent
`intermediate-scale quantum (ISQ) <https://pennylane.ai/blog/2023/06/from-nisq-to-isq/>`_ algorithms, obtaining the ground state of a chemical system requires
a good initial state. For instance, in the case of VQE, a good initial state directly translates into fewer
optimization steps. In QPE, the probability of measuring the ground-state energy is directly
proportional to the overlap squared of the initial and ground states. Even beyond quantum phase estimation,
good initial guesses are important for algorithms like quantum approximate optimization (QAOA)
and Grover search.

Much like searching for a needle in a haystack, there are a lot of things you might try
to prepare a good guess for the ground state in the large-dimensional Hilbert space. In this
tutorial, we show how to use traditional computational chemistry techniques to
get us *most of the way* to an initial state. Such an initial state will not be the
ground state, but it will certainly be better than the standard guess of a computational
basis state :math:`\ket{0}^{\otimes N}` or the Hartree-Fock state.

Chiffafox marked this conversation as resolved.
Show resolved Hide resolved
.. figure:: ../demonstrations/initial_state_preparation/qchem_input_states.png
:align: center
:width: 50%
:target: javascript:void(0)

Importing initial states
------------------------
We can import initial states obtained from several post-Hartree-Fock quantum chemistry calculations
to PennyLane. These methods are incredibly diverse in terms of their outputs, not always returning
an object that can be turned into a PennyLane state vector. We have already done this hard
conversion work: all that you need to do is run these methods and pass their outputs
to PennyLane's :func:`~.pennylane.qchem.import_state` function. The currently supported methods are
configuration interaction with singles and doubles (CISD), coupled cluster (CCSD), density-matrix
renormalization group (DMRG) and semistochastic heat-bath configuration interaction (SHCI).

CISD states
~~~~~~~~~~
The first line of attack for initial state preparation are CISD calculations performed with the `PySCF <https://github.com/pyscf/pyscf>`_
soranjh marked this conversation as resolved.
Show resolved Hide resolved
library. CISD is unsophisticated, but fast. It will not be of much help for strongly correlated molecules,
Chiffafox marked this conversation as resolved.
Show resolved Hide resolved
but it is better than Hartree-Fock. Here is the code example based on the restricted Hartree-Fock
orbitals, but the unrestricted version is available too.
soranjh marked this conversation as resolved.
Show resolved Hide resolved
"""

from pyscf import gto, scf, ci
from pennylane.qchem import import_state

R = 1.2
# create the H3+ molecule
mol = gto.M(atom=[['H', (0, 0, 0)], ['H', (0,0,R)], ['H', (0,0,2*R)]],\
charge=1, basis='sto-3g')
# perfrom restricted Hartree-Fock and then CISD
myhf = scf.RHF(mol).run()
myci = ci.CISD(myhf).run()
wf_cisd = import_state(myci, tol=1e-1)
print(f"CISD-based state vector: \n {wf_cisd.real}")
soranjh marked this conversation as resolved.
Show resolved Hide resolved

##############################################################################
# The final object, PennyLane's state vector ``wf_cisd``, is ready to be used as an
# initial state in a quantum circuit in PennyLane--we will showcase this below for VQE.
# Conversion for CISD is straightforward: simply assign the PySCF-stored CI coefficients
# to appropriate determinants.
#
# The second attribute, ``tol``, specifies the cutoff beyond which contributions to the
# wavefunctions are neglected. Internally, wavefunctions are stored in their Slater
# determinant representation, and if their prefactor coefficient is below ``tol``, those
# determinants are dropped from the expression.
#
#
# CCSD states
# ~~~~~~~~~
# The function :func:`~.pennylane.qchem.import_state` is general, and can automatically detect the input type
Chiffafox marked this conversation as resolved.
Show resolved Hide resolved
# and apply the appropriate conversion protocol. It works similarly to the above for CCSD.
Chiffafox marked this conversation as resolved.
Show resolved Hide resolved

from pyscf import cc
mycc = cc.CCSD(myhf).run()
wf_ccsd = import_state(mycc, tol=1e-1)
print(f"CCSD-based state vector: \n {wf_ccsd.real}")

##############################################################################
# For CCSD conversion, the exponential form is expanded and terms are collected to
# second order to obtain the CI coefficients.
#
# DMRG states
# ~~~~~~~~~
# The DMRG calculations involve running the library `Block2 <https://github.com/block-hczhai/block2-preview>`_,
# which is installed from ``pip``:
Chiffafox marked this conversation as resolved.
Show resolved Hide resolved
#
# .. code-block:: bash
#
# pip install block2
#
# The DMRG calculation is run on top of the molecular orbitals obtained by Hartree-Fock,
# stored in the ``myhf`` object, which we can reuse from before.
#
# .. code-block:: python
#
# from pyscf import mcscf
# from pyblock2.driver.core import DMRGDriver, SymmetryTypes
# from pyblock2._pyscf.ao2mo import integrals as itg
#
# # obtain molecular integrals and other parameters for DMRG
# mc = mcscf.CASCI(myhf, mol.nao, mol.nelectron)
# ncas, n_elec, spin, ecore, h1e, g2e, orb_sym = \
# itg.get_rhf_integrals(myhf, mc.ncore, mc.ncas, g2e_symm=8)
#
# # initialize the DMRG solver, Hamiltonian (as matrix-product operator, MPO) and
# # state (as matrix-product state, MPS)
# driver = DMRGDriver(scratch="./dmrg_temp", symm_type=SymmetryTypes.SZ)
# driver.initialize_system(n_sites=ncas, n_elec=n_elec, spin=spin, orb_sym=orb_sym)
# mpo = driver.get_qc_mpo(h1e=h1e, g2e=g2e, ecore=ecore, iprint=0)
# ket = driver.get_random_mps(tag="GS")
#
# # execute DMRG by modifying the ket state in-place to minimize the energy
# driver.dmrg(mpo, ket, n_sweeps=30,bond_dims=[100,200],\
# noises=[1e-3,1e-5],thrds=[1e-6,1e-7],tol=1e-6)
#
# # post-process the MPS to get an initial state
# dets, coeffs = driver.get_csf_coefficients(ket, iprint=0)
# dets = dets.tolist()
# wf_dmrg = import_state((dets, coeffs), tol=1e-1)
# print(f"DMRG-based state vector\n{wf_dmrg}")
#
# .. code-block:: bash
#
Chiffafox marked this conversation as resolved.
Show resolved Hide resolved
# DMRG-based state vector
# [ 0. 0. 0. 0. 0. 0.
# 0. 0. 0. 0. 0. 0.
# -0.22425623 0. 0. 0. 0. 0.
# 0. 0. 0. 0. 0. 0.
# 0. 0. 0. 0. 0. 0.
# 0. 0. 0. 0. 0. 0.
# 0. 0. 0. 0. 0. 0.
# 0. 0. 0. 0. 0. 0.
# 0.97453022 0. 0. 0. 0. 0.
# 0. 0. 0. 0. 0. 0.
# 0. 0. 0. 0. ]

##############################################################################
# The crucial part is calling ``get_csf_coefficients()`` on the solution stored in
# MPS form in the ``ket``. This triggers an internal reconstruction calculation that
# converts the MPS to the sum of Slater determinants form, returning the output
# as a tuple ``(list([int]), array(float]))``. The first element expresses a given Slater
# determinant using Fock occupation vectors of length equal to the number of spatial
# orbitals in Block2 notation, where ``0`` is unoccupied, ``1`` is occupied with spin-up
# electron, ``2`` is occupied with spin-down, and ``3`` is doubly occupied. The first
# element must be converted to ``list`` for ``import_state`` to accept it. The second
# element stores the CI coefficients.
#
# In principle, this functionality can be used to generate any initial state, provided
# the user specifies a list of Slater determinants and their coefficients in this form.
# Let's take this opportunity to create the Hartree-Fock initial state, to compare the
# other states against it.

from pennylane import numpy as np
hf_primer = ( [ [3, 0, 0] ], np.array([1.]) )
wf_hf = import_state(hf_primer)

##############################################################################
Chiffafox marked this conversation as resolved.
Show resolved Hide resolved
# SHCI states
# ~~~~~~~~~~~~~~
#
# The SHCI calculations utilize the library `Dice <https://github.com/sanshar/Dice>`_, and can be run
# using PySCF through the interface module `SHCI-SCF <https://github.com/pyscf/shciscf>`_.
# For Dice, the installation process is more complicated than for Block2, but the execution process is similar:
soranjh marked this conversation as resolved.
Show resolved Hide resolved
#
# .. code-block:: python
#
# from pyscf.shciscf import shci
#
# # prepare PySCF CASCI object, whose solver will be the SHCI method
# ncas, nelecas_a, nelecas_b = mol.nao, mol.nelectron // 2, mol.nelectron // 2
# myshci = mcscf.CASCI(myhf, ncas, (nelecas_a, nelecas_b))
#
# # set up essentials for the SHCI solver
# output_file = f"shci_output.out"
# myshci.fcisolver = shci.SHCI(myhf.mol)
# myshci.fcisolver.outputFile = output_file
#
# # execute SHCI through the PySCF interface
# e_tot, e_ci, ss, mo_coeff, mo_energies = myshci.kernel(verbose=5)
#
# # post-process the result to get an initial state
# (dets, coeffs) = [post-process shci_output.out to get tuple of
soranjh marked this conversation as resolved.
Show resolved Hide resolved
# dets (list([str])) and coeffs (array([float]))]
# wf_shci = import_state((dets, coeffs), tol=1e-1)
# print(f"SHCI-based state vector\n{wf_shci}")
#
# .. code-block:: bash
#
# SHCI-based state vector
# [ 0. 0. 0. 0. 0. 0.
# 0. 0. 0. 0. 0. 0.
# 0.22425623 0. 0. 0. 0. 0.
# 0. 0. 0. 0. 0. 0.
# 0. 0. 0. 0. 0. 0.
# 0. 0. 0. 0. 0. 0.
# 0. 0. 0. 0. 0. 0.
# 0. 0. 0. 0. 0. 0.
# -0.97453022 0. 0. 0. 0. 0.
# 0. 0. 0. 0. 0. 0.
# 0. 0. 0. 0. ]
#
Chiffafox marked this conversation as resolved.
Show resolved Hide resolved
#
##############################################################################
# Application: speed up VQE
# -------------------------
#
# Let us now demonstrate how the choice of a better initial state shortens the runtime
# of VQE for obtaining the ground-state energy of a molecule. As a first step, create a
# molecule, a device, and a simple VQE circuit with double excitations

import pennylane as qml
from pennylane import qchem
from pennylane import numpy as np

# generate the molecular Hamiltonian for H3+
H2mol, qubits = qchem.molecular_hamiltonian(["H", "H", "H"],\
np.array([0,0,0,0,0,R/0.529, 0,0,2*R/0.529]),\
charge=1,basis="sto-3g")
wires = list(range(qubits))
dev = qml.device("default.qubit", wires=qubits)

# create all possible excitations in H3+
singles, doubles = qchem.excitations(2, qubits)
excitations = singles + doubles

##############################################################################
# Now let's run VQE with the Hartree-Fock initial state:
Chiffafox marked this conversation as resolved.
Show resolved Hide resolved

# VQE circuit with wf_hf as initial state and all possible excitations
soranjh marked this conversation as resolved.
Show resolved Hide resolved
@qml.qnode(dev, interface="autograd")
soranjh marked this conversation as resolved.
Show resolved Hide resolved
def circuit_VQE(theta, initial_state):
qml.StatePrep(initial_state, wires=wires)
for i, excitation in enumerate(excitations):
if len(excitation) == 4:
qml.DoubleExcitation(theta[i], wires=excitation)
else:
qml.SingleExcitation(theta[i], wires=excitation)
return qml.expval(H2mol)

# create the VQE optimizer, initialize the variational parameters, set start params
Chiffafox marked this conversation as resolved.
Show resolved Hide resolved
opt = qml.GradientDescentOptimizer(stepsize=0.4)
theta = np.array(np.zeros(len(excitations)), requires_grad=True)
delta_E, iteration = 10, 0
results_hf = []

# run the VQE optimization loop until convergence threshold is reached
while abs(delta_E) > 1e-5:
theta, prev_energy = opt.step_and_cost(circuit_VQE, theta, initial_state = wf_hf)
new_energy = circuit_VQE(theta, initial_state = wf_hf)
delta_E = new_energy - prev_energy
Chiffafox marked this conversation as resolved.
Show resolved Hide resolved
results_hf.append(new_energy)
print(f"Step = {len(results_hf)}, Energy = {new_energy:.6f} Ha, dE = {delta_E} Ha")
soranjh marked this conversation as resolved.
Show resolved Hide resolved
print(f"Starting with HF state took {len(results_hf)} iterations until convergence.")

##############################################################################
# And compare with how things go when you run it with the CISD initial state:

theta = np.array(np.zeros(len(excitations)), requires_grad=True)
delta_E, iteration = 10, 0
results_cisd = []

while abs(delta_E) > 1e-5:
theta, prev_energy = opt.step_and_cost(circuit_VQE, theta, initial_state = wf_cisd)
new_energy = circuit_VQE(theta, initial_state = wf_cisd)
delta_E = new_energy - prev_energy
Chiffafox marked this conversation as resolved.
Show resolved Hide resolved
results_cisd.append(new_energy)
print(f"Step = {len(results_cisd)}, Energy = {new_energy:.6f} Ha, dE = {delta_E} Ha")
soranjh marked this conversation as resolved.
Show resolved Hide resolved
print(f"Starting with CISD state took {len(results_cisd)} iterations until convergence.")

##############################################################################
# Let's visualize the comparison between the two initial states

import matplotlib.pyplot as plt
fig, ax = plt.subplots()
ax.plot(range(len(results_hf)), results_hf, color="r", marker="o", label="HF")
ax.plot(range(len(results_cisd)), results_cisd, color="b", marker="o", label="CISD")
soranjh marked this conversation as resolved.
Show resolved Hide resolved
ax.legend(fontsize=16)
ax.tick_params(axis="both", labelsize=16)
ax.set_xlabel("Iteration", fontsize=20)
ax.set_ylabel("Energy, Ha", fontsize=20)
plt.tight_layout()
plt.show()

##############################################################################
# Finally, it is straightforward to compare the initial states through overlap--a traditional
# metric of success for initial states in quantum algorithms. Because in PennyLane these
# are regular arrays, computing an overlap is as easy as computing a dot product

print(np.dot(wf_cisd, wf_hf).real)
print(np.dot(wf_ccsd, wf_hf).real)

##############################################################################
# .. code-block:: bash
#
# print(np.dot(wf_dmrg, wf_hf))
# print(np.dot(wf_shci, wf_hf))
# >>> 0.9745302156335067
# >>> 0.9745302156443371
Chiffafox marked this conversation as resolved.
Show resolved Hide resolved

Chiffafox marked this conversation as resolved.
Show resolved Hide resolved
##############################################################################
# In this particular case, even CISD gives the exact wavefunction, hence all overlaps
# are identical. In more correlated molecules, overlaps will show that the more
# multireference methods DMRG and SHCI are farther away from the Hartree-Fock state,
# allowing them to perform better. If a ground state in such a case was known, the
# overlap to it could tell us directly the quality of the initial state.

##############################################################################
# Conclusion
# -----------
# This demo explains the concept of the initial state for quantum algorithms. Using the
# example of VQE, it demonstrates how a better choice of state--obtained, for example
# from a sophisticated computational chemistry method like CCSD, SHCI or DMRG--can lead
# to much better algorithmic performance. It also shows simple workflows for how to run
# these computational chemistry methods, from libraries such as `PySCF <https://github.com/pyscf/pyscf>`_,
# `Block2 <https://github.com/block-hczhai/block2-preview>`_ and
# `Dice <https://github.com/sanshar/Dice>`_, to generate outputs that can then be
# converted to PennyLane's state vector format with a single line of code.
#
# About the author
# ----------------
# .. include:: ../_static/authors/stepan_fomichev.txt
Loading