Skip to content

Releases: qiskit-community/qiskit-nature

Qiskit Nature 0.7.2

23 Feb 10:20
d86d4a0
Compare
Choose a tag to compare

New Features

  • The AngularMomentum.overlap() property will now warn the user, when this matrix is non-unitary.

  • Added support for using Qiskit Nature with Python 3.12.

Bug Fixes

  • Fixes the AngularMomentum operator further to also support cases where the number of beta-spin particles exceeds the number of alpha-spin particles.

  • The commutator methods were faultily trying to call normal_order() on their operands, which are not guaranteed to have this method. Now, they no longer call this method and instead it is up to the user to normal-order the result as needed.

Qiskit Nature 0.7.1

28 Nov 15:25
fb4bd65
Compare
Choose a tag to compare

New Features

Bug Fixes

To make the fix take effect, the new additional overlap argument needs to be provided to all of these operators.
Prior to this fix, none of the operators above were able to resolve any spin contamination and would yield misleadingly “clean” expectation values. See this issue for a more complete discussion.

Qiskit Nature 0.7.0

09 Nov 17:14
ed6d0c1
Compare
Choose a tag to compare

Prelude

Qiskit Nature has been migrated to the qiskit-community Github organization to further emphasize that it is a community-driven project. To reflect this change and because we are onboarding additional codeowners and maintainers, with this version (0.7) we have decided to remove all deprecated code, regardless of the time of its deprecation. This ensures that the new members of the development team do not have a large bulk of legacy code to maintain. This can mean one of two things for you as the end-user:

  1. Nothing, if you already migrated your code and no longer rely on any deprecated features.

  2. Otherwise, you need to migrate your code immediately. If you cannot do that, or want to continue using some of the features that were removed, you should pin your version of Qiskit Nature to 0.6

You can check out the migration guides for details on how to update your code. For more context on the changes around Qiskit Nature and the other application projects as well as the algorithms library in Qiskit, be sure to read this blog post.

New Features

  • Adds a new lattice class, HexagonalLattice for the generation of hexagonal lattices.
    You construct a hexagonal lattice by specifying the number of rows and columns of hexagons. You can also specify the edge- and on-site-parameters.
    Below is a simple example to illustrate this:

    from qiskit_nature.second_q.hamiltonians.lattices import HexagonalLattice
    
    lattice = HexagonalLattice(
        2,
        3,
        edge_parameter=1.0,
        onsite_parameter=1.5,
    )
  • Adds a new lattice class, KagomeLattice for the generation of kagome lattices. For example, you can construct a kagome lattice with 4 and 3 unit cells in the x and y direction, respectively, which has weights 1.0 on all edges, weights 1.5 on self-loops and open boundary conditions

    from qiskit_nature.second_q.hamiltonians.lattices import (
        KagomeLattice,
        BoundaryCondition,
    )
    
    kagome = KagomeLattice(
        4,
        3,
        edge_parameter = 1.0,
        onsite_parameter = 1.5,
        boundary_condition = BoundaryCondition.OPEN
    )
  • Adds new operator generator functions to allow more fine-grained spin observables. The new functions are:

    • the $S^+$ operator: s_plus_operator()
    • the $S^-$ operator: s_minus_operator()
    • the $S^x$ operator: s_x_operator()
    • the $S^y$ operator: s_y_operator()
    • the $S^z$ operator: s_z_operator()

    All of these functions take the number of spatial orbitals as their only argument and return the constructed FermionicOp. This also allows a much simpler implementation of the AngularMomentum which is simply the $S^2$ operator:

$$ S^2 = S^- S^+ + S^z (S^z + 1) $$

  • Introduced a new feature that implements the bosonic operator BosonicOp. Its functionalities are analogous to the FermioniOp, but for commuting bosonic particles. It should be used to represent a bosonic operator, so if one wants to represent the boson number operator it should do for example:

    from qiskit_nature.second_q.operators import BosonicOp
    bosonic_op = BosonicOp({'+_0 -_0': 1}, num_modes=1)

    Due to the nature of bosonic particles, this class uses the commutator relations instead of the anti-commutator ones (used by fermionic particles).

  • In order to use the bosonic operator for quantum applications, this feature also introduces the bosonic linear mapper, which allows to map the BosonicOp to the qubit space. This mapper is based on this paper. To use this mapper one can for example:

    from qiskit_nature.second_q.mappers import BosonicLinearMapper
    mapper = BosonicLinearMapper(truncation=1)
    qubit_op = mapper.map(bos_op)
  • The symmetry folding and unfolding routines listed below could become severe bottlenecks for larger system sizes. Now, when PySCF is installed, its routine will be used which is significantly faster.

    • unfold_s4_to_s1()
    • unfold_s8_to_s1()
    • unfold_s8_to_s4()
    • fold_s1_to_s4()
    • fold_s1_to_s8()
    • fold_s4_to_s8()
  • Adds a new multi argument to the PolynomialTensor.apply() method which allows handling of numpy routines which return more than one array. The same argument also gets exposed by ElectronicIntegrals.apply().

  • Adds the following new utility methods for splitting and stacking multi-tensors:

    • PolynomialTensor.split()
    • PolynomialTensor.stack()
    • ElectronicIntegrals.split()
    • ElectronicIntegrals.stack()
  • Adds the SparseLabelOp.from_terms() method which is the inverse of SparseLabelOp.terms().

  • Adds the SparseLabelOp.permute_indices() method which allows index permutations to be applied to an operator. For example:

    from qiskit_nature.second_q.operators import FermionicOp
    
    op = FermionicOp({"+_0 +_2 -_1 -_3": 1.0}, num_spin_orbitals=4)
    
    permuted_op = op.permute_indices([3, 1, 0, 2])
    print(permuted_op)
    # Fermionic Operator
    # number spin orbitals=4, number terms=1
    #   1.0 * ( +_3 +_0 -_1 -_2 )

    This is a very powerful method so caution is advised when using it as other components of the stack may rely on assumptions which are no longer valid after such a permutation (for example the builtin two-qubit reduction of the ParityMapper).

  • The SparseLabelOp.register_length attribute (and by extension that of its subclasses, too) can no longer take None as its value. However, the attributes which this one might rely on (e.g. FermionicOp.num_spin_orbitals or BosonicOp.num_modes) can remain None. This ensures that the lower-bound behavior works as intended.

  • Added linear algebra utilities for performing the double-factorization of a two-body tensor:

    • qiskit_nature.utils.double_factorized()
    • qiskit_nature.utils.modified_cholesky()
  • The active_orbitals argument of the ActiveSpaceTransformer may now also take a pair of lists of integers, each of which have a length identical to the number of active spatial orbitals. In this case, the first list indicates the alpha- and the second list the beta-spin orbital indices, respectively.

  • Adds a new convenience subclass of the UCC ansatz. Namely, the spin-symmetry-adapted ansatz, PUCCSD, which includes single and double excitations while always pairing the excitations such that both, the number of particles and the total spin, will be preserved.
    You can use it like any of the other UCC-style ansätze, for example:

    from qiskit_nature.second_q.circuit.library import PUCCSD
    from qiskit_nature.second_q.mappers import JordanWignerMapper
    
    ansatz = PUCCSD(
        num_spatial_orbitals=4,
        num_particles=(2, 2),
        qubit_mapper=JordanWignerMapper(),
    )
  • Added the new include_imaginary keyword argument to the UCC, UCCSD, and PUCCD classes. When True, an extra ansatz parameter is added to each excitation that controls the imaginary contribution to its evolution. Thus, this setting doubles the total number of ansatz parameters, as compared to the default setting of False.

Upgrade Notes

  • Support for running with Python 3.7 has been removed. To run Nature you need a minimum Python version of 3.8.

Bug Fixes

  • The ActiveSpaceTransformer would sometimes set the wrong number of active particles because of a flawed integer rounding. This has now been fixed.
  • Fixes a formatting issue when printing an ElectronicStructureResult which contains values in extracted_transformer_energies
  • Fixes the tutorial for the excited state solvers. In doing so, the EvaluationRule is properly exposed for importing and documenting accordingly.
  • Fixes the computation of ElectronicEnergy.coulomb() (and by extension ElectronicEnergy.fock()) when applied to a purely alpha-spin Hamiltonian but providing a mixed spin density.
  • Fixes the behavior of the FreezeCoreTransformer when a charge is present on the molecule.
  • When using SparseLabelOp.from_polynomial_tensor() constructor for one of BosonicOp, FermionicOp, SpinOp, or VibrationalOp, the coefficient for the constant term was a 0d Tensor object rather than a number. This has been fixed.
  • The ElectronicStructureProblem.reference_energy is now properly propagated to the ElectronicStructureResult.hartree_fock_energy.
  • Fixes the logic of the InterleavedQubitMapper to actually perform the interleaving on the second-quantization level rather than the qubit level. This ensures that the actually expected benefits from using an interleaved ordering (for example when mapping a paired double-excitation where all Z terms cancel each other) occur, rather than a naive re-shuffling of the already mapped qubit operator.
  • Fixes the behavior of SpinOp.to_matrix() for operators acting on more than a single spin.
  • Fixes the copy.copy and copy.deepcopy operations for the Tensor class.
  • Fixes a regression in the performance of the map() method
  • Compatibility fix to support optional sparse install under Python 3.11.
  • Fixed the support of use_pauli_sum_op in the UCC and UVCC classes as well as their extensions. This requires version 0.24 or higher of the qiskit-terra package.

Qiskit Nature 0.6.2

01 Jun 15:21
4f2118b
Compare
Choose a tag to compare

Bug Fixes

Qiskit Nature 0.6.1

17 May 13:13
990aef2
Compare
Choose a tag to compare

Bug Fixes

Qiskit Nature 0.6.0

14 Apr 13:11
54030a2
Compare
Choose a tag to compare

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 a TaperedQubitMapper 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 the ActiveSpaceTransformer 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 the FCIDump, QCSchema, or PySCFDriver to attempt and leverage the symmetric_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 a SparseLabelOp 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 with QEOM.
  • Added public methods symmetry_reduce_clifford() and convert_clifford() and find_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 the QEOM 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

Read more

Qiskit Nature 0.5.2

07 Dec 15:55
bc5b9f4
Compare
Choose a tag to compare

Changelog

Bug Fixes

  • Fixes the VQEClient to work properly with the latest code.

Qiskit Nature 0.5.1

18 Nov 17:19
996454d
Compare
Choose a tag to compare

Changelog

Bug Fixes

Qiskit Nature 0.5.0

07 Nov 19:37
f0039d4
Compare
Choose a tag to compare

Changelog

Prelude

  • Qiskit Nature 0.5 comes with a major redesign of the BaseProblem layer of its stack. Rather than tightly integrating drivers and transformers, problems are now a lot more standalone and are generated by the various drivers (or built out by a user to their custom needs directly).

New Features

  • The algorithms module now requires the new algorithms introduced in Qiskit Terra 0.22 which in turn rely on the Qiskit Primitives themselves. For more details check out the migration guide for problem solving.
  • The refactoring of the electronic structure stack has enabled the development of third-party plugins allowing classical codes to call Qiskit Nature instead of relying on the development of drivers in the Qiskit Nature package. One example is the new Qiskit Nature PySCF Plugin which can be used. Qiskit Nature still provides drivers to enable simple testing and provide a more accessible entry to Qiskit Nature for users who do not come from a classical chemistry computing background. Check out the migration guide for electronic structure calculations to learn how to update your code to use the refactored drivers.
  • The properties concept has been largely redesigned and is a lot more refined now. Instead of being a “catchall” for operator factories, the module has been cleanly separated into various components. Check out the corresponding section of the migration guide for electronic structure calculations for more details.
  • The vibrational structure stack has been refactored in-line with the changes to the electronic structure stack mentioned previously. However, changes to this stack also include corrections to the differentiation of real-space and second-quantized coefficients of the Watson hamiltonian. For more details, check out the migration guide for vibrational structure calculations.
  • The lattices and related LatticeModel classes have undergone some API changes, particularly around the location of the utility methods for uniform lattice generation. For more details check out the migration guide for lattice models.
  • Added the qiskit_nature.second_q.properties.HeisenbergModel which implements the Hamiltonian of the Heisenberg model. This model is used in the study of critical points and phase transitions of magnetic systems. Through the choice of the model constants and the external magnetic field, we can produce many models like: XYZ, XXX, Ising model and others.
  • Adds .SparseLabelOp.equiv for checking approximate equality between two SparseLabelOps.
  • The performance of the following mappers, when used to map multiple operators of identical size, is significantly improved, by means of caching internal structures
  • Adds a new Property for the electronic structure stack to evaluate the 1- and 2-body reduced density matrices. Assuming that you already have an instance of your qiskit_nature.second_q.problems.ElectronicStructureProblem, you can add the qiskit_nature.second_q.properties.ElectronicDensity
  • Adds the PropertiesContainer and its subclasses to simplify the handling of SparseLabelOpsFactory instances inside of problems. This container is a MutableSet and enforces at most a single instance of any Property kind to be stored inside of it This is sufficient for all application purposes of the auxiliary operators (which are generated by these objects).
  • Adds the new keyword argument mirror to the SUCCD ansatz, which allows the inclusion of symmetrically mirrored double excitations while preserving the number of circuit parameters.
  • Adds support for the QCSchema via which we aim to standardize the I/O between classical drivers and Qiskit Nature.
  • Implements both HartreeFock and VSCF as subclasses of BlueprintCircuit. This allows the respective classes to be instantiated without explicitly setting all of their instance attributes. Missing attributes can be set at a later point to complete the respective circuit definitions.
  • The new qiskit_nature.second_q.operators.FermionicOp replaces the old qiskit_nature.operators.second_quantization.operators.FermionicOp. This new operator is a subclass of the qiskit_nature.second_q.operators.SparseLabelOp and, as such, only support sparse labels. It is initialized with a dictionary, mapping sparse label keys to coefficients. It supports the usual algebra for operator addition, scalar multiplication, operator composition, operator tensoring, and complex conjugation. It also provides methods for sorting, equality and equivalency checking, operator simplification, normal ordering, and the computation of induced norms as well as hermiticity properties. Finally, it can also be converted to matrices in the occupation number basis.
  • Added the xcf argument to the qiskit_nature.second_q.drivers.GaussianForcesDriver.from_molecule() which allows specifying the exchange-correlation functional to be used by Gaussian.
  • The excitation_list property has been removed from HFInitialPoint, MP2InitialPoint, and VSCFInitialPoint. Thus the excitation list cannot be set directly, rather this must be set via the ansatz.
  • Following the MP2 T2 and energy correction calculation fix, the APIs for MP2InitialPoint and HFInitialPoint have been changed slightly. After setting the grouped_property, the total_energy and energy_correction are now accessed via their respective properties, rather than via get_energy and get_energy_correction.
  • Adds atol parameter to SparseLabelOp.is_hermitian().
  • The supported excitation types in the QEOM code have been updated. It now exposes the full set of excitation generation functionalities provided by the internally used UCC and UVCC ansatze. In particular, this means that rather than providing a custom list of excitation tuples, a function can be set by the user which generates such a custom list. The documentation has been updated accordingly to reflect this in all places.
  • Adds SparseLabelOp.induced_norm().
  • Changes usage of library retworkx to the new substitute rustworkx.
  • Adds utility functions for converting between chemists’ and physicists’ index ordering for two-body integrals. qiskit_nature.second_q.operators.tensor_ordering.to_chemist_ordering() converts from physicists’ or intermediate order to chemists’, whereas [qiskit_nature.second_q.operators.tensor_ordering.to_physicist_ordering...
Read more

Qiskit Nature 0.4.5

22 Sep 21:03
0b4ae78
Compare
Choose a tag to compare

Changelog

Bug Fixes

  • Fix the initial point classes to account for the number of times the evolved operators are repeated in the ansatz.
  • Fixes the compatibility of the fermionic excitation generator options which disables spin preserving while also enabling generalized behavior. Now, combining generalized=True with preserve_spin=False results in all combinations of excitations in the given spin orbital space. De-excitations are not included and filtered accordingly.
  • Fixes the qiskit_nature.runtime.VQEClient to correctly detect the type of the wrapped auxiliary operators. Previously, it would always wrap them into a dictionary and then fail when unwrapping them later, since it did not preserve the previously wrapped data type.