Skip to main content
IBM Quantum Platform

FermionicTrotterization

class FermionicTrotterization(synthesis, *, apply=True, filter=None)

Bases: GenericPass[DAGCircuit, DAGCircuit]

A transpilation pass Trotterizing Evolution gates in fermionic space.

An Evolution gate carries the synthesis method with which it gets decomposed in fermionic space (see Evolution.synthesis). Setting it per gate means threading the choice through everything that constructs one – including UCC and UCJ, which build their own internally. This pass applies one method to every Evolution in a circuit instead, so the choice can be made once for a whole transpilation pipeline:

pm.optimization = FermionicPassManager(
    [FermionicTrotterization(FermionicSuzukiTrotter(order=2, reps=4))]
)

Each selected gate is replaced by the factors its method emits, so the pass both chooses the formula and carries it out. Nodes that are not Evolution gates are left untouched, as are those rejected by an optional filter.

Note

Running the pass again is harmless: the factors a synthesis method emits are Evolution.atomic, and an atomic gate is a terminal factor which this pass leaves in place rather than splitting further. The same exemption makes the pass a fixed point over the output of QDriftTrotterization, whose sampled gates are atomic because the random draw is the Trotterization it performs.

Note

Set apply to False to only select the method and leave the expansion to something else, such as Qiskit’s Decompose or a decompose() call. Be aware that a gate which is never expanded reaches the fermion-to-qubit stage whole, where it is mapped without Evolution.synthesis ever being read – and every synthesis method then produces identical output.

Caution

Not every synthesis method suits every operator. An Evolution whose operator groups all mutually commute (the diagonal-Coulomb operators of a UCJ, for example) is synthesized exactly at any order, so a higher order only adds depth. Use filter to restrict the pass to the gates that benefit.

Expanding an operator that carries no groups splits it term by term, and a lone ai†aja^\dagger_i a_j is not Hermitian, so its exponential is not unitary. Nothing complains until the mapped operator reaches PauliEvolutionGate, which raises ValueError: Operator contains complex coefficients, which are not supported. Assigning conjugate-paired groups is what makes each factor Hermitian.

Initializing this transpiler pass can be done with the arguments listed below.

Parameters

  • synthesis (FermionicEvolutionSynthesis) – the fermion-to-fermion synthesis method to apply to the Evolution gates of the circuit.
  • apply (bool) – whether to expand each selected gate into the factors synthesis produces. When False, the gate is only tagged with synthesis and something else has to expand it later. See apply.
  • filter (Callable[[DAGOpNode], bool] | None) – an optional predicate deciding which Evolution nodes to apply synthesis to. It is called with the DAGOpNode and the node is left untouched unless it returns True. If None (the default), every Evolution node is selected.

Attributes

synthesis

The fermion-to-fermion synthesis method applied to the selected gates.

apply

Whether to expand each selected gate into the factors synthesis produces.

When this is False, the pass only selects the method: it tags each selected gate with synthesis and leaves the expansion to whatever builds the gate’s definition later, such as Qiskit’s Decompose or a decompose() call. Note that a gate which is never expanded reaches the fermion-to-qubit stage whole, where it is mapped without Evolution.synthesis ever being read, and every synthesis method then produces identical output.

filter

The predicate selecting which Evolution nodes to apply synthesis to.


Methods

run

run(dag)

Runs this transpilation pass.

Every Evolution node accepted by filter is replaced by the factors that synthesis produces, or (when apply is False) by an equivalent gate merely carrying synthesis. All other nodes are left untouched. The input DAG is modified in place.

Parameters

dag (DAGCircuit) – the input circuit with fermion-based instructions. Only DAGOpNode with FermionicGate instances as their op are supported.

Returns

The output circuit which is still acting on a fermionic register.

Return type

DAGCircuit

Inherited Methods

execute

execute(passmanager_ir, state, callback=None)

Execute optimization task for input Qiskit IR.

Parameters

  • passmanager_ir (IR) – Qiskit IR to optimize.
  • state (PassManagerState) – State associated with workflow execution by the pass manager itself.
  • callback (Callable[[Task, IR_OUT, PropertySet, float, int], None] | None) – A callback function which is called per execution of optimization task.

Returns

Optimized Qiskit IR and state of the workflow.

Return type

tuple[IR_OUT, PassManagerState]

name

name()

Name of the pass.

Return type

str

update_status

update_status(state, run_state)

Update workflow status.

Parameters

  • state (PassManagerState) – Pass manager state to update.
  • run_state (RunState) – Completion status of current task.

Returns

Updated pass manager state.

Return type

PassManagerState

Was this page helpful?
Report a bug, typo, or request content on GitHub.