Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Hubbard model #80

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/operators/lattices/squarelattice.jl
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
end
end

Base.size(lattice::InfiniteSquare) = (lattice.Nrows, lattice.Ncols)

Check warning on line 15 in src/operators/lattices/squarelattice.jl

View check run for this annotation

Codecov / codecov/patch

src/operators/lattices/squarelattice.jl#L15

Added line #L15 was not covered by tests

function vertices(lattice::InfiniteSquare)
return CartesianIndices((1:(lattice.Nrows), 1:(lattice.Ncols)))
end
Expand Down
24 changes: 24 additions & 0 deletions src/operators/models.jl
Original file line number Diff line number Diff line change
Expand Up @@ -122,3 +122,27 @@
(neighbor => hy for neighbor in y_neighbors)...,
)
end

function MPSKitModels.hubbard_model(

Check warning on line 126 in src/operators/models.jl

View check run for this annotation

Codecov / codecov/patch

src/operators/models.jl#L126

Added line #L126 was not covered by tests
T::Type{<:Number},
particle_symmetry::Type{<:Sector},
spin_symmetry::Type{<:Sector},
lattice::InfiniteSquare;
t=1.0,
U=1.0,
mu=0.0,
n::Integer=0,
)
@assert n == 0 "Currently no support for imposing a fixed particle number"
hopping =

Check warning on line 137 in src/operators/models.jl

View check run for this annotation

Codecov / codecov/patch

src/operators/models.jl#L136-L137

Added lines #L136 - L137 were not covered by tests
MPSKitModels.e⁺e⁻(T, particle_symmetry, spin_symmetry) +
MPSKitModels.e⁻e⁺(T, particle_symmetry, spin_symmetry)
interaction_term = MPSKitModels.nꜛnꜜ(T, particle_symmetry, spin_symmetry)
N = MPSKitModels.e_number(T, particle_symmetry, spin_symmetry)

Check warning on line 141 in src/operators/models.jl

View check run for this annotation

Codecov / codecov/patch

src/operators/models.jl#L140-L141

Added lines #L140 - L141 were not covered by tests

return LocalOperator(

Check warning on line 143 in src/operators/models.jl

View check run for this annotation

Codecov / codecov/patch

src/operators/models.jl#L143

Added line #L143 was not covered by tests
fill(domain(hopping)[1], size(lattice)),
(neighbor => -t * hopping for neighbor in nearest_neighbours(lattice))...,
((idx,) => U * interaction_term - mu * N for idx in vertices(lattice))...,
)
end