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, **kwargs)
Construct a LayerModel from a QuantumCircuit.
You can see an example of this function in action in the docs of tenpy_layers.
By default, TeNPy tries to enforce spin-conservation and, thus, some operations may not be available. If you encounter an error stating that some operator (e.g. Sx) is not available, try specifying conserve="None". If that still does not work, converting your specific QuantumCircuit is currently not possible using this implementation.
Parameters
- circuit (QuantumCircuit) – the quantum circuit to parse.
- kwargs – any additional keyword arguments to pass to the
LayerModelconstructor.
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.
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