From a43ff1f98e9b9814f858bccb11c174b418458491 Mon Sep 17 00:00:00 2001 From: Jaron Kent-Dobias Date: Wed, 10 Oct 2018 21:45:32 -0400 Subject: big rearrangement of files to make libraries and example (research) files clearer, and changed to c++ std lib random numbers --- lib/include/wolff.hpp | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 lib/include/wolff.hpp (limited to 'lib/include/wolff.hpp') diff --git a/lib/include/wolff.hpp b/lib/include/wolff.hpp new file mode 100644 index 0000000..c10a211 --- /dev/null +++ b/lib/include/wolff.hpp @@ -0,0 +1,35 @@ + +#include "wolff/cluster.hpp" +#include "wolff/state.hpp" + +template +void wolff(count_t N, state_t & s, std::function gen_R, std::function &)> measurements, std::mt19937& r, bool silent) { + +#ifdef FINITE_STATES +#ifdef NOFIELD + initialize_probs(s.J, s.T); +#else + initialize_probs(s.J, s.H, s.T); +#endif +#endif + + std::uniform_int_distribution dist(0, s.nv); + + if (!silent) printf("\n"); + for (count_t steps = 0; steps < N; steps++) { + if (!silent) printf("\033[F\033[JWOLFF: step %" PRIu64 " / %" PRIu64 ": E = %.2f, S = %" PRIv "\n", steps, N, s.E, s.last_cluster_size); + + v_t v0 = dist(r); + R_t step = gen_R(r, s.spins[v0]); + flip_cluster (s, v0, step, r); + + measurements(s); + } + + if (!silent) { + printf("\033[F\033[J"); + } + printf("WOLFF: step %" PRIu64 " / %" PRIu64 ": E = %.2f, S = %" PRIv "\n", N, N, s.E, s.last_cluster_size); + +} + -- cgit v1.2.3-70-g09d2