-
Notifications
You must be signed in to change notification settings - Fork 209
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* docs: add migration guide for v0.4 -> v0.5 * docs: update (most) tutorials * Update release notes * fix: ListOrDict import in QubitConverter * Add changes based on review * Add release note prelude * Update README * Replace placefolder HowTo with an actually useful one * Disable CI stable tutorials for now * Overwrite stable tutorials in CI * fix deprecation msg * rename: SparseLabelOpFactory -> SparseLabelOpsFactory * Apply suggestions from code review Co-authored-by: Steve Wood <[email protected]> Co-authored-by: Manoel Marques <[email protected]> Co-authored-by: Steve Wood <[email protected]>
- Loading branch information
1 parent
8e1da0a
commit dc2250c
Showing
49 changed files
with
5,862 additions
and
412 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
How to use the ``AdaptVQE`` | ||
=========================== | ||
|
||
As of Qiskit Nature v0.5, the ``AdaptVQE`` algorithm has been migrated to Qiskit | ||
Terra (released in v0.22). | ||
|
||
This tutorial outlines how the algorithm can be used. | ||
|
||
1. We obtain an ``ElectronicStructureProblem`` which we want to solve: | ||
|
||
>>> from qiskit_nature.second_q.drivers import PySCFDriver | ||
>>> driver = PySCFDriver(atom="H 0 0 0; H 0 0 0.735", basis="sto-3g") | ||
>>> problem = driver.run() | ||
|
||
2. We setup our ``QubitConverter``: | ||
|
||
>>> from qiskit_nature.second_q.mappers import JordanWignerMapper, QubitConverter | ||
>>> converter = QubitConverter(JordanWignerMapper()) | ||
|
||
3. We setup our ansatz: | ||
|
||
>>> from qiskit_nature.second_q.circuit.library import UCCSD, HartreeFock | ||
>>> ansatz = UCCSD() | ||
>>> ansatz.num_particles = problem.num_particles | ||
>>> ansatz.num_spatial_orbitals = problem.num_spatial_orbitals | ||
>>> ansatz.qubit_converter = converter | ||
>>> initial_state = HartreeFock() | ||
>>> initial_state.num_particles = problem.num_particles | ||
>>> initial_state.num_spatial_orbitals = problem.num_spatial_orbitals | ||
>>> initial_state.qubit_converter = converter | ||
>>> ansatz.initial_state = initial_state | ||
|
||
4. We setup a ``VQE``: | ||
|
||
>>> import numpy as np | ||
>>> from qiskit.algorithms.optimizers import SLSQP | ||
>>> from qiskit.algorithms.minimum_eigensolvers import VQE | ||
>>> from qiskit.primitives import Estimator | ||
>>> vqe = VQE(Estimator(), ansatz, SLSQP()) | ||
>>> vqe.initial_point = np.zeros(ansatz.num_parameters) | ||
|
||
5. We setup the ``AdaptVQE``: | ||
|
||
>>> from qiskit.algorithms.minimum_eigensolvers import AdaptVQE | ||
>>> adapt_vqe = AdaptVQE(vqe) | ||
>>> adapt_vqe.supports_aux_operators = lambda: True # temporary fix | ||
|
||
6. We wrap everything in a ``GroundStateEigensolver``: | ||
|
||
>>> from qiskit_nature.second_q.algorithms import GroundStateEigensolver | ||
>>> solver = GroundStateEigensolver(converter, adapt_vqe) | ||
|
||
7. We solve the problem: | ||
|
||
>>> result = solver.solve(problem) |
This file was deleted.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.