LayerModel¶
- class LayerModel(model_params)[source]¶
Bases:
CouplingMPOModel,NearestNeighborModelA model for representing a layer of time-evolution interactions.
Essentially, this class is a simple wrapper of
tenpy.models.model.CouplingMPOModelandtenpy.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_layersfor more details).
- classmethod from_quantum_circuit(circuit, **kwargs)[source]¶
Construct a
LayerModelfrom aQuantumCircuit.You can see an example of this function in action in the docs of
tenpy_layers.Note
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 specifyingconserve="None". If that still does not work, converting your specificQuantumCircuitis 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(model_params)[source]¶
Initializes the sites of this Hamiltonian.
See
init_sites()for more details.
- 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