Model 1D
Contents
1. Model 1D#
The base class for generating an 1-dimensional model where its Hamiltonian can be expressed in Matrix Product Operator (MPO).
|
1.2. Customize the model#
Apart from the built-in models,
it’s possible customize the model by implementing tnpy.model.Model1D._elem()
,
which accepts site (int) as input, and is expected to return a numpy.ndarray
.
import numpy as np
from tnpy.operators import SpinOperators
from tnpy.model import Model1D
class XXZ(Model1D):
def __init__(self, n: int, delta: float):
self.delta = delta
super().__init__(n)
def _elem(self, site: int) -> np.ndarray:
Sp, Sm, Sz, I2, O2 = SpinOperators()
return np.array(
[[I2, -0.5 * Sp, -0.5 * Sm, -self.delta * Sz, O2],
[O2, O2, O2, O2, Sm],
[O2, O2, O2, O2, Sp],
[O2, O2, O2, O2, Sz],
[O2, O2, O2, O2, I2]]
)
One can then access the MPO operator by calling tnpy.model.Model1D.mpo
,
which returns a tnpy.operators.MatrixProductOperator
object.
model = XXZ(n=10, delta=0.5)
mpo = model.mpo