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

refactor: remove all deprecated code #1248

Merged
merged 11 commits into from
Sep 7, 2023
2 changes: 2 additions & 0 deletions .pylintdict
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ cls
cmap
cnot
codec
codeowners
coeff
coeffs
colormap
Expand Down Expand Up @@ -395,6 +396,7 @@ observables
occupancies
ok
ollitrault
onboarding
onee
oneeints
onsite
Expand Down
11 changes: 0 additions & 11 deletions docs/howtos/adapt_vqe.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,6 @@ algorithm has been migrated to Qiskit Terra (released in v0.22).

This tutorial outlines how the algorithm can be used.

0. We ensure the use of :class:`~qiskit.opflow.primitive_ops.PauliSumOp` (this is the default value
of this setting for now but we enforce it here to ensure stability of this guide as long as the
:class:`~qiskit.algorithms.minimum_eigensolvers.AdaptVQE` class is not yet guaranteed to handle
the :class:`~qiskit.quantum_info.SparsePauliOp` successor properly):

.. testcode::

from qiskit_nature import settings

settings.use_pauli_sum_op = True

1. We obtain an :class:`~qiskit_nature.second_q.problems.ElectronicStructureProblem`
which we want to solve:

Expand Down
18 changes: 9 additions & 9 deletions docs/migration/0.6_b_mes_factory.rst
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ For the following examples, we need a simple
:class:`~qiskit_nature.second_q.problems.ElectronicStructureProblem` which we can obtain from a
:class:`~qiskit_nature.second_q.drivers.PySCFDriver` like so:

.. testcode::
.. code:: ipython3

from qiskit_nature.second_q.drivers import PySCFDriver
from qiskit_nature.second_q.mappers import ParityMapper
Expand All @@ -58,7 +58,7 @@ VQEUCCFactory

The old way:

.. testcode::
.. code:: ipython3

from qiskit.algorithms.optimizers import SLSQP
from qiskit.primitives import Estimator
Expand All @@ -72,13 +72,13 @@ The old way:
result = solver.compute_minimum_eigenvalue(qubit_op, aux_ops)
print(f"Eigenvalue = {result.eigenvalue: .6f}")

.. testoutput::
.. parsed-literal::

Eigenvalue = -1.857275

And the corresponding new way:

.. testcode::
.. code:: ipython3

from qiskit.algorithms.minimum_eigensolvers import VQE
from qiskit.algorithms.optimizers import SLSQP
Expand Down Expand Up @@ -107,7 +107,7 @@ And the corresponding new way:
result = solver.compute_minimum_eigenvalue(qubit_op, aux_ops)
print(f"Eigenvalue = {result.eigenvalue: .6f}")

.. testoutput::
.. parsed-literal::

Eigenvalue = -1.857275

Expand All @@ -116,7 +116,7 @@ NumPyEigensolverFactory

The old way:

.. testcode::
.. code:: ipython3

from qiskit_nature.second_q.algorithms import NumPyEigensolverFactory

Expand All @@ -132,15 +132,15 @@ The old way:
for idx, eigenvalue in enumerate(result.eigenvalues):
print(f"{idx}: {eigenvalue: .6f}")

.. testoutput::
.. parsed-literal::

0: -1.857275
1: -0.882722
2: -0.224911

And the corresponding new way:

.. testcode::
.. code:: ipython3

from qiskit.algorithms.eigensolvers import NumPyEigensolver

Expand All @@ -152,7 +152,7 @@ And the corresponding new way:
for idx, eigenvalue in enumerate(result.eigenvalues):
print(f"{idx}: {eigenvalue: .6f}")

.. testoutput::
.. parsed-literal::

0: -1.857275
1: -0.882722
Expand Down
34 changes: 17 additions & 17 deletions docs/migration/0.6_c_qubit_converter.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Setup
For the examples in this guide, we will always be using the following
:class:`~qiskit_nature.second_q.operators.FermionicOp`:

.. testcode::
.. code:: ipython3

from qiskit_nature.second_q.drivers import PySCFDriver

Expand All @@ -29,7 +29,7 @@ For the examples in this guide, we will always be using the following
for label, coeff in sorted(hamiltonian.items()):
print(f"{coeff:+.8f} * '{label}'")

.. testoutput::
.. parsed-literal::

+0.33785508 * '+_0 +_0 -_0 -_0'
+0.09046560 * '+_0 +_0 -_1 -_1'
Expand Down Expand Up @@ -80,7 +80,7 @@ now set the value of :attr:`~qiskit_nature.settings.QiskitNatureSettings.use_pau
To ensure that we can consistently rely on using the :class:`~qiskit.quantum_info.SparsePauliOp` in
the following parts of this guide, we are applying this setting here:

.. testcode::
.. code:: ipython3

from qiskit_nature import settings

Expand All @@ -102,7 +102,7 @@ In the simplest cases, all you did was pass a :class:`~qiskit_nature.second_q.ma
object into the :class:`~qiskit_nature.second_q.mappers.QubitConverter`. For example, somewhat like
this:

.. testcode::
.. code:: ipython3

from qiskit_nature.second_q.mappers import JordanWignerMapper, QubitConverter

Expand All @@ -115,14 +115,14 @@ object from the example above into whichever place you were using it before.
If you were working directly with some :class:`~qiskit_nature.second_q.operators.SparseLabelOp` like
so:

.. testcode::
.. code:: ipython3

qubit_op = converter.convert(hamiltonian)

for pauli, coeff in sorted(qubit_op.label_iter()):
print(f"{coeff.real:+.8f} * {pauli}")

.. testoutput::
.. parsed-literal::

-0.81054798 * IIII
+0.17218393 * IIIZ
Expand All @@ -142,14 +142,14 @@ so:

You should now directly use the ``mapper`` again, but its method is called ``.map``:

.. testcode::
.. code:: ipython3

qubit_op = mapper.map(hamiltonian)

for pauli, coeff in sorted(qubit_op.label_iter()):
print(f"{coeff.real:+.8f} * {pauli}")

.. testoutput::
.. parsed-literal::

-0.81054798 * IIII
+0.17218393 * IIIZ
Expand Down Expand Up @@ -185,7 +185,7 @@ able to use the ``two_qubit_reduction=True`` option of the
to the :class:`~qiskit_nature.second_q.mappers.ParityMapper`, is now directly built into said
mapper. So if you were doing something along these lines:

.. testcode::
.. code:: ipython3

from qiskit_nature.second_q.mappers import ParityMapper

Expand All @@ -196,7 +196,7 @@ mapper. So if you were doing something along these lines:
for pauli, coeff in sorted(reduced_op.label_iter()):
print(f"{coeff.real:+.8f} * {pauli}")

.. testoutput::
.. parsed-literal::

-1.05237325 * II
+0.39793742 * IZ
Expand All @@ -206,7 +206,7 @@ mapper. So if you were doing something along these lines:

The equivalent code now looks like the following:

.. testcode::
.. code:: ipython3

mapper = ParityMapper(num_particles=problem.num_particles)

Expand All @@ -215,7 +215,7 @@ The equivalent code now looks like the following:
for pauli, coeff in sorted(reduced_op.label_iter()):
print(f"{coeff.real:+.8f} * {pauli}")

.. testoutput::
.. parsed-literal::

-1.05237325 * II
+0.39793742 * IZ
Expand All @@ -235,7 +235,7 @@ name: :class:`~qiskit.quantum_info.analysis.z2_symmetries.Z2Symmetries`), you sh

In the past, you would have enabled this like so:

.. testcode::
.. code:: ipython3

mapper = JordanWignerMapper()
converter = QubitConverter(mapper, z2symmetry_reduction="auto")
Expand All @@ -245,7 +245,7 @@ which would then later use
sector of the Hilbert space in which the solution of your problem lies. This was only supported by
the :class:`~qiskit_nature.second_q.problems.ElectronicStructureProblem`. Below is a quick example:

.. testcode::
.. code:: ipython3

tapered_op = converter.convert(
hamiltonian,
Expand All @@ -256,7 +256,7 @@ the :class:`~qiskit_nature.second_q.problems.ElectronicStructureProblem`. Below
for pauli, coeff in sorted(tapered_op.label_iter()):
print(f"{coeff.real:+.8f} * {pauli}")

.. testoutput::
.. parsed-literal::

-1.04109314 * I
+0.18093120 * X
Expand All @@ -266,7 +266,7 @@ Now, all you need to do is the use the
:meth:`~qiskit_nature.second_q.problems.BaseProblem.get_tapered_mapper` method and provide the
original mapper which you would like to wrap:

.. testcode::
.. code:: ipython3

tapered_mapper = problem.get_tapered_mapper(mapper)

Expand All @@ -275,7 +275,7 @@ original mapper which you would like to wrap:
for pauli, coeff in sorted(tapered_op.label_iter()):
print(f"{coeff.real:+.8f} * {pauli}")

.. testoutput::
.. parsed-literal::

-1.04109314 * I
+0.18093120 * X
Expand Down
Loading