LayerModel¶
- class LayerModel(model_params)[source]¶
Bases:
CouplingMPOModel
,NearestNeighborModel
A model for representing a layer of time-evolution interactions.
Essentially, this class is a simple wrapper of
tenpy.models.model.CouplingMPOModel
andtenpy.models.model.NearestNeighborModel
. Its main purpose is to provide a simple interface for constructing a TeNPy-compatible Hamiltonian from Qiskit objects.Methods
- calc_H_bond(tol_zero=1e-15)[source]¶
Calculate the interaction Hamiltonian based on the coupling and onsite terms.
Essentially, this class overwrites
calc_H_bond()
and takes care of removing even or odd bond interaction Hamiltonians depending on the value ofkeep_only_odd
(seetenpy_layers
for more details).
- classmethod from_quantum_circuit(circuit, *, scaling_factor=1.0, **kwargs)[source]¶
Construct a
LayerModel
from aQuantumCircuit
.You can see an example of this function in action in the docs of
tenpy_layers
.- Parameters:
circuit (QuantumCircuit) – the quantum circuit to parse.
scaling_factor (float) – a factor with which to scale the term strengths. This can be used to apply (for example) a time step scaling factor. It may also be used (e.g.) to split onsite terms into two layers (even and odd) with $0.5$ of the strength, each.
kwargs – any additional keyword arguments to pass to the
LayerModel
constructor.
- Returns:
A new LayerModel instance.
- Raises:
NotImplementedError – if an unsupported quantum gate is encountered.
- Return type:
- init_sites(model_params)[source]¶
Initializes the sites of this Hamiltonian.
See
init_sites()
for more details.Caution
Currently, this enforces
Sz
conservation on all sites.
- init_terms(model_params)[source]¶
Initializes the terms of this Hamiltonian.
See
init_terms()
for more details.- Parameters:
model_params (Config) – the model parameters.
- Return type:
None