Skip to content

Commit 6fb0f5f

Browse files
committed
copied over missing cluster_update!() function
1 parent 82daf9d commit 6fb0f5f

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

lib/BloqadeQMC/src/updates/cluster.jl

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ trialstate_weight_change(qmc_state::BinaryThermalState, lsize::Int, Ns::Int, i::
235235

236236
#############################################################################
237237

238-
# changed the function name below from cluster_update!() to generic_cluster_update!()
238+
# changed the function name below from cluster_update!() to generic_cluster_update!() in order to distinguish it from the other cluster_update function defined at the very bottom
239239

240240
function generic_cluster_update!(rng::AbstractRNG, update_kernel!::Function, acceptance::Function, lsize::Int, qmc_state::BinaryQMCState, H::AbstractIsing, d::Diagnostics)
241241
Ns = nspins(H)
@@ -331,3 +331,13 @@ function generic_cluster_update!(rng::AbstractRNG, update_kernel!::Function, acc
331331

332332
return lsize
333333
end
334+
335+
# might put this cluster_update function in a more visible position somewhere
336+
337+
function cluster_update!(rng, qmc_state, H::Hamiltonian, d::Diagnostics; p::Float64=0.0, kw...)
338+
if rand(rng) < p
339+
multibranch_update!(rng, qmc_state, H, d)
340+
else
341+
line_update!(rng, qmc_state, H, d)
342+
end
343+
end

lib/BloqadeQMC/src/updates/mc_step.jl

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,16 @@
22

33
# mc_step from groundstate.jl
44

5+
# I am keeping this function name cluster_update!() to keep it separate from the generic_cluster_update() function in cluster.jl. Previously, the two functions had the same name.
6+
7+
function cluster_update!(rng, qmc_state, H::Hamiltonian, d::Diagnostics; p::Float64=0.0, kw...)
8+
if rand(rng) < p
9+
multibranch_update!(rng, qmc_state, H, d)
10+
else
11+
line_update!(rng, qmc_state, H, d)
12+
end
13+
end
14+
515
function mc_step!(f::Function, rng::AbstractRNG, qmc_state::BinaryGroundState, H::Hamiltonian, d::Diagnostics; kw...)
616
full_diagonal_update!(rng, qmc_state, H, d)
717
lsize = cluster_update!(rng, qmc_state, H, d; kw...)

0 commit comments

Comments
 (0)