diff --git a/src/operators/lattices/squarelattice.jl b/src/operators/lattices/squarelattice.jl index 097a4f7..a2f3d9b 100644 --- a/src/operators/lattices/squarelattice.jl +++ b/src/operators/lattices/squarelattice.jl @@ -12,6 +12,8 @@ struct InfiniteSquare <: AbstractLattice{2} end end +Base.size(lattice::InfiniteSquare) = (lattice.Nrows, lattice.Ncols) + function vertices(lattice::InfiniteSquare) return CartesianIndices((1:(lattice.Nrows), 1:(lattice.Ncols))) end diff --git a/src/operators/models.jl b/src/operators/models.jl index 324397f..f066c37 100644 --- a/src/operators/models.jl +++ b/src/operators/models.jl @@ -122,3 +122,27 @@ function pwave_superconductor( (neighbor => hy for neighbor in y_neighbors)..., ) end + +function MPSKitModels.hubbard_model( + 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 = + 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) + + return LocalOperator( + 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