From 98916c597dcaafd8113547a39d1e66704ac62b82 Mon Sep 17 00:00:00 2001 From: Jaron Kent-Dobias Date: Fri, 19 Oct 2018 11:05:32 -0400 Subject: added support for nonunitary x, so that bond probabilities can be changed as in the DGM paper --- lib/include/wolff.hpp | 4 ++-- lib/include/wolff/cluster.hpp | 8 ++++---- lib/include/wolff/system.hpp | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/include/wolff.hpp b/lib/include/wolff.hpp index 7e909c8..7ad608f 100644 --- a/lib/include/wolff.hpp +++ b/lib/include/wolff.hpp @@ -10,7 +10,7 @@ namespace wolff{ template void system::run_wolff(N_t N, std::function &, v_t)> r_gen, - measurement& A, std::mt19937& rng) { + measurement& A, std::mt19937& rng, double x) { std::uniform_int_distribution dist(0, nv - 1); @@ -20,7 +20,7 @@ void system::run_wolff(N_t N, A.pre_cluster(n, N, *this, i0, r); - this->flip_cluster(i0, r, rng, A); + this->flip_cluster(i0, r, rng, A, x); A.post_cluster(n, N, *this); } diff --git a/lib/include/wolff/cluster.hpp b/lib/include/wolff/cluster.hpp index b66f367..34d256a 100644 --- a/lib/include/wolff/cluster.hpp +++ b/lib/include/wolff/cluster.hpp @@ -13,7 +13,7 @@ namespace wolff { template void system::flip_cluster(v_t i0, const R_t& r, - std::mt19937& rng, measurement& A) { + std::mt19937& rng, measurement& A, double x) { std::uniform_real_distribution dist(0.0, 1.0); std::queue queue; @@ -69,7 +69,7 @@ void system::flip_cluster(v_t i0, const R_t& r, #endif #ifdef WOLFF_FINITE_STATES - p = finite_states_Bp[finite_states_enum(s0s_old)] + p = 1.0 - x + x * finite_states_Bp[finite_states_enum(s0s_old)] [finite_states_enum(s0s_new)]; #endif @@ -85,7 +85,7 @@ void system::flip_cluster(v_t i0, const R_t& r, #endif #ifdef WOLFF_FINITE_STATES - p = finite_states_Zp[finite_states_enum(s[i])] + p = 1.0 - x + x * finite_states_Zp[finite_states_enum(s[i])] [finite_states_enum(si_new)] [finite_states_enum(s[j])]; #endif @@ -95,7 +95,7 @@ void system::flip_cluster(v_t i0, const R_t& r, } #ifndef FINITE_STATES - p = 1.0 - exp(-dE / T); + p = 1.0 - x * exp(-dE / T); #endif if (dist(rng) < p) { diff --git a/lib/include/wolff/system.hpp b/lib/include/wolff/system.hpp index 32ad38e..6e9c951 100644 --- a/lib/include/wolff/system.hpp +++ b/lib/include/wolff/system.hpp @@ -68,8 +68,8 @@ class system { #endif } - void flip_cluster(v_t, const R_t&, std::mt19937&, measurement&); - void run_wolff(N_t, std::function &, v_t)> r_gen, measurement& A, std::mt19937& rng); + void flip_cluster(v_t, const R_t&, std::mt19937&, measurement&, double x = 1.0); + void run_wolff(N_t, std::function &, v_t)> r_gen, measurement& A, std::mt19937& rng, double x = 1.0); }; } -- cgit v1.2.3-70-g09d2