OpStrings

TenNetLib.jl provides an alternative, called OpStrings, to ITensors.jl's OpSum to automatically construct Hamiltonains / operators. TenNetLib.jl's own CouplingModel is built from OpStrings and is not compatible with OpSum.

OpString

OpStrings is basically a vector of OpString objects (notice the difference in 's' at the end)

TenNetLib.OpStringType
struct OpString{T <: Number}
    coeff::T
    ops::Vector{Pair{String, Int}}
end

Holds operator strings (operator names with corresponding positions) along with the coefficient.

  • coeff::T: Coeffcient of the operator string.
  • ops::Vector{Pair{String, Int}}: String of operator names along with the positions.
source
TenNetLib.minsiteMethod
function minsite(opstr::OpString)

Returns the lowest site position in the operator string of the OpString.

source
TenNetLib.maxsiteMethod
function maxsite(opstr::OpString)

Returns the highest site position in the operator string of the OpString.

source
TenNetLib.removeIdsMethod
function removeIds(opstr::OpString{T}) where {T <: Number}

Returns an OpString with all "Id" operators removed from the original.

source
TenNetLib.bosonizeMethod
function bosonize(opstr::OpString{T1},
                  sites::Vector{Index{T2}}) where {T1 <: Number, T2}

Returns an OpString after "bosonizing" the original with Jordan-Wigner strings as needed. See bosonize.

source

OpStrings

TenNetLib.OpStringsType
const OpStrings{T} = Vector{OpString{T}}

Collection of OpStrings.

Syntax:

os = OpStrings()
os += 1, "Sx" => i, "Sx" => j, "Sx" => k, ....
os += "Sx" => i, "Sx" => j, "Sx" => k, ....

Example:

os = OpStrings()    
for j=1:N-1
    os += 1, "Sz" => j, "Sz" => j+1
    os += 0.5, "S+" => j, "S-" => j+1
    os += 0.5, "S-" => j, "S+" => j+1
end
source
TenNetLib.removeIdsZerosMethod
function removeIdsZeros(os::OpStrings{T}) where {T <: Number}

Returns an OpStrings with all "Id" operators removed from the original, as well as any OpString term that has coeff less than Float64_threshold().

source
TenNetLib.bosonizeMethod
function bosonize(os::OpStrings{T1}, sites::Vector{Index{T2}}) where {T1 <: Number, T2}

Returns an OpStrings after "bosonizing" the original with Jordan-Wigner strings as needed. See bosonize.

source
TenNetLib.mergetermsMethod
function mergeterms(os::OpStrings{T}) where T <: Number

Returns an OpStrings where OpString elements with exactly same operator strings has been merged by adding the coefficients.

source

MPO from OpStrings

ITensors.MPOMethod
function ITensors.MPO(os::OpStrings{T1},
                      sites::Vector{Index{T2}};
                      maxdim::Int = typemax(Int),
                      mindim::Int = 1,
                      cutoff::Float64 = Float64_threashold(),
                      svd_alg::String = "divide_and_conquer",
                      chunksize::Int = 12) where {T1 <: Number, T2}

Creates MPO from os::OpStrings. The present version uses recursive SVDs to create the MPO. Very inefficient when number of Hamiltonian terms is large. Future updates will solve the problem.

Named arguments and their default values:

  • maxdim::Int = typemax(Int): Maximum MPO bond dimension after SVD truncation.
  • mindim::Int = 1: Minimum MPO bond dimension after SVD truncation.
  • cutoff::Float64 = Float64_threshold(): Cutoff for SVD truncation.
  • svd_alg::String = "divide_and_conquer".
  • chunksize::Int = 12. Maximum size of the chunks on which recursive SVDs are performed.
source