Condensed Matter with Sum-of-Squares
CondensedMatterSOS.@spin — Macro@spin(σ[1:N1, 1:N2, ...], ...)Return a tuple of 3-tuples σ = (σx, σy, σz) where the three elements of this tuple are arrays of size (N1, N2, ...). Moreover, the product σ[i][I...] * σ[j][J...]
- commutes if
I != J, - if
I == J, it- commutes if
i == j, moreover it satisfies the identity:σx[I...] * σx[I...] == σy[I...] * σy[I...] == σz[I...] * σz[I...] = 1. - anticommutes if
i != j, moreover it satisifes the identities:σx * σy == -σy * σx == im * σz;σy * σz == -σz * σy == im * σx;σz * σx == -σx * σz == im * σy.
- commutes if
It also sets the 3-tuple to the local Julia variable with name σ.
The macro can either be used to create several groups that commute with each other
julia> using CondensedMatterSOS
julia> (σ1x, σ1y, σ1z), (σ2x, σ2y, σ2z) = @spin(σ1, σ2)
((σ1ˣ, σ1ʸ, σ1ᶻ), (σ2ˣ, σ2ʸ, σ2ᶻ))
julia> σ1x * σ2y
σ1ˣσ2ʸ
julia> σ1x * σ1y
(0 + 1im)σ1ᶻ
julia> σ2z * σ2y
(0 - 1im)σ2ˣ
julia> (σ1x + σ2y) * (σ2x + im * σ1z)
σ1ˣσ2ˣ + (0 + 1im)σ1ᶻσ2ʸ + σ1ʸ + (0 - 1im)σ2ᶻOr also a vector of groups commuting with each other. Note that it returns a 1-tuple containing a 3-tuple hence the needed comma after (σx, σy, σz)
julia> using CondensedMatterSOS
julia> (σx, σy, σz), = @spin(σ[1:2])
((CondensedMatterSOS.SpinVariable[σˣ₁, σˣ₂], CondensedMatterSOS.SpinVariable[σʸ₁, σʸ₂], CondensedMatterSOS.SpinVariable[σᶻ₁, σᶻ₂]),)
julia> σx[1] * σx[2]
σˣ₁σˣ₂
julia> σx[2] * σx[1]
σˣ₁σˣ₂
julia> σx[1] * σx[1]
(1 + 0im)
julia> σy[1] * σy[1]
(1 + 0im)
julia> σx[1] * σy[1]
(0 + 1im)σᶻ₁
julia> σy[1] * σx[1]
(0 - 1im)σᶻ₁
julia> σz[1] * σx[1]
(0 + 1im)σʸ₁CondensedMatterSOS.ising_hamiltonian — Functionising_hamiltonian(σ, g, periodic::Bool, coef::Function = (I, J) -> 1)Return the Hamiltonian of the transverse-field Ising model with periodic boundary conditions if periodic is true and transverse field g. The input σ should be a triple σx, σy, σz of arrays as created with @spin.
julia> using CondensedMatterSOS
julia> @spin(σ[1:4])
((CondensedMatterSOS.SpinVariable[σˣ₁, σˣ₂, σˣ₃, σˣ₄], CondensedMatterSOS.SpinVariable[σʸ₁, σʸ₂, σʸ₃, σʸ₄], CondensedMatterSOS.SpinVariable[σᶻ₁, σᶻ₂, σᶻ₃, σᶻ₄]),)
julia> ising_hamiltonian(σ, 0.5, false)
σˣ₁σˣ₂ + σˣ₂σˣ₃ + σˣ₃σˣ₄ + (-0.5 + 0.0im)σᶻ₁ + (-0.5 + 0.0im)σᶻ₂ + (-0.5 + 0.0im)σᶻ₃ + (-0.5 + 0.0im)σᶻ₄CondensedMatterSOS.ising_glass_hamiltonian — Functionising_glass_hamiltonian(σ, g, periodic::Bool)Return the Hamiltonian of the transverse-field Ising spin glass model with periodic boundary conditions if periodic is true and transverse field g. The input σ should be a triple σx, σy, σz of arrays as created with @spin.
julia> using CondensedMatterSOS
julia> @spin(σ[1:3, 1:2])
((CondensedMatterSOS.SpinVariable[σˣ₁₋₁ σˣ₁₋₂; σˣ₂₋₁ σˣ₂₋₂; σˣ₃₋₁ σˣ₃₋₂], CondensedMatterSOS.SpinVariable[σʸ₁₋₁ σʸ₁₋₂; σʸ₂₋₁ σʸ₂₋₂; σʸ₃₋₁ σʸ₃₋₂], CondensedMatterSOS.SpinVariable[σᶻ₁₋₁ σᶻ₁₋₂; σᶻ₂₋₁ σᶻ₂₋₂; σᶻ₃₋₁ σᶻ₃₋₂]),)
julia> import Random; Random.seed!(0); # We set the seed so that the results of this example are reproducible.
julia> ising_glass_hamiltonian(σ, 1.5, false)
(0.6791074260357777 + 0.0im)σˣ₁₋₁σˣ₂₋₁ + (0.5866170746331097 + 0.0im)σˣ₁₋₁σˣ₁₋₂ + (0.8284134829000359 + 0.0im)σˣ₂₋₁σˣ₃₋₁ + (0.29733585084941616 + 0.0im)σˣ₂₋₁σˣ₂₋₂ + (0.06494754854834232 + 0.0im)σˣ₃₋₁σˣ₃₋₂ + (-0.3530074003005963 - 0.0im)σˣ₁₋₂σˣ₂₋₂ + (-0.13485387193052173 - 0.0im)σˣ₂₋₂σˣ₃₋₂ + (-1.5 + 0.0im)σᶻ₁₋₁ + (-1.5 + 0.0im)σᶻ₂₋₁ + (-1.5 + 0.0im)σᶻ₃₋₁ + (-1.5 + 0.0im)σᶻ₁₋₂ + (-1.5 + 0.0im)σᶻ₂₋₂ + (-1.5 + 0.0im)σᶻ₃₋₂
julia> ising_glass_hamiltonian((σ[1][1:2, 1:2], σ[2][1:2, 1:2], σ[3][1:2, 1:2]), 1, true)
(-0.6232277759150394 - 0.0im)σˣ₁₋₁σˣ₂₋₁ + (0.048825806096416735 + 0.0im)σˣ₁₋₁σˣ₁₋₂ + (0.05112780493936531 + 0.0im)σˣ₂₋₁σˣ₂₋₂ + (0.8854230743112911 + 0.0im)σˣ₁₋₂σˣ₂₋₂ + -σᶻ₁₋₁ + -σᶻ₂₋₁ + -σᶻ₁₋₂ + -σᶻ₂₋₂CondensedMatterSOS.energy — Functionenergy(H, maxdegree, solver;
cone=NonnegPolyInnerCone{MOI.HermitianPositiveSemidefiniteConeTriangle}(),
sparsity=MonomialSparsity(),
non_sparse=SumOfSquares.Certificate.MaxDegree(cone, MonomialBasis, maxdegree),
certificate=sparsity isa NoSparsity ? non_sparse : SumOfSquares.Certificate.SparseIdeal(sparsity, non_sparse),
kws...
)Compute a lower bound to the Ground State Energe (GSE) of the Hamiltonian H using a Sum-of-Squares certificate with monomials of maximum degree maxdegree and solver as a solver. The cone used is cone which is Hermitian PSD matrices by default. The sparsity is exploited to reduce the certificate. The certificate for each reduced part is non_sparse. The overall certificate is certificate. The rest of the keywords are passed to the @constraint macro of the SumOfSquares package.