From 3682da92f89692ed5c633cf2cdc60f1204e3b93e Mon Sep 17 00:00:00 2001 From: waltergu Date: Mon, 21 Nov 2022 09:43:22 +0800 Subject: [PATCH] =?UTF-8?q?Fix=20the=20bugs=20of=20=CE=93"z"=20and=20DM"z"?= =?UTF-8?q?.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CouplingsAmongDifferentDegreesOfFreedom.md | 6 +++--- src/QuantumSystems.jl | 8 ++++---- test/QuantumSystems.jl | 4 ++-- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/docs/src/unitcell description framework/CouplingsAmongDifferentDegreesOfFreedom.md b/docs/src/unitcell description framework/CouplingsAmongDifferentDegreesOfFreedom.md index 7fed5f8d..958e1638 100644 --- a/docs/src/unitcell description framework/CouplingsAmongDifferentDegreesOfFreedom.md +++ b/docs/src/unitcell description framework/CouplingsAmongDifferentDegreesOfFreedom.md @@ -294,12 +294,12 @@ Ising"z" => SparseMatrixCSC([0 0 0; 0 0 0; 0 0 1]) # Γ terms Γ"x" => SparseMatrixCSC([0 0 0; 0 0 1; 0 1 0]) Γ"y" => SparseMatrixCSC([0 0 1; 0 0 0; 1 0 0]) -Γ"z" => SparseMatrixCSC([0 1 0; 0 1 0; 0 0 0]) +Γ"z" => SparseMatrixCSC([0 1 0; 1 0 0; 0 0 0]) # Dzyaloshinskii–Moriya terms DM"x" => SparseMatrixCSC([0 0 0; 0 0 1; 0 -1 0]) DM"y" => SparseMatrixCSC([0 0 -1; 0 0 0; 1 0 0]) -DM"z" => SparseMatrixCSC([0 1 0; 0 -1 0; 0 0 0]) +DM"z" => SparseMatrixCSC([0 1 0; -1 0 0; 0 0 0]) ``` [`MatrixCoupling`](@ref)s can be producted or summed. @@ -416,7 +416,7 @@ Hopping( id::Symbol, value, bondkind, - coupling=Coupling(Index(:, FID(:, :, :)), Index(:, FID(:, :, :)); + coupling=Coupling(Index(:, FID(:, :, :)), Index(:, FID(:, :, :))); amplitude::Union{Function, Nothing}=nothing ) diff --git a/src/QuantumSystems.jl b/src/QuantumSystems.jl index eb25e2db..af5211b7 100644 --- a/src/QuantumSystems.jl +++ b/src/QuantumSystems.jl @@ -657,28 +657,28 @@ end """ Γ"x" => SparseMatrixCSC([0 0 0; 0 0 1; 0 1 0]) Γ"y" => SparseMatrixCSC([0 0 1; 0 0 0; 1 0 0]) - Γ"z" => SparseMatrixCSC([0 1 0; 0 1 0; 0 0 0]) + Γ"z" => SparseMatrixCSC([0 1 0; 1 0 0; 0 0 0]) The Γ coupling matrix. """ macro Γ_str(str::String) str=="x" && return SparseMatrixCSC([0 0 0; 0 0 1; 0 1 0]) str=="y" && return SparseMatrixCSC([0 0 1; 0 0 0; 1 0 0]) - str=="z" && return SparseMatrixCSC([0 1 0; 0 1 0; 0 0 0]) + str=="z" && return SparseMatrixCSC([0 1 0; 1 0 0; 0 0 0]) error("@Γ_str error: wrong input string.") end """ DM"x" => SparseMatrixCSC([0 0 0; 0 0 1; 0 -1 0]) DM"y" => SparseMatrixCSC([0 0 -1; 0 0 0; 1 0 0]) - DM"z" => SparseMatrixCSC([0 1 0; 0 -1 0; 0 0 0]) + DM"z" => SparseMatrixCSC([0 1 0; -1 0 0; 0 0 0]) The DM coupling matrix. """ macro DM_str(str::String) str=="x" && return SparseMatrixCSC([0 0 0; 0 0 1; 0 -1 0]) str=="y" && return SparseMatrixCSC([0 0 -1; 0 0 0; 1 0 0]) - str=="z" && return SparseMatrixCSC([0 1 0; 0 -1 0; 0 0 0]) + str=="z" && return SparseMatrixCSC([0 1 0; -1 0 0; 0 0 0]) error("@DM_str error: wrong input string.") end diff --git a/test/QuantumSystems.jl b/test/QuantumSystems.jl index 3e891d1a..1c1d3cbf 100644 --- a/test/QuantumSystems.jl +++ b/test/QuantumSystems.jl @@ -610,13 +610,13 @@ end @testset "Γ" begin @test Γ"x" == SparseMatrixCSC([0 0 0; 0 0 1; 0 1 0]) @test Γ"y" == SparseMatrixCSC([0 0 1; 0 0 0; 1 0 0]) - @test Γ"z" == SparseMatrixCSC([0 1 0; 0 1 0; 0 0 0]) + @test Γ"z" == SparseMatrixCSC([0 1 0; 1 0 0; 0 0 0]) end @testset "DM" begin @test DM"x" == SparseMatrixCSC([0 0 0; 0 0 1; 0 -1 0]) @test DM"y" == SparseMatrixCSC([0 0 -1; 0 0 0; 1 0 0]) - @test DM"z" == SparseMatrixCSC([0 1 0; 0 -1 0; 0 0 0]) + @test DM"z" == SparseMatrixCSC([0 1 0; -1 0 0; 0 0 0]) end @testset "SpinTerm" begin