---
title: LayerwiseEvolver (latest version)
description: API reference for qiskit_addon_mpf.backends.tenpy_layers.LayerwiseEvolver in the latest version of qiskit-addon-mpf
source: https://eu-de.quantum.cloud.ibm.com/docs/en/api/qiskit-addon-mpf/backends-tenpy-layers-layerwise-evolver
---

# LayerwiseEvolver

*class* `LayerwiseEvolver(evolution_state, layers, *args, **kwargs)`

[GitHub](https://github.com/Qiskit/qiskit-addon-mpf/tree/stable/0.3/qiskit_addon_mpf/backends/tenpy_layers/evolver.py#L23-L179)

Bases: [`TEBDEvolver`](/docs/api/qiskit-addon-mpf/backends-tenpy-tebd-tebd-evolver "qiskit_addon_mpf.backends.tenpy_tebd.evolver.TEBDEvolver")

A special case of the [`TEBDEvolver`](/docs/api/qiskit-addon-mpf/backends-tenpy-tebd-tebd-evolver "qiskit_addon_mpf.backends.tenpy_tebd.TEBDEvolver") based on layer-wise evolution models.

As also explained in [`tenpy_layers`](/docs/api/qiskit-addon-mpf/backends-tenpy-layers#module-qiskit_addon_mpf.backends.tenpy_layers "qiskit_addon_mpf.backends.tenpy_layers"), this implementation extracts the alternating even/odd bond updates implemented inside of the original [`TEBDEngine`](https://tenpy.readthedocs.io/en/latest/reference/tenpy.algorithms.tebd.TEBDEngine.html#tenpy.algorithms.tebd.TEBDEngine "(in TeNPy v1.0.5)") to become the end users responsibility. It does so, by replacing the single Hamiltonian provided to the [`TEBDEvolver`](/docs/api/qiskit-addon-mpf/backends-tenpy-tebd-tebd-evolver "qiskit_addon_mpf.backends.tenpy_tebd.TEBDEvolver") instance with a sequence of [`LayerModel`](/docs/api/qiskit-addon-mpf/backends-tenpy-layers-layer-model "qiskit_addon_mpf.backends.tenpy_layers.LayerModel") instances. Every single instance of these encodes a single **layer** of interactions. These should enforce the alternating updates of even and odd bonds of the underlying tensor network.

The motivation for this more complicated interface is that is provides a lot more flexbility and enables users to define custom Trotter product formulas rather than being limited to the ones implemented by TeNPy directly.

Initialize a [`LayerwiseEvolver`](#qiskit_addon_mpf.backends.tenpy_layers.LayerwiseEvolver "qiskit_addon_mpf.backends.tenpy_layers.LayerwiseEvolver") instance.

**Parameters**

- **evolution\_state** ([*tenpy\_tebd.MPOState*](/docs/api/qiskit-addon-mpf/backends-tenpy-tebd-mpo-state "qiskit_addon_mpf.backends.tenpy_tebd.MPOState")) – forwarded to [`TEBDEvolver`](/docs/api/qiskit-addon-mpf/backends-tenpy-tebd-tebd-evolver "qiskit_addon_mpf.backends.tenpy_tebd.TEBDEvolver"). Please refer to its documentation for more details.
- **layers** ([*list*](https://docs.python.org/3/library/stdtypes.html#list)*\[*[*LayerModel*](/docs/api/qiskit-addon-mpf/backends-tenpy-layers-layer-model "qiskit_addon_mpf.backends.tenpy_layers.LayerModel")*]*) – the list of models describing single layers of interactions. See above as well as the explanations provided in [`tenpy_layers`](/docs/api/qiskit-addon-mpf/backends-tenpy-layers#module-qiskit_addon_mpf.backends.tenpy_layers "qiskit_addon_mpf.backends.tenpy_layers").
- **args** – any further positional arguments will be forwarded to the [`TEBDEvolver`](/docs/api/qiskit-addon-mpf/backends-tenpy-tebd-tebd-evolver "qiskit_addon_mpf.backends.tenpy_tebd.TEBDEvolver") constructor.
- **kwargs** – any further keyword arguments will be forwarded to the [`TEBDEvolver`](/docs/api/qiskit-addon-mpf/backends-tenpy-tebd-tebd-evolver "qiskit_addon_mpf.backends.tenpy_tebd.TEBDEvolver") constructor.

## Attributes

### layers

The layers of interactions used to implement the time-evolution.

### dt

The time step to be used by this time-evolution instance.

## Methods

### calc\_U

`calc_U(order, delta_t, type_evo='real', E_offset=None)`

[GitHub](https://github.com/Qiskit/qiskit-addon-mpf/tree/stable/0.3/qiskit_addon_mpf/backends/tenpy_layers/evolver.py#L144-L179)

Calculates the local bond updates.

This adapts [`calc_U()`](https://tenpy.readthedocs.io/en/latest/reference/tenpy.algorithms.tebd.TEBDEngine.html#tenpy.algorithms.tebd.TEBDEngine.calc_U "(in TeNPy v1.0.5)") to work with the layer-wise implementation.

**Parameters**

- **order** ([*int*](https://docs.python.org/3/library/functions.html#int)) – this is being ignored.
- **delta\_t** ([*float*](https://docs.python.org/3/library/functions.html#float)) – the time-step to use.
- **type\_evo** ([*str*](https://docs.python.org/3/library/stdtypes.html#str)) – the type of time-evolution. Imaginary time-evolution is not supported at this time.
- **E\_offset** ([*list*](https://docs.python.org/3/library/stdtypes.html#list)*\[*[*float*](https://docs.python.org/3/library/functions.html#float)*] | None*) – a constant energy offset to be applied.

**Return type**

None

### evolve

`evolve(N_steps, dt)`

[GitHub](https://github.com/Qiskit/qiskit-addon-mpf/tree/stable/0.3/qiskit_addon_mpf/backends/tenpy_layers/evolver.py#L62-L104)

Perform a single time step of TEBD.

**Parameters**

- **N\_steps** ([*int*](https://docs.python.org/3/library/functions.html#int)) – should always be `1` for this time-evolver, otherwise an error will be raised (see below).
- **dt** ([*float*](https://docs.python.org/3/library/functions.html#float)) – the time-step to use.

**Returns**

The truncation error.

**Raises**

[**RuntimeError**](https://docs.python.org/3/library/exceptions.html#RuntimeError) – if `N_steps` is not equal to `1`.

**Return type**

[*TruncationError*](https://tenpy.readthedocs.io/en/latest/reference/tenpy.linalg.truncation.TruncationError.html#tenpy.linalg.truncation.TruncationError "(in TeNPy v1.0.5)")

### suzuki\_trotter\_decomposition

*static* `suzuki_trotter_decomposition(order, N_steps)`

[GitHub](https://github.com/Qiskit/qiskit-addon-mpf/tree/stable/0.3/qiskit_addon_mpf/backends/tenpy_layers/evolver.py#L123-L142)

Returns an empty list.

> **Note**
>
> This method is undefined for this subclass but we cannot raise an error upon calling it because of the internal algorithm flow. Instead, the Trotter decomposition in this class is encoded directly into the [`layers`](#qiskit_addon_mpf.backends.tenpy_layers.LayerwiseEvolver.layers "qiskit_addon_mpf.backends.tenpy_layers.LayerwiseEvolver.layers").

**Parameters**

- **order** ([*int*](https://docs.python.org/3/library/functions.html#int)) – is being ignored.
- **N\_steps** ([*int*](https://docs.python.org/3/library/functions.html#int)) – is being ignored.

**Returns**

An empty list.

**Return type**

[list](https://docs.python.org/3/library/stdtypes.html#list)\[[tuple](https://docs.python.org/3/library/stdtypes.html#tuple)\[[int](https://docs.python.org/3/library/functions.html#int), [int](https://docs.python.org/3/library/functions.html#int)]]

### suzuki\_trotter\_time\_steps

*static* `suzuki_trotter_time_steps(order)`

[GitHub](https://github.com/Qiskit/qiskit-addon-mpf/tree/stable/0.3/qiskit_addon_mpf/backends/tenpy_layers/evolver.py#L106-L121)

Returns an empty list.

> **Note**
>
> This method is undefined for this subclass but we cannot raise an error upon calling it because of the internal algorithm flow. Instead, the Trotter decomposition in this class is encoded directly into the [`layers`](#qiskit_addon_mpf.backends.tenpy_layers.LayerwiseEvolver.layers "qiskit_addon_mpf.backends.tenpy_layers.LayerwiseEvolver.layers").

**Parameters**

**order** ([*int*](https://docs.python.org/3/library/functions.html#int)) – is being ignored.

**Returns**

An empty list.

**Return type**

[list](https://docs.python.org/3/library/stdtypes.html#list)\[[float](https://docs.python.org/3/library/functions.html#float)]
