Examples

In the following we give a minimal example for extracting the noisy algorithm model that implements one Trotter step for the time propagation under a Hamiltonian \[H=\sigma_x,\] where the time propagation is implemented by a sequence of three unitary gates: a Hadamard followed by a Z-rotation followed by another Hadamard.

from noise_mapper_py import noisy_algorithm_model
from qoqo import Circuit
from qoqo import operations as ops
from struqture_py import spins

circuit = Circuit()
# To be able to construct the noisy alqorithm model
# the parts to the circuit simulation the
circuit += ops.PragmaStartDecompositionBlock([0], {})
circuit += ops.Hadamard(0)
circuit += ops.PragmaDamping(0, 1e-3, 1e-3)
circuit += ops.RotateZ(0, 0.01)
circuit += ops.PragmaDamping(0, 1e-3, 1e-3)
circuit += ops.Hadamard(0)
circuit += ops.PragmaDamping(0, 1e-3, 1e-3)
circuit += ops.PragmaStopDecompositionBlock([0])

system = spins.SpinHamiltonianSystem(1)
system.set(spins.PauliProduct().x(0), 2)
open_system = noisy_algorithm_model(circuit, system, 0.01)

print(open_system)