diff --git a/Project.toml b/Project.toml index 8c5ef8275..4f541b494 100644 --- a/Project.toml +++ b/Project.toml @@ -4,6 +4,7 @@ authors = ["Joachim Brand "] version = "0.9.1-dev" [deps] +AllocCheck = "9b6a8646-10ed-4001-bbdc-1d2f46dfbb1a" Arrow = "69666777-d1a9-59fb-9406-91d4454c9d45" BSON = "fbb218c0-5317-5bc6-957e-2ee96dd4b1f0" Combinatorics = "861a8166-3701-5b0c-9a16-15d98fcdc6aa" diff --git a/src/BitStringAddresses/BitStringAddresses.jl b/src/BitStringAddresses/BitStringAddresses.jl index f139585d0..328de785e 100644 --- a/src/BitStringAddresses/BitStringAddresses.jl +++ b/src/BitStringAddresses/BitStringAddresses.jl @@ -9,6 +9,7 @@ using StaticArrays using SparseArrays using Setfield using Parameters +using AllocCheck using Base.Cartesian diff --git a/src/BitStringAddresses/occupationnumberfs.jl b/src/BitStringAddresses/occupationnumberfs.jl index 8feaf7da1..91927bc90 100644 --- a/src/BitStringAddresses/occupationnumberfs.jl +++ b/src/BitStringAddresses/occupationnumberfs.jl @@ -133,7 +133,7 @@ See also: [`destroy`](@ref), [`excitation`](@ref). return (ofs, val) end -""" +@doc """ excitation(addr::OccupationNumberFS, c::NTuple{<:Any,Int}, d::NTuple{<:Any,Int}) → (nadd, α) Generate an excitation on an [`OccupationNumberFS`](@ref) by applying the creation and @@ -158,7 +158,9 @@ julia> num_particles(es) 7 ``` """ -function excitation(fs::OccupationNumberFS{<:Any, T}, c::NTuple{<:Any,Int}, d::NTuple{<:Any,Int}) where {T} +excitation(fs::OccupationNumberFS{<:Any,T}, c::NTuple{<:Any,Int}, d::NTuple{<:Any,Int}) where {T} + +@check_allocs function excitation(fs::OccupationNumberFS{<:Any,T}, c::NTuple{<:Any,Int}, d::NTuple{<:Any,Int}) where {T} accu = one(T) for i in d fs, val = destroy(fs, i) diff --git a/src/Hamiltonians/FroehlichPolaron.jl b/src/Hamiltonians/FroehlichPolaron.jl index 940e92120..9a78ca0c9 100644 --- a/src/Hamiltonians/FroehlichPolaron.jl +++ b/src/Hamiltonians/FroehlichPolaron.jl @@ -24,12 +24,12 @@ geometry is to provide the number of dimensions `num_dimensions`. In this case t [`num_modes(address)`](@ref) of `address` must be a square number for `num_dimensions = 2`, or a cube number for `num_dimensions = 3`. -The `address` must be of type [`ONRFS`](@ref). +The `address` must be of type [`OccupationNumberFS`](@ref). """ struct FroehlichPolaron{ P, # total momentum T, # eltype - A<:ONRFS, # address type + A<:OccupationNumberFS, # address type G # lattice type } <: AbstractHamiltonian{T} add::A @@ -40,7 +40,7 @@ struct FroehlichPolaron{ end function FroehlichPolaron( - addr::ONRFS{<:Any, M}; + addr::OccupationNumberFS{<:Any, M}; geometry=nothing, alpha=1.0, total_mom=0.0, @@ -91,7 +91,7 @@ Base.getproperty(h::FroehlichPolaron, ::Val{:geometry}) = getfield(h, :geometry) num_dimensions(h::FroehlichPolaron) = num_dimensions(h.geometry) -# function diagonal_element(h::FroehlichPolaron, addr::ONRFS) +# function diagonal_element(h::FroehlichPolaron, addr::OccupationNumberFS) # return ( # (-h.total_mom)^2 + # num_particles(addr) +