qiskit-documentation/docs/api/qiskit/0.26/qiskit.chemistry.BosonicOpe...

109 lines
6.3 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: BosonicOperator
description: API reference for qiskit.chemistry.BosonicOperator
in_page_toc_min_heading_level: 1
python_api_type: class
python_api_name: qiskit.chemistry.BosonicOperator
---
# qiskit.chemistry.BosonicOperator
<Class id="qiskit.chemistry.BosonicOperator" isDedicatedPage={true} github="https://github.com/qiskit-community/qiskit-aqua/tree/stable/0.9/qiskit/chemistry/bosonic_operator.py" signature="BosonicOperator(h, basis)" modifiers="class">
A set of functions to map bosonic Hamiltonians to qubit Hamiltonians.
References:
* *Veis Libor, et al., International Journal of Quantum Chemistry 116.18 (2016): 1328-1336.*
* *McArdle Sam, et al., Chemical science 10.22 (2019): 5725-5735.*
* *Ollitrault Pauline J., Chemical science 11 (2020): 6842-6855.*
The Bosonic operator in this class is written in the n-mode second quantization format (Eq. 10 in Ref. Ollitrault Pauline J., Chemical science 11 (2020): 6842-6855.) The second quantization operators act on a given modal in a given mode. self.\_degree is the truncation degree of the expansion (n).
**Parameters**
* **h** (`List`\[`List`\[`Tuple`\[`List`\[`List`\[`int`]], `float`]]]) Matrix elements for the n-body expansion. The format is as follows: h is a self.\_degree (n) dimensional array. For each degree n, h\[n] contains the list \[\[indices, coeff]\_0, \[indices, coeff]\_1, …] where the indices is a n-entry list and each entry is of the shape \[mode, modal1, modal2] which define the indices of the corresponding raising (mode, modal1) and lowering (mode, modal2) operators.
* **basis** (`List`\[`int`]) Is a list defining the number of modals per mode. E.g. for a 3 modes system with 4 modals per mode basis = \[4,4,4].
### \_\_init\_\_
<Function id="qiskit.chemistry.BosonicOperator.__init__" signature="__init__(h, basis)">
The Bosonic operator in this class is written in the n-mode second quantization format (Eq. 10 in Ref. Ollitrault Pauline J., Chemical science 11 (2020): 6842-6855.) The second quantization operators act on a given modal in a given mode. self.\_degree is the truncation degree of the expansion (n).
**Parameters**
* **h** (`List`\[`List`\[`Tuple`\[`List`\[`List`\[`int`]], `float`]]]) Matrix elements for the n-body expansion. The format is as follows: h is a self.\_degree (n) dimensional array. For each degree n, h\[n] contains the list \[\[indices, coeff]\_0, \[indices, coeff]\_1, …] where the indices is a n-entry list and each entry is of the shape \[mode, modal1, modal2] which define the indices of the corresponding raising (mode, modal1) and lowering (mode, modal2) operators.
* **basis** (`List`\[`int`]) Is a list defining the number of modals per mode. E.g. for a 3 modes system with 4 modals per mode basis = \[4,4,4].
</Function>
## Methods
| | |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------- |
| [`__init__`](#qiskit.chemistry.BosonicOperator.__init__ "qiskit.chemistry.BosonicOperator.__init__")(h, basis) | The Bosonic operator in this class is written in the n-mode second quantization format (Eq. |
| [`direct_mapping_filtering_criterion`](#qiskit.chemistry.BosonicOperator.direct_mapping_filtering_criterion "qiskit.chemistry.BosonicOperator.direct_mapping_filtering_criterion")(state, value) | Filters out the states of irrelevant symmetries |
| [`mapping`](#qiskit.chemistry.BosonicOperator.mapping "qiskit.chemistry.BosonicOperator.mapping")(\[qubit\_mapping, threshold]) | Maps a bosonic operator into a qubit operator. |
| [`number_occupied_modals_per_mode`](#qiskit.chemistry.BosonicOperator.number_occupied_modals_per_mode "qiskit.chemistry.BosonicOperator.number_occupied_modals_per_mode")(mode) | A bosonic operator which can be used to evaluate the number of occupied modals in a given mode |
### direct\_mapping\_filtering\_criterion
<Function id="qiskit.chemistry.BosonicOperator.direct_mapping_filtering_criterion" signature="direct_mapping_filtering_criterion(state, value, aux_values=None)">
Filters out the states of irrelevant symmetries
**Parameters**
* **state** (`Union`\[`List`, `ndarray`]) the statevector
* **value** (`float`) the energy
* **aux\_values** (`Optional`\[`List`\[`float`]]) the auxiliary energies
**Return type**
`bool`
**Returns**
True if the state is has one and only one modal occupied per mode meaning that the direct mapping symmetries are respected and False otherwise
</Function>
### mapping
<Function id="qiskit.chemistry.BosonicOperator.mapping" signature="mapping(qubit_mapping='direct', threshold=1e-08)">
Maps a bosonic operator into a qubit operator.
**Parameters**
* **qubit\_mapping** (`str`) a string giving the type of mapping (only the direct mapping is implemented at this point)
* **threshold** (`float`) threshold to chop the low contribution paulis
**Return type**
`WeightedPauliOperator`
**Returns**
A qubit operator
**Raises**
**ValueError** If requested mapping is not supported
</Function>
### number\_occupied\_modals\_per\_mode
<Function id="qiskit.chemistry.BosonicOperator.number_occupied_modals_per_mode" signature="number_occupied_modals_per_mode(mode)">
A bosonic operator which can be used to evaluate the number of occupied modals in a given mode
**Parameters**
**mode** (`int`) the index of the mode
**Returns**
the corresponding bosonic operator
**Return type**
[BosonicOperator](#qiskit.chemistry.BosonicOperator "qiskit.chemistry.BosonicOperator")
</Function>
</Class>