About cookies on this site Our websites require some cookies to function properly (required). In addition, other cookies may be used with your consent to analyze site usage, improve the user experience and for advertising. For more information, please review your options. By visiting our website, you agree to our processing of information as described in IBM’sprivacy statement. To provide a smooth navigation, your cookie preferences will be shared across the IBM web domains listed here.
LayerModel
class LayerModel(model_params)
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
and tenpy.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
calc_H_bond(tol_zero=1e-15)
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 of keep_only_odd
(see tenpy_layers
for more details).
Parameters
tol_zero (float) – the threshold for values considered to be zero.
Returns
The list of interaction Hamiltonians for all bonds.
Return type
from_quantum_circuit
classmethod from_quantum_circuit(circuit, *, scaling_factor=1.0, **kwargs)
Construct a LayerModel
from a QuantumCircuit
.
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
init_sites(model_params)
Initializes the sites of this Hamiltonian.
See init_sites()
for more details.
Caution
Currently, this enforces Sz
conservation on all sites.
Parameters
model_params (Config) – the model parameters.
Returns
The site to be used internally.
Return type
init_terms
init_terms(model_params)
Initializes the terms of this Hamiltonian.
See init_terms()
for more details.
Parameters
model_params (Config) – the model parameters.
Return type
None
Was this page helpful?
Report a bug or request content on GitHub.