Qiskit Nature 0.6.0
Prelude
Qiskit Nature 0.6 focuses on refactoring of the mappers module. To that extent, the QubitConverter class has been deprecated in favor of using the various subclasses of QubitMapper directly.
Check out the migration guide for the QubitConverter for more details. Besides this major refactoring, a few other changes have been done, so be sure to check out the migration guide from 0.5 to 0.6.
New Features
- Adds a Tapered Qubit Mapper class. TaperedQubitMapper is to be used as a wrapper of another standard QubitMapper that can apply symmetry reduction techniques to operators at the end of the mapping.
- Adds the method get_tapered_mapper() to transform a
QubitMapper
instance into aTaperedQubitMapper
based on the properties of the current problem. - Added support for running with Python 3.11. At the the time of the release, Psi4 and Sparse didn’t have a python 3.11 version.
- Three new methods for creating instances ElectronicDensity have been added for:
- constructing an empty (or all-zero) density of a given size
- constructing an identity density, meaning that the 1-body matrices are initialized with identity matrices
- constructing from a provided number of particles. This is a shorter variant of the already existing from_orbital_occupation method for the most common use-case.
- All of the methods above take the optional keyword-argument include_rdm2 which determines whether or not the 2-body matrices are computed based on the constructed 1-body matrices. By default, this is set to
True
. - Added the InterleavedQubitMapper which allows wrapping of another
FermionicMapper
to produce qubit operators where the alpha- and beta-spin components are arranged in the qubit register in an interleaved rather than blocked order. - Adds the symmetric_two_body module. This module provides utilities to exploit the inherent symmetries of chemistry-ordered two-body electronic integrals. You may use these to reduce memory consumption of your code
- Since these integral containers are integrated into the stack, you can continue to use existing tools such as the
BasisTransformer
or even theActiveSpaceTransformer
as if you had stored your integrals in standard arrays. - Adds the use_symmetry_reduced_integrals setting. When set to
True
, this will cause objects like for example theFCIDump
,QCSchema
, orPySCFDriver
to attempt and leverage thesymmetric_two_body
module in order to reduce the memory requirements at runtime. - Adds the new Tensor class used internally to consistently deal with n-dimensional tensors throughout the stack. This class also exposes the
label_template
which allows an end-user to influence the translation procedure implemented in from_polynomial_tensor(). - Adds the new tensor_unwrapping setting which may be set to False to disable the unwrapping of internally created Tensor objects stored inside of a
PolynomialTensor
. See also tensor_unwrapping for more details. - Adds the new argument num_particles to the ParityMapper which will implement the two qubit reduction without requiring an instance of
QubitConverter
. - Extends the VibrationalIntegrals to fall back to using numpy arrays when the optional sparse dependency is not installed.
- Leverage library opt_einsum, if installed, for sparse-einsum support. This library supports einsum summation directly on sparse objects as described in its documentation.
- The new keyword argument
register_length
has been added to the QubitMapper.map() method. This allows the user to set the length of aSparseLabelOp
before mapping it (since this length is a lower bound). - Improves the
QEOM
code and implements the calculation of excited state properties and transition amplitudes withQEOM
. - Added public methods
symmetry_reduce_clifford()
andconvert_clifford()
andfind_taper_op()
to allow a step by step tapering of operators. - Changed the behavior of the GroundStateEigensolver to not raise an error when the user specifies a auxiliary operator which name clashes an internally constructed operator’s name. The new behavior is to apply precedence to the user-defined operators over the builtin ones in case of conflicts. A warning will be logged when this case happens.
- Added a tolerance parameter
tol
to control the eigenvalue threshold in theQEOM
calculation. - Adds the new formatting_precision attribute to all result objects. This attribute sets the number of decimal places to be used when formatting the result object for printing. It defaults to 12.
- Added
qiskit_nature.testing
to house testing utilities. Currently it contains some functions for random sampling. - Updated the API to allow QubitMapper objects in places where QubitConverter were previously required. This addition advances toward a future deprecation of QubitConverter. All inputs of type QubitConverter now support QubitMapper objects implementing a transformation from second quantized operators to Pauli operators. Note that the mappers currently do not support qubit reduction techniques.
- The method map() now supports individual operators as well as lists and dictionaries of operators.
Deprecation Notes
- Deprecated all MinimumEigensolverFactory and EigensolverFactory classes. Instead, users should now build the respectively generated solver instances themselves. How-to guides to detail the involved steps have been added to the documentation
- Deprecated the to_matrix() method. The same functionality can be achieved via the qubit-operator after applying the JordanWignerMapper (one only needs to adapt to the different basis state ordering due to the reversed bitstring endianness).
- The QubitConverter class is deprecated in favor of using the QubitMapper implementations directly. As a consequence of this, all public properties and function arguments which referred to the
QubitConverter
by name (e.g.qubit_converter
) have been deprecated in favor of properties and function arguments referring toQubitMapper
(e.g.qubit_mapper
), respectively. - The symmetry_sector_locator() method has been deprecated without a direct replacement. This utility is no longer needed in the new workflow which uses QubitMapper instances directly. Qubit tapering can instead now be done using the TaperedQubitMapper which can be constructed easily using the get_tapered_mapper() method.
- The
match_convert
argument of thehartree_fock_bitstring_mapped()
method has been deprecated without replacement. This utility is no longer needed in the new workflow which usesQubitMapper
instances directly. - The
VQEClient
and its matchingVQERuntimeResult
are now deprecated. Instead, users should migrate their code to use the Qiskit Runtime Primitives. A guide on how to use this can be found here. - Deprecates
np.ndarray
as the return type of thehijkl
,hijkl_ba
, andhijkl_bb
attributes. Instead, these will always be SymmetricTwoBodyIntegrals. Instances of the latter can be used as np.ndarray so in terms of functionality this should not change anything. However, isinstance(integrals, np.ndarray) will not return True for integrals of type SymmetricTwoBodyIntegrals. Additionally, the three FCIDump attributes will no longer accept physicist-ordered two-body tensors in the future. - Deprecated the default value (
True
) oftensor_unwrapping
meaning that in the future__getitem__()
will return objects of type Tensor. - The
M
,Q
,W
,V
matrix setters andM
,Q
,W
,V
matrix standard deviation setters fromQEOMResult
were pending deprecated and remain computable from theH
andS
matrices. QubitMapper.allows_two_qubit_reduction
has been deprecated. There is no replacement because it is no longer needed in the new design.- All arguments in the
QubitMapper
API (and its subclasses) which were previously callednmodes
have been renamed toregister_length
.
Bug Fixes
- Fixes
SparseLabelOp.assign_parameters()
failing to assign parameters recursively. - The commutator methods
commutator()
,anti_commutator()
, anddouble_commutator()
no longer faultily simplify the returned operator (i.e. the absolute tolerance during simplification is set to zero instead of defaulting toSparseLabelOp.atol
). - Fixes a bug when printing the
total_dipole_moment_in_debye
- Fixes output of
generate_fermionic_excitations()
when called withperserve_spin=False
and unequal number of alpha and beta particles - Fixes the
qcschema_to_problem()
method to takeQCWavefunction.eri_mo_ab
into account whenQCWavefunction.eri_mo_ba
is not available. - Fixes the behavior of
is_zero()
when called on a parameterized operator. - Fixes a bug when multiplying a
SparseLabelOp
with numpy numeric types from the left. - Removes wrong sign change from
SpinOp.index_order()
. - Fixes the
normal_order()
method, which in turn corrects the commutation relations of this operator type. - Fixes the
VQEClient
to work properly with the latest code. - Added missing Gaussian native libraries from package
qiskit_nature.second_q.drivers.gaussiand.gauopen
to the wheels file distribution. - Fixes a bug in which
BogoliubovTransform
would sometimes throw an error due to an inability to cast complex numbers to floats. - Fix support of
BackendV2
in theVQEClient
. Previously, backends instantiated with theIBMProvider
failed since they return backends of type BackendV2, which were not correctly supported in the VQE client. Backends instantiated with the IBMQ provider continue to work as before.