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

99 lines
3.8 KiB
Plaintext
Raw Permalink Blame History

This file contains ambiguous Unicode characters

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 (v0.29)
description: API reference for qiskit.chemistry.BosonicOperator in qiskit v0.29
in_page_toc_min_heading_level: 1
python_api_type: class
python_api_name: qiskit.chemistry.BosonicOperator
---
# 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">
Bases: `object`
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].
## Methods
<span id="qiskit-chemistry-bosonicoperator-direct-mapping-filtering-criterion" />
### direct\_mapping\_filtering\_criterion
<Function id="qiskit.chemistry.BosonicOperator.direct_mapping_filtering_criterion" signature="BosonicOperator.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>
<span id="qiskit-chemistry-bosonicoperator-mapping" />
### mapping
<Function id="qiskit.chemistry.BosonicOperator.mapping" signature="BosonicOperator.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>
<span id="qiskit-chemistry-bosonicoperator-number-occupied-modals-per-mode" />
### number\_occupied\_modals\_per\_mode
<Function id="qiskit.chemistry.BosonicOperator.number_occupied_modals_per_mode" signature="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
**Parameters**
**mode** (`int`) the index of the mode
**Returns**
the corresponding bosonic operator
**Return type**
[BosonicOperator](qiskit.chemistry.BosonicOperator "qiskit.chemistry.BosonicOperator")
</Function>
</Class>