-
Notifications
You must be signed in to change notification settings - Fork 7
feature/HubbardMomSpace #353
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
base: develop
Are you sure you want to change the base?
Conversation
Benchmark resultJudge resultBenchmark Report for /home/runner/work/Rimu.jl/Rimu.jlJob Properties
ResultsA ratio greater than
Benchmark Group ListHere's a list of all the benchmark groups executed by this job:
Julia versioninfoTarget
Baseline
Target resultBenchmark Report for /home/runner/work/Rimu.jl/Rimu.jlJob Properties
ResultsBelow is a table of this job's results, obtained by running the benchmarks.
Benchmark Group ListHere's a list of all the benchmark groups executed by this job:
Julia versioninfo
Baseline resultBenchmark Report for /home/runner/work/Rimu.jl/Rimu.jlJob Properties
ResultsBelow is a table of this job's results, obtained by running the benchmarks.
Benchmark Group ListHere's a list of all the benchmark groups executed by this job:
Julia versioninfo
Runtime information
Architecture: x86_64
Benchmark resultJudge resultBenchmark Report for /home/runner/work/Rimu.jl/Rimu.jlJob Properties
ResultsA ratio greater than
Benchmark Group ListHere's a list of all the benchmark groups executed by this job:
Julia versioninfoTarget
Baseline
Target resultBenchmark Report for /home/runner/work/Rimu.jl/Rimu.jlJob Properties
ResultsBelow is a table of this job's results, obtained by running the benchmarks.
Benchmark Group ListHere's a list of all the benchmark groups executed by this job:
Julia versioninfo
Baseline resultBenchmark Report for /home/runner/work/Rimu.jl/Rimu.jlJob Properties
ResultsBelow is a table of this job's results, obtained by running the benchmarks.
Benchmark Group ListHere's a list of all the benchmark groups executed by this job:
Julia versioninfo
Runtime information
Architecture: x86_64
Benchmark resultJudge resultBenchmark Report for /home/runner/work/Rimu.jl/Rimu.jlJob Properties
ResultsA ratio greater than
Benchmark Group ListHere's a list of all the benchmark groups executed by this job:
Julia versioninfoTarget
Baseline
Target resultBenchmark Report for /home/runner/work/Rimu.jl/Rimu.jlJob Properties
ResultsBelow is a table of this job's results, obtained by running the benchmarks.
Benchmark Group ListHere's a list of all the benchmark groups executed by this job:
Julia versioninfo
Baseline resultBenchmark Report for /home/runner/work/Rimu.jl/Rimu.jlJob Properties
ResultsBelow is a table of this job's results, obtained by running the benchmarks.
Benchmark Group ListHere's a list of all the benchmark groups executed by this job:
Julia versioninfo
Runtime information
Architecture: x86_64
Benchmark resultJudge resultBenchmark Report for /home/runner/work/Rimu.jl/Rimu.jlJob Properties
ResultsA ratio greater than
Benchmark Group ListHere's a list of all the benchmark groups executed by this job:
Julia versioninfoTarget
Baseline
Target resultBenchmark Report for /home/runner/work/Rimu.jl/Rimu.jlJob Properties
ResultsBelow is a table of this job's results, obtained by running the benchmarks.
Benchmark Group ListHere's a list of all the benchmark groups executed by this job:
Julia versioninfo
Baseline resultBenchmark Report for /home/runner/work/Rimu.jl/Rimu.jlJob Properties
ResultsBelow is a table of this job's results, obtained by running the benchmarks.
Benchmark Group ListHere's a list of all the benchmark groups executed by this job:
Julia versioninfo
Runtime information
Architecture: x86_64
Benchmark resultJudge resultBenchmark Report for /home/runner/work/Rimu.jl/Rimu.jlJob Properties
ResultsA ratio greater than
Benchmark Group ListHere's a list of all the benchmark groups executed by this job:
Julia versioninfoTarget
Baseline
Target resultBenchmark Report for /home/runner/work/Rimu.jl/Rimu.jlJob Properties
ResultsBelow is a table of this job's results, obtained by running the benchmarks.
Benchmark Group ListHere's a list of all the benchmark groups executed by this job:
Julia versioninfo
Baseline resultBenchmark Report for /home/runner/work/Rimu.jl/Rimu.jlJob Properties
ResultsBelow is a table of this job's results, obtained by running the benchmarks.
Benchmark Group ListHere's a list of all the benchmark groups executed by this job:
Julia versioninfo
Runtime information
Architecture: x86_64
Benchmark resultJudge resultBenchmark Report for /home/runner/work/Rimu.jl/Rimu.jlJob Properties
ResultsA ratio greater than
Benchmark Group ListHere's a list of all the benchmark groups executed by this job:
Julia versioninfoTarget
Baseline
Target resultBenchmark Report for /home/runner/work/Rimu.jl/Rimu.jlJob Properties
ResultsBelow is a table of this job's results, obtained by running the benchmarks.
Benchmark Group ListHere's a list of all the benchmark groups executed by this job:
Julia versioninfo
Baseline resultBenchmark Report for /home/runner/work/Rimu.jl/Rimu.jlJob Properties
ResultsBelow is a table of this job's results, obtained by running the benchmarks.
Benchmark Group ListHere's a list of all the benchmark groups executed by this job:
Julia versioninfo
Runtime information
Architecture: x86_64 |
src/Hamiltonians/HubbardMomSpace.jl
Outdated
|
||
if fold | ||
dst_loc = (mod1.(dst_loc[1], S) , mod1.(dst_loc[2], S)) | ||
elseif !(all(ones(Int, D) .≤ dst_loc[2]. ≤S) && all(ones(Int, D) .≤ dst_loc[2] .≤ S)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is this supposed to do? It's essentially saying
if !x && x
which will never trigger.
Also all(ones(Int, D) .≤ dst_loc[2] .≤ S
should be rewritten as all(x -> 1 ≤ x ≤ S, dst_loc[2])
or it will allocate.
src/Hamiltonians/HubbardMomSpace.jl
Outdated
function Base.size(data::HubbardMomSpaceComponentData{<:Any,I,I}) where {I} | ||
M= num_modes(data.address1) | ||
s1, d1 = num_singly_doubly_occupied_sites(data.address1) | ||
return s1 * (s1-1) * (M-2) + d1*(M-1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
HubbardMomSpaceComponentData
is <:AbstractMatrix
. If that's the case, size
should return two numbers.
If you want it to have a single dimension, it should be <:AbstractVector
and return a 1-tuple as its size like so:
return s1 * (s1-1) * (M-2) + d1*(M-1) | |
return (s1 * (s1 - 1) * (M - 2) + d1*(M - 1), ) |
src/Hamiltonians/HubbardMomSpace.jl
Outdated
return [ks[i][mode] for (i, mode) in enumerate(mom_mode)] | ||
end | ||
|
||
function hub_dis_Mom_Space(t::SVector, k::Vector) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
function hub_dis_Mom_Space(t::SVector, k::Vector) | |
function hub_dis_mom_space(t::SVector, k::Vector) |
Don't use capitals in function names.
src/Hamiltonians/HubbardMomSpace.jl
Outdated
a geometry of the lattice. | ||
|
||
""" | ||
@inline function mom_transfer_MomSpace( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@inline function mom_transfer_MomSpace( | |
@inline function mom_transfer_mom_space( |
same here (and elsewhere).
The name of this function is a bit weird. Could this be merged with/replace momentum_transfer_excitation
?
src/Hamiltonians/HubbardMomSpace.jl
Outdated
|
||
""" | ||
|
||
function _mom_interactions_dig(component::Tuple, g::CubicGrid{D,S}) where {D,S} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's dig?
src/Hamiltonians/HubbardMomSpace.jl
Outdated
if Index[1] == Index[2] | ||
# If the occupied modes are the same, we can use the extended mom transfer. | ||
onproduct += extended_mom_transfer_diag(data.occmap1, g, u, w) | ||
else | ||
# Otherwise we need to calculate the interaction between two different occupied modes. | ||
onproduct += extended_mom_transfer_diag(data.occmap1, data.occmap2) * _interaction_parameter_dig(u, w, D) | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This bit is a little confusing to me. Why does one signature for extended_mom_transfer_diag
take interaction parameters and the other one doesn't? The comments don't really clarify it.
src/Hamiltonians/HubbardMomSpace.jl
Outdated
u = data.u | ||
w = data.w | ||
if !(isnothing(u) && isnothing(w)) | ||
Index = component_index(data) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Index = component_index(data) | |
index = component_index(data) |
CamelCase is only for types and type parameters
src/Hamiltonians/HubbardMomSpace.jl
Outdated
|
||
""" | ||
|
||
function _mom_interactions_dig(component::Tuple, g::CubicGrid{D,S}) where {D,S} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
function _mom_interactions_dig(component::Tuple, g::CubicGrid{D,S}) where {D,S} | |
function _mom_interactions_dig(component::Tuple, g::CubicGrid{D}) where {D} |
If you're not using S
, don't capture it.
src/Hamiltonians/HubbardMomSpace.jl
Outdated
struct HubbardMomSpaceComponentData{C,I1,I2,D,G,A,A1,A2,O1,O2} <: AbstractMatrix{Pair{A,Float64}} | ||
geometry::G | ||
parent_address::A | ||
address1::A1 | ||
address2::A2 | ||
u::Union{Float64, Nothing} # interaction strength | ||
w::Union{Float64, Nothing} # nearest neighbour interaction strength | ||
occmap1::O1 | ||
occmap2::O2 | ||
|
||
function HubbardMomSpaceComponentData{C,I1,I2,D}( | ||
geometry::G, | ||
parent::A, | ||
address1::A1, | ||
address2::A2, | ||
u::Union{Float64, Nothing}, | ||
w::Union{Float64, Nothing}, | ||
occmap1::O1=occupied_mode_map(address1), | ||
occmap2::O2=occupied_mode_map(address2), | ||
) where {C,I1,I2,D,G,A,A1,A2,O1,O2} | ||
return new{C,I1,I2,D,G,A,A1,A2,O1,O2}(geometry, parent, address1, address2, u, w, occmap1, occmap2) | ||
end | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
struct HubbardMomSpaceComponentData{C,I1,I2,D,G,A,A1,A2,O1,O2} <: AbstractMatrix{Pair{A,Float64}} | |
geometry::G | |
parent_address::A | |
address1::A1 | |
address2::A2 | |
u::Union{Float64, Nothing} # interaction strength | |
w::Union{Float64, Nothing} # nearest neighbour interaction strength | |
occmap1::O1 | |
occmap2::O2 | |
function HubbardMomSpaceComponentData{C,I1,I2,D}( | |
geometry::G, | |
parent::A, | |
address1::A1, | |
address2::A2, | |
u::Union{Float64, Nothing}, | |
w::Union{Float64, Nothing}, | |
occmap1::O1=occupied_mode_map(address1), | |
occmap2::O2=occupied_mode_map(address2), | |
) where {C,I1,I2,D,G,A,A1,A2,O1,O2} | |
return new{C,I1,I2,D,G,A,A1,A2,O1,O2}(geometry, parent, address1, address2, u, w, occmap1, occmap2) | |
end | |
end | |
struct HubbardMomSpaceComponentData{ | |
C,I1,I2,D,G,A,A1,A2,U<:Union{Float64,Nothing},W<:Union{Float64,Nothing},O1,O2 | |
} <: AbstractMatrix{Pair{A,Float64}} | |
geometry::G | |
parent_address::A | |
address1::A1 | |
address2::A2 | |
u::U # interaction strength | |
w::W # nearest neighbour interaction strength | |
occmap1::O1 | |
occmap2::O2 | |
function HubbardMomSpaceComponentData{C,I1,I2,D}( | |
geometry::G, | |
parent::A, | |
address1::A1, | |
address2::A2, | |
u::U, | |
w::W, | |
occmap1::O1=occupied_mode_map(address1), | |
occmap2::O2=occupied_mode_map(address2), | |
) where {C,I1,I2,D,G,A,A1,A2,U,W,O1,O2} | |
return new{C,I1,I2,D,G,A,A1,A2,U,W,O1,O2}( | |
geometry, parent, address1, address2, u, w, occmap1, occmap2 | |
) | |
end | |
end |
This fixes the allocation issue. Having non-concrete types (here, a Union
) in structs usually causes issues.
Also note the formatting. Break up long lines so that no line is longer than 92 characters.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have made all the changes that were suggested so far.
- enforcing Hermitian property in ``BasisSetRepresentation(HubbardMomSpace)`` which seems to be lost due to the use of trigonometric functions during the build of the matrix.
# Fixing the bug - ``ExtendedHubbardMom1D`` is always real. Previously, it was also allowed to be typed as ``AbstractHamiltonian{TT}`` where ``TT`` was allowed to be `ComplexF64`, which was not required.
develop
HubbardMomSpace
operator (Fourior transform ofHubardRealspace
operator).HubardRealSpace
does, exceptharmonic trap
.