The @mpoham
macro
When dealing with (quasi-) one-dimensional systems that are defined by a sum of local operators, a convenient representation exists in terms of a sparse matrix product operator with an upper diagonal structure (MPOHamiltonian
). The generation of such an object starting from a sum of local operators is facilitated by the macro @mpoham
, which provides several syntactic sugar features.
MPSKitModels.@mpoham
— Macro@mpoham(block)
Specify a Matrix Product Operator that is represented by a sum of local operators.
This macro converts expressions of the form O{i...}
to an operator acting on sites i...
where O
is an operator, and i
can be an integer or a lattice point. The macro recognizes expressions of the following forms:
O{i...}
to indicate local operatorsO
acting on sitesi...
-Inf:Inf
,-∞:∞
,-Inf:step:Inf
,-∞:step:∞
to indicate infinite chains.1:L
to indicate finite chains.∑
to represent sums.
Examples
H_ising = @mpoham sum(σᶻᶻ{i, i+1} + h * σˣ{i} for i in -Inf:Inf)
H_heisenberg = @mpoham ∑(sigma_exchange(){i,j} for (i,j) in nearest_neighbours(-∞:∞))