---
title: CustomF2QLayout (latest version)
description: API reference for qiskit_fermions.transpiler.passes.CustomF2QLayout in the latest version of qiskit-fermions
source: https://quantum.cloud.ibm.com/docs/en/api/qiskit-fermions/transpiler-passes-custom-f-2-q-layout
---

# CustomF2QLayout

*class* `CustomF2QLayout(layout)`

Bases: [`GenericPass`](/docs/api/qiskit/qiskit.passmanager.GenericPass)\[[`DAGCircuit`](/docs/api/qiskit/qiskit.dagcircuit.DAGCircuit), [`DAGCircuit`](/docs/api/qiskit/qiskit.dagcircuit.DAGCircuit)]

Sets the user-provided [`F2QLayout`](/docs/api/qiskit-fermions/transpiler-f-2-q-layout "qiskit_fermions.transpiler.F2QLayout") in the transpiler.

This pass simply populates the `f2q_layout` field of the [`property_set`](/docs/api/qiskit/qiskit.passmanager.PassManagerState#property_set), with the value of [`layout`](#qiskit_fermions.transpiler.passes.CustomF2QLayout.layout "qiskit_fermions.transpiler.passes.CustomF2QLayout.layout").

> **Note**
>
> It is the user’s responsibility to ensure that subsequently used transpilation passes (and plugins) are configured to adhere to this [`F2QLayout`](/docs/api/qiskit-fermions/transpiler-f-2-q-layout "qiskit_fermions.transpiler.F2QLayout") correctly.

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

**Parameters**

**layout** ([*F2QLayout*](/docs/api/qiskit-fermions/transpiler-f-2-q-layout "qiskit_fermions.transpiler.F2QLayout")) – the custom `f2q_layout` to use.

## Attributes

### layout

Type: [`F2QLayout`](/docs/api/qiskit-fermions/transpiler-f-2-q-layout "qiskit_fermions.transpiler.F2QLayout")

The user-provided mapping of [`FermionicRegister`](/docs/api/qiskit-fermions/circuit-fermionic-register "qiskit_fermions.circuit.FermionicRegister") to [`QuantumRegister`](/docs/api/qiskit/circuit#qiskit.circuit.QuantumRegister).

## Methods

### run

`run(dag)`

Runs this analysis pass.

**Parameters**

**dag** ([*DAGCircuit*](/docs/api/qiskit/qiskit.dagcircuit.DAGCircuit)) – the DAG circuit representation of a [`FermionicCircuit`](/docs/api/qiskit-fermions/circuit-fermionic-circuit "qiskit_fermions.circuit.FermionicCircuit").

**Returns**

The unchanged input. But the `property_set` of this transpilation pipeline will be updated.

**Return type**

[*DAGCircuit*](/docs/api/qiskit/qiskit.dagcircuit.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*](/docs/api/qiskit/qiskit.passmanager.PassManagerState)) – State associated with workflow execution by the pass manager itself.
- **callback** ([*Callable*](https://docs.python.org/3/library/collections.abc.html#collections.abc.Callable)*\[\[*[*Task*](/docs/api/qiskit/qiskit.passmanager.Task)*, IR\_OUT,* [*PropertySet*](/docs/api/qiskit/qiskit.passmanager.PropertySet)*,* [*float*](https://docs.python.org/3/library/functions.html#float)*,* [*int*](https://docs.python.org/3/library/functions.html#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](https://docs.python.org/3/library/stdtypes.html#tuple)\[*IR\_OUT*, [*PassManagerState*](/docs/api/qiskit/qiskit.passmanager.PassManagerState)]

### name

`name()`

Name of the pass.

**Return type**

[str](https://docs.python.org/3/library/stdtypes.html#str)

### update\_status

`update_status(state, run_state)`

Update workflow status.

**Parameters**

- **state** ([*PassManagerState*](/docs/api/qiskit/qiskit.passmanager.PassManagerState)) – Pass manager state to update.
- **run\_state** (*RunState*) – Completion status of current task.

**Returns**

Updated pass manager state.

**Return type**

[*PassManagerState*](/docs/api/qiskit/qiskit.passmanager.PassManagerState)
