qiskit-documentation/docs/api/qiskit/0.24/qiskit.chemistry.core.Hamil...

99 lines
7.8 KiB
Plaintext
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
title: Hamiltonian
description: API reference for qiskit.chemistry.core.Hamiltonian
in_page_toc_min_heading_level: 1
python_api_type: class
python_api_name: qiskit.chemistry.core.Hamiltonian
---
<span id="qiskit-chemistry-core-hamiltonian" />
# qiskit.chemistry.core.Hamiltonian
<Class id="qiskit.chemistry.core.Hamiltonian" isDedicatedPage={true} github="https://github.com/qiskit-community/qiskit-aqua/tree/stable/0.8/qiskit/chemistry/core/hamiltonian.py" signature="Hamiltonian(transformation=<TransformationType.FULL: 'full'>, qubit_mapping=<QubitMappingType.PARITY: 'parity'>, two_qubit_reduction=True, freeze_core=False, orbital_reduction=None, z2symmetry_reduction=None)" modifiers="class">
A molecular Hamiltonian operator, representing the energy of the electrons and nuclei in a molecule.
**Parameters**
* **transformation** (`TransformationType`) full or particle\_hole
* **qubit\_mapping** (`QubitMappingType`) jordan\_wigner, parity or bravyi\_kitaev
* **two\_qubit\_reduction** (`bool`) Whether two qubit reduction should be used, when parity mapping only
* **freeze\_core** (`bool`) Whether to freeze core orbitals when possible
* **orbital\_reduction** (`Optional`\[`List`\[`int`]]) Orbital list to be frozen or removed
* **z2symmetry\_reduction** (`Union`\[`str`, `List`\[`int`], `None`]) If z2 symmetry reduction should be applied to resulting qubit operators that are computed. For each symmetry detected the operator will be split in two where each requires one qubit less for computation. So for example 3 symmetries will split in the original operator into 8 new operators each requiring 3 less qubits. Now only one of these operators will have the ground state and be the correct symmetry sector needed for the ground state. Setting auto will use an automatic computation of the correct sector. If from other experiments, with the z2symmetry logic, the sector is known, then the tapering values of that sector can be provided (a list of int of values -1, and 1). The default is None meaning no symmetry reduction is done. Note that dipole and other operators such as spin, num particles etc are also symmetry reduced according to the symmetries found in the main operator if this operator commutes with the main operator symmetry. If it does not then the operator will be discarded since no meaningful measurement can take place.
**Raises**
[**QiskitChemistryError**](qiskit.chemistry.QiskitChemistryError "qiskit.chemistry.QiskitChemistryError") Invalid symmetry reduction
### \_\_init\_\_
<Function id="qiskit.chemistry.core.Hamiltonian.__init__" signature="__init__(transformation=<TransformationType.FULL: 'full'>, qubit_mapping=<QubitMappingType.PARITY: 'parity'>, two_qubit_reduction=True, freeze_core=False, orbital_reduction=None, z2symmetry_reduction=None)">
**Parameters**
* **transformation** (`TransformationType`) full or particle\_hole
* **qubit\_mapping** (`QubitMappingType`) jordan\_wigner, parity or bravyi\_kitaev
* **two\_qubit\_reduction** (`bool`) Whether two qubit reduction should be used, when parity mapping only
* **freeze\_core** (`bool`) Whether to freeze core orbitals when possible
* **orbital\_reduction** (`Optional`\[`List`\[`int`]]) Orbital list to be frozen or removed
* **z2symmetry\_reduction** (`Union`\[`str`, `List`\[`int`], `None`]) If z2 symmetry reduction should be applied to resulting qubit operators that are computed. For each symmetry detected the operator will be split in two where each requires one qubit less for computation. So for example 3 symmetries will split in the original operator into 8 new operators each requiring 3 less qubits. Now only one of these operators will have the ground state and be the correct symmetry sector needed for the ground state. Setting auto will use an automatic computation of the correct sector. If from other experiments, with the z2symmetry logic, the sector is known, then the tapering values of that sector can be provided (a list of int of values -1, and 1). The default is None meaning no symmetry reduction is done. Note that dipole and other operators such as spin, num particles etc are also symmetry reduced according to the symmetries found in the main operator if this operator commutes with the main operator symmetry. If it does not then the operator will be discarded since no meaningful measurement can take place.
**Raises**
[**QiskitChemistryError**](qiskit.chemistry.QiskitChemistryError "qiskit.chemistry.QiskitChemistryError") Invalid symmetry reduction
</Function>
## Methods
| | |
| -------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------- |
| [`__init__`](#qiskit.chemistry.core.Hamiltonian.__init__ "qiskit.chemistry.core.Hamiltonian.__init__")(\[transformation, qubit\_mapping, …]) | **type transformation**`TransformationType` |
| [`process_algorithm_result`](#qiskit.chemistry.core.Hamiltonian.process_algorithm_result "qiskit.chemistry.core.Hamiltonian.process_algorithm_result")(algo\_result) | Takes the algorithm result and processes it as required, e.g. |
| [`run`](#qiskit.chemistry.core.Hamiltonian.run "qiskit.chemistry.core.Hamiltonian.run")(qmolecule) | run method |
## Attributes
| | |
| --------------------------------------------------------------------------------------------------------------------- | --------------------- |
| `INFO_NUM_ORBITALS` | |
| `INFO_NUM_PARTICLES` | |
| `INFO_TWO_QUBIT_REDUCTION` | |
| `INFO_Z2SYMMETRIES` | |
| [`molecule_info`](#qiskit.chemistry.core.Hamiltonian.molecule_info "qiskit.chemistry.core.Hamiltonian.molecule_info") | returns molecule info |
### molecule\_info
<Attribute id="qiskit.chemistry.core.Hamiltonian.molecule_info">
returns molecule info
</Attribute>
### process\_algorithm\_result
<Function id="qiskit.chemistry.core.Hamiltonian.process_algorithm_result" signature="process_algorithm_result(algo_result)">
Takes the algorithm result and processes it as required, e.g. by combination of any parts that were classically computed, for the final result.
**Parameters**
**algo\_result** (`Union`\[`dict`, `MinimumEigensolverResult`, `EigensolverResult`]) Result from algorithm
**Return type**
`Union`\[`Tuple`\[`List`\[`str`], `dict`], `MolecularGroundStateResult`, `MolecularExcitedStatesResult`]
**Returns**
Final chemistry result computed from the algorithm result
</Function>
### run
<Function id="qiskit.chemistry.core.Hamiltonian.run" signature="run(qmolecule)">
run method
**Return type**
`Tuple`\[`WeightedPauliOperator`, `List`\[`WeightedPauliOperator`]]
</Function>
</Class>