From 528b3412bd3ddeb0ad1c38fd782147e869bc514c Mon Sep 17 00:00:00 2001 From: woodsp Date: Fri, 17 Apr 2020 17:44:44 -0400 Subject: [PATCH 1/2] Update chemistry documentation --- docs/conf.py | 1 + qiskit/chemistry/__init__.py | 105 +++++++++++++++++- qiskit/chemistry/algorithms/__init__.py | 25 +++-- .../algorithms/eigen_solvers/q_eom_ee.py | 2 +- qiskit/chemistry/drivers/__init__.py | 47 ++++++-- qiskit/chemistry/drivers/_basedriver.py | 14 ++- .../drivers/fcidumpd/fcidumpdriver.py | 3 +- .../drivers/gaussiand/gaussiandriver.py | 14 ++- qiskit/chemistry/drivers/hdf5d/hdf5driver.py | 15 +-- qiskit/chemistry/drivers/psi4d/psi4driver.py | 13 ++- .../drivers/pyquanted/pyquantedriver.py | 12 +- .../chemistry/drivers/pyscfd/pyscfdriver.py | 12 +- qiskit/chemistry/fermionic_operator.py | 22 +++- qiskit/chemistry/qmolecule.py | 20 +++- 14 files changed, 240 insertions(+), 65 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index ab61843009..2d453f1867 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -89,6 +89,7 @@ autodoc_default_options = { 'inherited-members': None, + 'show-inheritance': None, } diff --git a/qiskit/chemistry/__init__.py b/qiskit/chemistry/__init__.py index c6041074b5..fe496fb816 100644 --- a/qiskit/chemistry/__init__.py +++ b/qiskit/chemistry/__init__.py @@ -11,14 +11,115 @@ # Any modifications or derivative works of this code must retain this # copyright notice, and modified files need to carry a notice indicating # that they have been altered from the originals. -""" +r""" ============================================================== Chemistry application stack for Aqua (:mod:`qiskit.chemistry`) ============================================================== -This is the chemistry domain logic.... .. currentmodule:: qiskit.chemistry +This is the chemistry application stack for Aqua that provides for experimentation with chemistry +domain problems such as ground state energy and excited state energies of molecules. + +Overview +======== + +This is an overview of the workings of the chemistry stack and how it may be used. There +are different levels of exposure to its functionality, allowing for experimentation at different +abstractions. The outline below starts with the flow that provides the most control of the +process. + +A classical chemistry driver is first instantiated, from the available :mod:`~.drivers`, +by means of a molecule specification, along with other configuration such as basis set and method +(RHF, ROHF, UHF). This configuration may include custom settings for the specific driver for more +custom control over the driver's behavior. When the driver is run the output is a mostly driver +independent :class:`~.QMolecule`. This contains various quantities that were +computed including one and two-body electron integrals that are used as input +:class:`~qiskit.chemistry.FermionicOperator`. Mostly driver independent means that these integrals, +for example, will be there from every driver but the values may differ due to how each underlying +chemistry library/program computes them. Also some fields in the QMolecule may not be populated by +all drivers, for instance dipole integrals are not output from the PyQuante driver, and hence the +dipole moment cannot be computed by qiskit.chemistry when using this driver. The FermionicOperator +once created can then be converted/mapped to a qubit operator for use as input to an Aqua +algorithms. The operator must be in qubit form at this stage since the execution target of the +algorithm will be a quantum device, or simulator ,comprised of qubits and the mapping is needed as +qubits behave differently than fermions. Once the algorithm is run it will compute the electronic +part of the quantity, such as the electronic ground state energy. To get the total ground state +energy this can be combined with the nuclear repulsion energy in the QMolecule. + +Instead of using the FermionicOperator the :class:`.core.Hamiltonian` may be used. This +itself uses the FermionicOperator but provides a higher level of function to simplify use. For +instance the FermionicOperator supports particle-hole transformation and different mappings. And to +compute dipole moments each of the X, Y and Z dipole integrals must be prepared, as individual +FermionicOperators, in a like manner to the main electronic energy one, i.e. same transformations, +and eventually same qubit mapping. The core.Hamiltonian class does all this and more, such as +orbital reductions, frozen core and automatic symmetry reduction. When run with a QMolecule output +from a driver it produces qubit operators that can be given directly to Aqua algorithms for +the computation. Also available are several properties, such as number of particles and number of +orbitals, that are needed to correctly instantiate chemistry specific components such as +:class:`~.components.variational_forms.UCCSD` and :class:`~.components.initial_states.HartreeFock`. +Using the FermionicOperator directly requires taking the initial values for the QMolecule and then +keeping track of any changes based on any orbital elimination and/or freezing, and/or Z2Symmetry +reductions that are done. Once the output qubit operators have been used with an Aqua algorithm, +to compute the electronic result, this result can be fed back to the core.Hamiltonian, to +:meth:`~.core.Hamiltonian.process_algorithm_result` which will then compute a final total result +including a user friendly formatted text result that may be printed. + +Lastly the chemistry :mod:`~.applications` may be used. These are given a chemistry driver and, +in the case of :class:`~applications.MolecularGroundStateEnergy` an optional instance of an Aqua +:class:`~qiskit.aqua.algorithms.MinimumEigensolver`, such as :class:`~qiskit.aqua.algorithms.VQE`. +Optional since components such as :class:`~.components.variational_forms.UCCSD` need certain +information that may be unknown at this point. So alternatively, when its method +:meth:`~applications.MolecularGroundStateEnergy.compute_energy` is run a callback can be provided +which will later be passed information, such as number of particles and orbitals, and allow a +complete MinimumEigensolver to be built using say UCCSD with HartreeFock, and subsequently returned +to the application and run. MinimumEigensolver itself uses the core.Hamiltonian class wrapping +it to form this high level application. + +Mappings +++++++++ +To map the FermionicOperator to a qubit operator Qiskit Chemistry supports the following mappings: + +Jordan Wigner + The `Jordan-Wigner transformation `__, + maps spin operators onto fermionic creation and annihilation operators. + It was proposed by Ernst Pascual Jordan and Eugene Paul Wigner + for one-dimensional lattice models, + but now two-dimensional analogues of the transformation have also been created. + The Jordan–Wigner transformation is often used to exactly solve 1D spin-chains + by transforming the spin operators to fermionic operators and then diagonalizing + in the fermionic basis. + +Parity + The `parity-mapping transformation `__. + optimizes encodings of fermionic many-body systems by qubits + in the presence of symmetries. + Such encodings eliminate redundant degrees of freedom in a way that preserves + a simple structure of the system Hamiltonian enabling quantum simulations with fewer qubits. + +Bravyi-Kitaev + Also known as *binary-tree-based qubit mapping*, the `Bravyi-Kitaev transformation + `__ + is a method of mapping the occupation state of a + fermionic system onto qubits. This transformation maps the Hamiltonian of :math:`n` + interacting fermions to an :math:`\mathcal{O}(\log n)` + local Hamiltonian of :math:`n` qubits. + This is an improvement in locality over the Jordan–Wigner transformation, which results + in an :math:`\mathcal{O}(n)` local qubit Hamiltonian. + The Bravyi–Kitaev transformation was proposed by Sergey B. Bravyi and Alexei Yu. Kitaev. + +Bravyi-Kitaev Superfast + `Bravyi-Kitaev Superfast (BKSF) `__ algorithm + is a mapping from fermionic operators to qubit operators. BKSF algorithm defines an abstract + model where the fermionic modes are mapped to vertices of an interaction graph. The edges of + the graph correspond to the interaction between the modes. The graph can be constructed from + the Hamiltonian. The simulation is done by putting qubits on the edges of the graph. Each + fermionic operator costs :math:`\mathcal{O}(d)` qubit operations, where :math:`d` is the + degree of the interaction graph. The BKSF was proposed by Kanav Setia and James D. Whitfield. + + +The classes and submodules of qiskit.chemistry are now listed for reference: + Chemistry Error =============== diff --git a/qiskit/chemistry/algorithms/__init__.py b/qiskit/chemistry/algorithms/__init__.py index 947ebc0528..17d5ff1041 100644 --- a/qiskit/chemistry/algorithms/__init__.py +++ b/qiskit/chemistry/algorithms/__init__.py @@ -15,30 +15,37 @@ """ Chemistry specific Aqua algorithms (:mod:`qiskit.chemistry.algorithms`) ======================================================================= -These are chemistry specific Aqua algorithms where they inherit from -:class:`QuantumAlgorithm`. As they rely on chemistry specific knowledge -and/or functions they live here rather than in Aqua. +These are chemistry specific algorithms for Aqua. As they rely on chemistry +specific knowledge and/or function they are here in chemistry rather than in Aqua. .. currentmodule:: qiskit.chemistry.algorithms -Chemistry Quantum Algorithms -============================ +Chemistry Algorithms +==================== +These are algorithms configured and/or functioning using chemistry specific knowledge. See also +the Aqua :mod:`~qiskit.aqua.algorithms` for other algorithms in these categories which may also +be used for chemistry problems such as :class:`~qiskit.aqua.algorithms.VQE`. + +Eigensolvers +++++++++++++ +Algorithms that can find the eigenvalues of an operator, i.e. excited states for chemistry. .. autosummary:: :toctree: ../stubs/ :nosignatures: QEomVQE - VQEAdapt + QEomEE -Chemistry Classical Algorithms -============================== +Minimum Eigensolvers +++++++++++++++++++++ +Algorithms that can find the minimum eigenvalue of an operator, i.e. ground state for chemistry. .. autosummary:: :toctree: ../stubs/ :nosignatures: - QEomEE + VQEAdapt """ diff --git a/qiskit/chemistry/algorithms/eigen_solvers/q_eom_ee.py b/qiskit/chemistry/algorithms/eigen_solvers/q_eom_ee.py index 7face6d33b..ab1828c6b7 100644 --- a/qiskit/chemistry/algorithms/eigen_solvers/q_eom_ee.py +++ b/qiskit/chemistry/algorithms/eigen_solvers/q_eom_ee.py @@ -27,7 +27,7 @@ class QEomEE(NumPyMinimumEigensolver): - """ QEomEE algorithm """ + """ QEomEE algorithm (classical) """ def __init__(self, operator: BaseOperator, num_orbitals: int, num_particles: Union[List[int], int], diff --git a/qiskit/chemistry/drivers/__init__.py b/qiskit/chemistry/drivers/__init__.py index 2e7580657a..15bac51925 100644 --- a/qiskit/chemistry/drivers/__init__.py +++ b/qiskit/chemistry/drivers/__init__.py @@ -15,14 +15,36 @@ """ Chemistry Drivers (:mod:`qiskit.chemistry.drivers`) ========================================================= -Chemistry drivers take a molecule configuration as input, and run classical -software to produce a :class:`QMolecule` containing information the -chemistry stacks needs to produce input for a Quantum Algorithm. Such information -includes one and two-body electronic integrals, dipole integrals, nuclear -repulsion energy and more. - .. currentmodule:: qiskit.chemistry.drivers +Qiskit Chemistry requires a computational chemistry program or library, accessed via a chemistry +*driver*, to be installed on the system for the electronic-structure computation of a given +molecule. A driver is created with a molecular configuration, passed in the format compatible with +that particular driver. This allows custom configuration specific to each computational chemistry +program or library to be passed. + +Qiskit Chemistry thus allows the user to configure a chemistry problem in a way that a chemist +already using the underlying chemistry program or library will be familiar with. The driver is +used to compute some intermediate data, which later will be used to form the input to an Aqua +algorithm. Such intermediate data, is populated into a :class:`~qiskit.chemistry.QMolecule` +object and includes the following for example: + +1. One- and two-body integrals in Molecular Orbital (MO) basis +2. Dipole integrals +3. Molecular orbital coefficients +4. Hartree-Fock energy +5. Nuclear repulsion energy + +Once extracted, the structure of this intermediate data is independent of the driver that was +used to compute it. However the values and level of accuracy of such data will depend on the +underlying chemistry program or library used by the specific driver. + +Qiskit Chemistry offers the option to serialize the Qmolecule data in a binary format known as +`Hierarchical Data Format 5 (HDF5) `__. +This is done to allow chemists to reuse the same input data in the future and to enable researchers +to exchange input data with each other --- which is especially useful to researchers who may not +have particular computational chemistry drivers installed on their computers. + Driver Base Class ================= @@ -60,21 +82,26 @@ qiskit.chemistry.drivers.gaussiand qiskit.chemistry.drivers.psi4d - qiskit.chemistry.drivers.pyscfd qiskit.chemistry.drivers.pyquanted + qiskit.chemistry.drivers.pyscfd -The :class:`HDF5Driver` reads and writes molecular data from a file and is not dependent -on any external chemistry program/library and needs no special install. +The :class:`HDF5Driver` reads molecular data from a pre-existing HDF5 file, as saved from a +:class:`~qiskit.chemistry.QMolecule`, and is not dependent on any external chemistry +program/library and needs no special install. + +The :class:`FCIDumpDriver` likewise reads from a pre-existing file in this case a standard +FCIDump file and again needs no special install. .. autosummary:: :toctree: ../stubs/ :nosignatures: GaussianDriver - HDF5Driver PSI4Driver PyQuanteDriver PySCFDriver + HDF5Driver + FCIDumpDriver """ from ._basedriver import BaseDriver, UnitsType, HFMethodType diff --git a/qiskit/chemistry/drivers/_basedriver.py b/qiskit/chemistry/drivers/_basedriver.py index 0a5bbf136c..a5a2c286d8 100644 --- a/qiskit/chemistry/drivers/_basedriver.py +++ b/qiskit/chemistry/drivers/_basedriver.py @@ -19,6 +19,8 @@ from abc import ABC, abstractmethod from enum import Enum +from qiskit.chemistry import QMolecule + class UnitsType(Enum): """ Units Type Enum """ @@ -35,8 +37,7 @@ class HFMethodType(Enum): class BaseDriver(ABC): """ - Base class for Drivers. - + Base class for Qiskit Chemistry Drivers. """ @abstractmethod @@ -44,6 +45,11 @@ def __init__(self): pass @abstractmethod - def run(self): - """ runs driver """ + def run(self) -> QMolecule: + """ + Runs driver to produce a QMolecule output. + + Returns: + A QMolecule containing the molecular data. + """ pass diff --git a/qiskit/chemistry/drivers/fcidumpd/fcidumpdriver.py b/qiskit/chemistry/drivers/fcidumpd/fcidumpdriver.py index f74a2af4ce..f0c7b2ab20 100644 --- a/qiskit/chemistry/drivers/fcidumpd/fcidumpdriver.py +++ b/qiskit/chemistry/drivers/fcidumpd/fcidumpdriver.py @@ -22,7 +22,8 @@ class FCIDumpDriver(BaseDriver): - """Python implementation of an FCIDump driver. + """ + Qiskit chemistry driver reading an FCIDump file. The FCIDump format is partially defined in Knowles1989. diff --git a/qiskit/chemistry/drivers/gaussiand/gaussiandriver.py b/qiskit/chemistry/drivers/gaussiand/gaussiandriver.py index 53fb6134b2..0b611b8012 100644 --- a/qiskit/chemistry/drivers/gaussiand/gaussiandriver.py +++ b/qiskit/chemistry/drivers/gaussiand/gaussiandriver.py @@ -35,13 +35,16 @@ class GaussianDriver(BaseDriver): - """Python implementation of a Gaussian 16 driver. + """ + Qiskit chemistry driver using the Gaussian™ 16 program. + + See http://gaussian.com/gaussian16/ This driver uses the Gaussian open-source Gaussian 16 interfacing code in order to access integrals and other electronic structure information as computed by G16 for the given molecule. The job control file, as provided - via our input file, is augmented for our needs here such as to have it - output a MatrixElement file. + here for the molecular configuration, is augmented for our needs here such + as to have it output a MatrixElement file. """ def __init__(self, @@ -49,9 +52,8 @@ def __init__(self, '# rhf/sto-3g scf(conventional)\n\n' 'h2 molecule\n\n0 1\nH 0.0 0.0 0.0\nH 0.0 0.0 0.735\n\n') -> None: """ - Initializer Args: - config: driver configuration + config: A molecular configuration conforming to Gaussian™ 16 format Raises: QiskitChemistryError: Invalid Input """ @@ -72,7 +74,7 @@ def _check_valid(): "Could not locate {} executable '{}'. Please check that it is installed correctly." .format(GAUSSIAN_16_DESC, GAUSSIAN_16)) - def run(self): + def run(self) -> QMolecule: cfg = self._config while not cfg.endswith('\n\n'): cfg += '\n' diff --git a/qiskit/chemistry/drivers/hdf5d/hdf5driver.py b/qiskit/chemistry/drivers/hdf5d/hdf5driver.py index a2d879e34c..3f7b7ebc08 100644 --- a/qiskit/chemistry/drivers/hdf5d/hdf5driver.py +++ b/qiskit/chemistry/drivers/hdf5d/hdf5driver.py @@ -23,16 +23,17 @@ class HDF5Driver(BaseDriver): - """Python implementation of a hdf5 driver.""" + """ + Qiskit chemistry driver reading an HDF5 file. - KEY_HDF5_INPUT = 'hdf5_input' + The HDF5 file is as saved from a :class:`~qiskit.chemistry.QMolecule` instance. + """ def __init__(self, hdf5_input: str = 'molecule.hdf5') -> None: """ - Initializer Args: - hdf5_input: path to hdf5 file + hdf5_input: Path to HDF5 file """ super().__init__() self._hdf5_input = hdf5_input @@ -40,15 +41,15 @@ def __init__(self, @property def work_path(self): - """ returns work path """ + """ Returns work path. """ return self._work_path @work_path.setter def work_path(self, new_work_path): - """ sets work path """ + """ Sets work path. """ self._work_path = new_work_path - def run(self): + def run(self) -> QMolecule: hdf5_file = self._hdf5_input if self.work_path is not None and not os.path.isabs(hdf5_file): hdf5_file = os.path.abspath(os.path.join(self.work_path, hdf5_file)) diff --git a/qiskit/chemistry/drivers/psi4d/psi4driver.py b/qiskit/chemistry/drivers/psi4d/psi4driver.py index 0d9aeb181d..42939a7605 100644 --- a/qiskit/chemistry/drivers/psi4d/psi4driver.py +++ b/qiskit/chemistry/drivers/psi4d/psi4driver.py @@ -32,16 +32,19 @@ class PSI4Driver(BaseDriver): - """Python implementation of a psi4 driver.""" + """ + Qiskit chemistry driver using the PSI4 program. + + See http://www.psicode.org/ + """ def __init__(self, config: Union[str, List[str]] = 'molecule h2 {\n 0 1\n H 0.0 0.0 0.0\n H 0.0 0.0 0.735\n}\n\n' 'set {\n basis sto-3g\n scf_type pk\n reference rhf\n') -> None: """ - Initializer Args: - config: driver configuration + config: A molecular configuration conforming to PSI4 format Raises: QiskitChemistryError: Invalid Input """ @@ -60,9 +63,7 @@ def _check_valid(): if PSI4_APP is None: raise QiskitChemistryError("Could not locate {}".format(PSI4)) - def run(self): - """ runs driver """ - # create input + def run(self) -> QMolecule: psi4d_directory = os.path.dirname(os.path.realpath(__file__)) template_file = psi4d_directory + '/_template.txt' qiskit_chemistry_directory = os.path.abspath(os.path.join(psi4d_directory, '../..')) diff --git a/qiskit/chemistry/drivers/pyquanted/pyquantedriver.py b/qiskit/chemistry/drivers/pyquanted/pyquantedriver.py index 9e2202d568..a95fadaf38 100644 --- a/qiskit/chemistry/drivers/pyquanted/pyquantedriver.py +++ b/qiskit/chemistry/drivers/pyquanted/pyquantedriver.py @@ -20,7 +20,7 @@ import logging from qiskit.aqua.utils.validation import validate_min from qiskit.chemistry.drivers import BaseDriver, UnitsType, HFMethodType -from qiskit.chemistry import QiskitChemistryError +from qiskit.chemistry import QiskitChemistryError, QMolecule from qiskit.chemistry.drivers.pyquanted.integrals import compute_integrals logger = logging.getLogger(__name__) @@ -34,7 +34,11 @@ class BasisType(Enum): class PyQuanteDriver(BaseDriver): - """Python implementation of a PyQuante driver.""" + """ + Qiskit chemistry driver using the PyQuante2 library. + + See https://github.com/rpmuller/pyquante2 + """ def __init__(self, atoms: Union[str, List[str]] = 'H 0.0 0.0 0.0; H 0.0 0.0 0.735', @@ -46,8 +50,6 @@ def __init__(self, tol: float = 1e-8, maxiters: int = 100) -> None: """ - Initializer - Args: atoms: atoms list or string separated by semicolons or line breaks units: angstrom or bohr @@ -98,7 +100,7 @@ def _check_valid(): raise QiskitChemistryError(err_msg) - def run(self): + def run(self) -> QMolecule: q_mol = compute_integrals(atoms=self._atoms, units=self._units, charge=self._charge, diff --git a/qiskit/chemistry/drivers/pyscfd/pyscfdriver.py b/qiskit/chemistry/drivers/pyscfd/pyscfdriver.py index 2fb4717f14..520f479d56 100644 --- a/qiskit/chemistry/drivers/pyscfd/pyscfdriver.py +++ b/qiskit/chemistry/drivers/pyscfd/pyscfdriver.py @@ -20,7 +20,7 @@ import logging from qiskit.aqua.utils.validation import validate_min from qiskit.chemistry.drivers import BaseDriver, UnitsType, HFMethodType -from qiskit.chemistry import QiskitChemistryError +from qiskit.chemistry import QiskitChemistryError, QMolecule from qiskit.chemistry.drivers.pyscfd.integrals import compute_integrals logger = logging.getLogger(__name__) @@ -35,7 +35,11 @@ class InitialGuess(Enum): class PySCFDriver(BaseDriver): - """Python implementation of a PySCF driver.""" + """ + Qiskit chemistry driver using the PySCF library. + + See https://sunqm.github.io/pyscf/ + """ def __init__(self, atom: Union[str, List[str]] = 'H 0.0 0.0 0.0; H 0.0 0.0 0.735', @@ -49,8 +53,6 @@ def __init__(self, init_guess: InitialGuess = InitialGuess.MINAO, max_memory: Optional[int] = None) -> None: """ - Initializer - Args: atom: atom list or string separated by semicolons or line breaks unit: angstrom or bohr @@ -105,7 +107,7 @@ def _check_valid(): raise QiskitChemistryError(err_msg) - def run(self): + def run(self) -> QMolecule: q_mol = compute_integrals(atom=self._atom, unit=self._unit, charge=self._charge, diff --git a/qiskit/chemistry/fermionic_operator.py b/qiskit/chemistry/fermionic_operator.py index 5910af4531..c931d1414d 100644 --- a/qiskit/chemistry/fermionic_operator.py +++ b/qiskit/chemistry/fermionic_operator.py @@ -54,13 +54,25 @@ class FermionicOperator: def __init__(self, h1, h2=None, ph_trans_shift=None): """ - | This class requires the integrals stored in the '*chemist*' notation - | h2(i,j,k,l) --> adag_i adag_k a_l a_j - | There is another popular notation is the '*physicist*' notation - | h2(i,j,k,l) --> adag_i adag_j a_k a_l + This class requires the integrals stored in the '*chemist*' notation + + h2(i,j,k,l) --> adag_i adag_k a_l a_j + + and the integral values are used for the coefficients of the second-quantized + Hamiltonian that is built. The integrals input here should be in block spin + format and also have indexes reordered as follows 'ijkl->ljik' + + There is another popular notation, the '*physicist*' notation + + h2(i,j,k,l) --> adag_i adag_j a_k a_l If you are using the '*physicist*' notation, you need to convert it to - the '*chemist*' notation first. E.g., h2 = numpy.einsum('ikmj->ijkm', h2) + the '*chemist*' notation. E.g. h2=numpy.einsum('ikmj->ijkm', h2) + + The :class:`~qiskit.chemistry.QMolecule` class has + :attr:`~qiskit.chemistry.QMolecule.one_body_integrals` and + :attr:`~qiskit.chemistry.QMolecule.two_body_integrals` properties that can be + directly supplied to the `h1` and `h2` parameters here respectively. Args: h1 (numpy.ndarray): second-quantized fermionic one-body operator, a 2-D (NxN) tensor diff --git a/qiskit/chemistry/qmolecule.py b/qiskit/chemistry/qmolecule.py index fe505d8398..f862ea2ead 100644 --- a/qiskit/chemistry/qmolecule.py +++ b/qiskit/chemistry/qmolecule.py @@ -28,7 +28,19 @@ class QMolecule: - """Molecule data class with driver information.""" + """ + Molecule data class containing driver result. + + When one of the chemistry :mod:`~qiskit.chemistry.drivers` is run and instance + of this class is returned. This contains various properties that are made available in + a consistent manner across the various drivers. + + Note that values here, for the same input molecule to each driver, may be vary across + the drivers underlying code implementation. Also some drivers may not provide certain fields + such as dipole integrals in the case of :class:`~qiskit.chemistry.drivers.PyQuanteDriver`. + + This class provides methods to save it and load it again from an HDF5 file + """ QMOLECULE_VERSION = 2 @@ -102,16 +114,16 @@ def __init__(self, filename=None): @property def one_body_integrals(self): - """ returns one body integrals """ + """ Returns one body electron integrals. """ return QMolecule.onee_to_spin(self.mo_onee_ints, self.mo_onee_ints_b) @property def two_body_integrals(self): - """ returns two body integrals """ + """ Returns two body electron integrals. """ return QMolecule.twoe_to_spin(self.mo_eri_ints, self.mo_eri_ints_bb, self.mo_eri_ints_ba) def has_dipole_integrals(self): - """ check if has dipole integrals """ + """ Check if dipole integrals are present. """ return self.x_dip_mo_ints is not None and \ self.y_dip_mo_ints is not None and \ self.z_dip_mo_ints is not None From 83c8a1bba5800279cae339930bd2408bbd21fdf3 Mon Sep 17 00:00:00 2001 From: woodsp Date: Fri, 17 Apr 2020 18:08:46 -0400 Subject: [PATCH 2/2] Add custom words for spell check --- .pylintdict | 7 +++++++ qiskit/chemistry/drivers/_basedriver.py | 2 +- qiskit/chemistry/fermionic_operator.py | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/.pylintdict b/.pylintdict index ac3af0de09..00e28bf697 100644 --- a/.pylintdict +++ b/.pylintdict @@ -217,6 +217,7 @@ ifortvars ign ignis ij +ijkl ijkm ikmj imag @@ -255,6 +256,7 @@ jt jth jw kaicher +kanav ket killoran kingma @@ -273,6 +275,7 @@ lih lijh lin linearpaulirotations +ljik lmin lnot loglikelihood @@ -377,6 +380,7 @@ outpath overfit params parentname +pascual pauli pauli's paulis @@ -481,6 +485,7 @@ sdg sdk seealso seeley +sergey setia sgn shanno @@ -507,6 +512,7 @@ subspaces succ sudo superclass +superfast suzuki svm sx @@ -590,6 +596,7 @@ xuxv xyz yao yc +yu yy zi zmatrix diff --git a/qiskit/chemistry/drivers/_basedriver.py b/qiskit/chemistry/drivers/_basedriver.py index a5a2c286d8..3e5b455376 100644 --- a/qiskit/chemistry/drivers/_basedriver.py +++ b/qiskit/chemistry/drivers/_basedriver.py @@ -2,7 +2,7 @@ # This code is part of Qiskit. # -# (C) Copyright IBM 2018, 2019. +# (C) Copyright IBM 2018, 2020. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory diff --git a/qiskit/chemistry/fermionic_operator.py b/qiskit/chemistry/fermionic_operator.py index c931d1414d..49122b750f 100644 --- a/qiskit/chemistry/fermionic_operator.py +++ b/qiskit/chemistry/fermionic_operator.py @@ -2,7 +2,7 @@ # This code is part of Qiskit. # -# (C) Copyright IBM 2018, 2019. +# (C) Copyright IBM 2018, 2020. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory