qdk_chemistry.utils.time_evolution module

Utility helpers for constructing controlled time-evolution circuits.

class qdk_chemistry.utils.time_evolution.PauliEvolutionTerm(pauli_map, coefficient)[source]

Bases: object

Container for a Pauli string and its real coefficient.

Parameters:
pauli_map: dict[int, str]
coefficient: float
__init__(pauli_map, coefficient)
Parameters:
Return type:

None

qdk_chemistry.utils.time_evolution.append_controlled_time_evolution(circuit, control_qubit, system_qubits, terms, *, time, power=1)[source]

Append the controlled unitary (exp(-i H time))**power.

Return type:

None

Parameters:
  • circuit (QuantumCircuit) – Circuit being extended.

  • control_qubit (Qubit | int) – Index of the single ancilla control qubit.

  • system_qubits (Sequence[Qubit | int]) – Ordered system qubits targeted by the evolution.

  • terms (Iterable[PauliEvolutionTerm]) – Iterable of Pauli decomposition entries for the Hamiltonian.

  • time (float) – Evolution time t for a single application of U.

  • power (int) – Number of repeated applications (U raised to power).

Raises:

ValueError – If power is less than 1.

qdk_chemistry.utils.time_evolution.controlled_pauli_rotation(circuit, control_qubit, system_qubits, term, *, angle)[source]

Append a controlled exp(-i angle * P) to circuit.

Return type:

QuantumCircuit

Parameters:
  • circuit (QuantumCircuit) – Quantum circuit receiving the controlled rotation.

  • control_qubit (Qubit | int) – Index of the ancilla qubit providing the control.

  • system_qubits (Sequence[Qubit | int]) – Ordered collection of system qubit indices.

  • term (PauliEvolutionTerm) – Pauli term describing the rotation axis.

  • angle (float) – Rotation angle before the factor of two applied by CRZ.

Returns:

The quantum circuit with the controlled rotation appended.

qdk_chemistry.utils.time_evolution.extract_terms_from_hamiltonian(hamiltonian)[source]

Compute the cached Pauli decomposition for a qdk_chemistry.data.QubitHamiltonian.

Return type:

list[PauliEvolutionTerm]

Parameters:

hamiltonian (QubitHamiltonian) – Hamiltonian whose Pauli terms are required.

Returns:

List of PauliEvolutionTerm entries representing the Hamiltonian.

qdk_chemistry.utils.time_evolution.pauli_evolution_terms(pauli_op, *, atol=1e-12)[source]

Convert a SparsePauliOp into rotation data for time evolution.

Return type:

list[PauliEvolutionTerm]

Parameters:
  • pauli_op (SparsePauliOp) – Operator to decompose.

  • atol (float) –

    Absolute tolerance used to discard negligible coefficients

    and to detect unwanted imaginary components.

Returns:

Ordered list of PauliEvolutionTerm entries describing each non-identity component of pauli_op.

Raises:

ValueError – If a coefficient has an imaginary part whose magnitude exceeds atol.