Skip to content

Commit

Permalink
Merge branch 'feature/AllOverlaps-excited-states' of https://github.c…
Browse files Browse the repository at this point in the history
…om/joachimbrand/Rimu.jl into feature/AllOverlaps-excited-states
  • Loading branch information
jamie-tay committed Jan 20, 2025
2 parents 2d9bff2 + 667fff0 commit 51527f0
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ FFTW = "1"
Folds = "0.2"
HypergeometricFunctions = "0.3"
IterativeSolvers = "0.9"
KrylovKit = "0.6, 0.7, 0.8"
KrylovKit = "0.6, 0.7, 0.8, 0.9"
MPI = "0.20"
MacroTools = "0.5"
Measurements = "2"
Expand Down
2 changes: 1 addition & 1 deletion src/StatsTools/growth_witness.jl
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ function growth_witness(
shift=:shift, norm=:norm, time_step=nothing, kwargs...
)
df = DataFrame(sim)
time_step = determine_constant_time_step(df)
time_step = isnothing(time_step) ? determine_constant_time_step(df) : time_step

shift_vec = getproperty(df, Symbol(shift))
norm_vec = getproperty(df, Symbol(norm))
Expand Down
16 changes: 11 additions & 5 deletions src/StatsTools/reweighting.jl
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ function determine_constant_time_step(df)
elseif hasproperty(df, "time_step_1")
return df.time_step_1[end]
else
throw(ArgumentError("Time step not found in `df`"))
throw(ArgumentError("key `\"time_step\"` not found in `df` metadata"))
end
else
throw(ArgumentError("Time step not constant"))
Expand Down Expand Up @@ -221,6 +221,7 @@ Returns a `NamedTuple` with the fields
* `threading = Threads.nthreads() > 1`: if `false` a progress meter is displayed
* `shift_name = :shift` name of column in `df` with shift data
* `norm_name = :norm` name of column in `df` with walkernumber data
* `time_step = determine_constant_time_step(df)` the time step
* `warn = true` whether to log warning messages when blocking fails or denominators are
small
Expand All @@ -244,14 +245,15 @@ function growth_estimator_analysis(
threading=Threads.nthreads() > 1,
shift_name=:shift,
norm_name=:norm,
time_step=nothing,
warn=true,
kwargs...
)
df = DataFrame(sim)
shift_v = Vector(getproperty(df, Symbol(shift_name))) # casting to `Vector` to make SIMD loops efficient
norm_v = Vector(getproperty(df, Symbol(norm_name)))
num_reps = length(filter(startswith("norm"), names(df)))
time_step = determine_constant_time_step(df)
time_step = isnothing(time_step) ? determine_constant_time_step(df) : time_step
se = blocking_analysis(shift_v; skip)
E_r = se.mean
correlation_estimate = 2^(se.k - 1)
Expand Down Expand Up @@ -390,6 +392,7 @@ Returns a `NamedTuple` with the fields
* `shift_name = :shift` name of column in `df` with shift data
* `hproj_name = :hproj` name of column in `df` with operator overlap data
* `vproj_name = :vproj` name of column in `df` with projector overlap data
* `time_step = determine_constant_time_step(df)` the time step
* `warn = true` whether to log warning messages when blocking fails or denominators are small
## Example
Expand All @@ -414,14 +417,15 @@ function mixed_estimator_analysis(
hproj_name=:hproj,
vproj_name=:vproj,
warn=true,
time_step=nothing,
kwargs...
)
shift_v = Vector(getproperty(df, Symbol(shift_name))) # casting to `Vector` to make SIMD loops efficient
hproj_v = Vector(getproperty(df, Symbol(hproj_name)))
vproj_v = Vector(getproperty(df, Symbol(vproj_name)))
num_reps = length(filter(startswith("norm"), names(df)))

time_step = determine_constant_time_step(df)
time_step = isnothing(time_step) ? determine_constant_time_step(df) : time_step
se = blocking_analysis(shift_v; skip)
E_r = se.mean
correlation_estimate = 2^(se.k - 1)
Expand Down Expand Up @@ -560,11 +564,12 @@ function rayleigh_replica_estimator(
h=0,
skip=0,
Anorm=1,
time_step=nothing,
kwargs...
)
df = DataFrame(sim)
num_reps = parse(Int, metadata(df, "num_replicas"))
time_step = determine_constant_time_step(df)
time_step = isnothing(time_step) ? determine_constant_time_step(df) : time_step
T = eltype(df[!, Symbol(shift_name, "_r1s1")])
shift_v = Vector{T}[]
for a in 1:num_reps
Expand Down Expand Up @@ -632,11 +637,12 @@ function rayleigh_replica_estimator_analysis(
spectral_state=1,
Anorm=1,
warn=true,
time_step=nothing,
kwargs...
)
df = DataFrame(sim)
num_reps = parse(Int, metadata(df, "num_replicas"))
time_step = determine_constant_time_step(df)
time_step = isnothing(time_step) ? determine_constant_time_step(df) : time_step
# estimate the correlation time by blocking the shift data
T = eltype(df[!, Symbol(shift_name, "_r1s1")])
shift_v = Vector{T}[]
Expand Down

0 comments on commit 51527f0

Please sign in to comment.