Skip to content

Commit fad7491

Browse files
authored
Merge pull request #30 from QuantumKitHub/zy-tJ-overhaul
2 parents c5d4542 + 7964a46 commit fad7491

File tree

7 files changed

+204
-1003
lines changed

7 files changed

+204
-1003
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "TensorKitTensors"
22
uuid = "41b62e7d-e9d1-4e23-942c-79a97adf954b"
33
authors = ["QuantumKitHub"]
4-
version = "0.2.1"
4+
version = "0.2.2"
55

66
[deps]
77
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"

docs/make.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ makedocs(;
2020
assets = String[],
2121
),
2222
pages = ["Home" => "index.md", "Operators" => operatorpages],
23+
checkdocs = :public
2324
)
2425

2526
deploydocs(;

src/TensorKitTensors.jl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,13 @@ export FermionOperators
66
export TJOperators
77
export HubbardOperators
88

9+
using TensorKit
10+
11+
include("utils.jl")
912
include("spinoperators.jl")
1013
include("bosonoperators.jl")
1114
include("fermionoperators.jl")
12-
include("tjoperators.jl")
1315
include("hubbardoperators.jl")
16+
include("tjoperators.jl")
1417

1518
end

src/hubbardoperators.jl

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ module HubbardOperators
33
using TensorKit
44

55
export hubbard_space
6-
export e_num, u_num, d_num, ud_num, half_ud_num
6+
export e_num, u_num, d_num, ud_num, half_ud_num, h_num
77
export S_x, S_y, S_z, S_plus, S_min
88
export u_plus_u_min, d_plus_d_min
99
export u_min_u_plus, d_min_d_plus
@@ -15,7 +15,7 @@ export e_plus_e_min, e_min_e_plus, e_hopping
1515
export singlet_plus, singlet_min
1616
export S_plus_S_min, S_min_S_plus, S_exchange
1717

18-
export n, nꜛ, nꜜ, nꜛꜜ
18+
export n, nꜛ, nꜜ, nꜛꜜ, nʰ
1919
export Sˣ, Sʸ, Sᶻ, S⁺, S⁻
2020
export u⁺u⁻, d⁺d⁻, u⁻u⁺, d⁻d⁺
2121
export u⁻d⁻, d⁻u⁻, u⁺d⁺, d⁺u⁺
@@ -72,11 +72,11 @@ end
7272
# Single-site operators
7373
# ---------------------
7474
function single_site_operator(
75-
T, particle_symmetry::Type{<:Sector},
75+
elt::Type{<:Number}, particle_symmetry::Type{<:Sector},
7676
spin_symmetry::Type{<:Sector}
7777
)
7878
V = hubbard_space(particle_symmetry, spin_symmetry)
79-
return zeros(T, V V)
79+
return zeros(elt, V V)
8080
end
8181

8282
@doc """
@@ -132,8 +132,8 @@ end
132132
const nꜛ = u_num
133133

134134
@doc """
135-
d_num([particle_symmetry::Type{<:Sector}], [spin_symmetry::Type{<:Sector}])
136-
nꜜ([particle_symmetry::Type{<:Sector}], [spin_symmetry::Type{<:Sector}])
135+
d_num([elt::Type{<:Number}], [particle_symmetry::Type{<:Sector}], [spin_symmetry::Type{<:Sector}])
136+
nꜜ([elt::Type{<:Number}], [particle_symmetry::Type{<:Sector}], [spin_symmetry::Type{<:Sector}])
137137
138138
Return the one-body operator that counts the number of spin-down particles.
139139
""" d_num
@@ -262,6 +262,17 @@ function half_ud_num(elt::Type{<:Number}, ::Type{SU2Irrep}, ::Type{SU2Irrep})
262262
return t
263263
end
264264

265+
@doc """
266+
h_num([elt::Type{<:Number}], [particle_symmetry::Type{<:Sector}], [spin_symmetry::Type{<:Sector}])
267+
nʰ([elt::Type{<:Number}], [particle_symmetry::Type{<:Sector}], [spin_symmetry::Type{<:Sector}])
268+
269+
Return the one-body operator that counts the number of holes, i.e. the number of non-occupied sites.
270+
""" h_num
271+
h_num(P::Type{<:Sector}, S::Type{<:Sector}) = h_num(ComplexF64, P, S)
272+
h_num(elt::Type{<:Number}, particle_symmetry::Type{<:Sector}, spin_symmetry::Type{<:Sector}) =
273+
id(elt, hubbard_space(particle_symmetry, spin_symmetry)) - e_num(elt, particle_symmetry, spin_symmetry)
274+
const= h_num
275+
265276
@doc """
266277
S_plus(elt::Type{<:Number}, particle_symmetry::Type{<:Sector}, spin_symmetry::Type{<:Sector})
267278
S⁺(elt::Type{<:Number}, particle_symmetry::Type{<:Sector}, spin_symmetry::Type{<:Sector})
@@ -312,7 +323,7 @@ const S⁻ = S_min
312323
S_x(elt::Type{<:Number}, particle_symmetry::Type{<:Sector}, spin_symmetry::Type{<:Sector})
313324
Sˣ(elt::Type{<:Number}, particle_symmetry::Type{<:Sector}, spin_symmetry::Type{<:Sector})
314325
315-
Return the one-body spin-1/2 x-operator on the electrons (only defined for `Trivial` symmetry). .
326+
Return the one-body spin-1/2 x-operator on the electrons (only defined for `Trivial` symmetry).
316327
""" S_x
317328
function S_x(P::Type{<:Sector} = Trivial, S::Type{<:Sector} = Trivial)
318329
return S_x(ComplexF64, P, S)
@@ -332,7 +343,7 @@ const Sˣ = S_x
332343
S_y(elt::Type{<:Number}, particle_symmetry::Type{<:Sector}, spin_symmetry::Type{<:Sector})
333344
Sʸ(elt::Type{<:Number}, particle_symmetry::Type{<:Sector}, spin_symmetry::Type{<:Sector})
334345
335-
Return the one-body spin-1/2 y-operator on the electrons (only defined for `Trivial` symmetry).
346+
Return the one-body spin-1/2 y-operator on the electrons (only defined for `Trivial` symmetry).
336347
""" S_y
337348
function S_y(P::Type{<:Sector} = Trivial, S::Type{<:Sector} = Trivial)
338349
return S_y(ComplexF64, P, S)
@@ -352,7 +363,7 @@ const Sʸ = S_y
352363
S_z(elt::Type{<:Number}, particle_symmetry::Type{<:Sector}, spin_symmetry::Type{<:Sector})
353364
Sᶻ(elt::Type{<:Number}, particle_symmetry::Type{<:Sector}, spin_symmetry::Type{<:Sector})
354365
355-
Return the one-body spin-1/2 z-operator on the electrons.
366+
Return the one-body spin-1/2 z-operator on the electrons.
356367
""" S_z
357368
function S_z(P::Type{<:Sector} = Trivial, S::Type{<:Sector} = Trivial)
358369
return S_z(ComplexF64, P, S)
@@ -600,7 +611,7 @@ const e⁻e⁺ = e_min_e_plus
600611
e_hop([elt::Type{<:Number}], [particle_symmetry::Type{<:Sector}], [spin_symmetry::Type{<:Sector}])
601612
602613
Return the two-body operator that describes a particle that hops between the first and the second site.
603-
""" e_hop
614+
""" e_hopping
604615
e_hopping(P::Type{<:Sector}, S::Type{<:Sector}) = e_hopping(ComplexF64, P, S)
605616
function e_hopping(
606617
elt::Type{<:Number}, particle_symmetry::Type{<:Sector},

0 commit comments

Comments
 (0)