hamiltonian_utils
workbench_algorithms.utils.hamiltonian_utils ¶
.. Copyright © 2024-2026 PsiQuantum Corp. All rights reserved. PSIQUANTUM CORP. CONFIDENTIAL This file includes unpublished proprietary source code of PsiQuantum Corp. The copyright notice above does not evidence any actual or intended publication of such source code. Disclosure of this source code or any related proprietary information is strictly prohibited without the express written permission of PsiQuantum Corp.
Utility functions for block encodings.
get_exactly_representable_qubitized_hamiltonian ¶
Returns a Hamiltonian where \(\arccos(\lambda)\) is exactly representable with bits_of_precision bits.
Note
Only the first excited state of this hamiltonian is guaranteed to be an energy that corresponds to a phase
that is exactly representable using the input bits_of_precision.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
alpha
|
float
|
Arbitrary coefficient which determines the specific type of Hamiltonian. |
required |
bits_of_precision
|
int
|
Number of bits the phase is to be measured to. Must be greater than 2. |
required |
Returns:
| Type | Description |
|---|---|
Tuple[PauliSum, float]
|
containing the Hamiltonian and the eigenvalue. |
generate_h2_hamiltonian ¶
Generate the hydrogen Haimltonian given a bond length.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
bond_length
|
float
|
One of |
required |
Returns:
| Type | Description |
|---|---|
PauliSum
|
H2 Hamiltonian. |
fetch_h2_gs_data ¶
Returns ground state energy and wavefunction for checking.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
bond_length
|
float
|
H-H bond length, in Angstroms. |
required |
Returns:
| Type | Description |
|---|---|
g_energy (float
|
Ground state energy. |
g_state (list
|
Ground state wavefunction. |
fetch_h2_gs_prep_angle ¶
Returns ground state preparation circuit parameter.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
bond_length
|
float
|
H-H bond length, in Angstroms. |
required |
Returns:
| Type | Description |
|---|---|
angle (float
|
Ground state preparation circuit parameter. |
h2_ground_state_prep ¶
Circuit for ground state preparation for H2.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
qc
|
QPU
|
QPU |
required |
sys_reg
|
Qubits
|
System register to implement state preparation. |
required |
ansatz_param
|
float
|
Ground state prep circuit parameter (in Radians). |
required |
Notes
- See Fig. 1 of arxiv:1512.06860.